Skip to content

Commit

Permalink
Add a dev-tools/set_docs_version script (elastic#6165)
Browse files Browse the repository at this point in the history
* Add a dev-tools/set_docs_version script

Similar to the `dev-toosl/set_version` script. At the moment, it
edits the `version.asciidoc` file and runs `make update`.
  • Loading branch information
tsg authored and ph committed Jan 25, 2018
1 parent 06d2f16 commit 2b24805
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions dev-tools/set_docs_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
import argparse
from subprocess import check_call

def main():
parser = argparse.ArgumentParser(
description="Used to set the current docs version. Doesn't commit changes.")
parser.add_argument("version",
help="The new docs version")
args = parser.parse_args()
version = args.version

# make sure we have no dirty files in this branch (might throw off `make update`)
check_call("git clean -dfx", shell=True)

# edit the file
with open("libbeat/docs/version.asciidoc", "r") as f:
lines = f.readlines()
for i, line in enumerate(lines):
if line.startswith(":stack-version:"):
lines[i] = ":stack-version: {}\n".format(version)
with open("libbeat/docs/version.asciidoc", "w") as f:
f.writelines(lines)

check_call("make update", shell=True)

if __name__ == "__main__":
main()

0 comments on commit 2b24805

Please sign in to comment.