1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- from invoke import task
- @task
- def clean(c):
- """Remove all artefacts."""
- patterns = ["build", "docs/build"]
- for pattern in patterns:
- c.run(f"rm -rf {pattern}")
- @task(name="docs", aliases=("html", "documentation"))
- def docs_html(c, output_directory="build/html"):
- """Build the documentation in HTML form."""
- c.run(f"python3 -m sphinx docs {output_directory}")
- @task
- def release(c, version):
- """"""
- if version not in ["minor", "major", "patch"]:
- print("Version can be either major, minor or patch.")
- return
- from docs import __version_info__, __version__
- _major, _minor, _patch = __version_info__
- if version == "patch":
- _patch = _patch + 1
- elif version == "minor":
- _minor = _minor + 1
- _patch = 0
- elif version == "major":
- _major = _major + 1
- _minor = 0
- _patch = 0
- c.run(f"git checkout -b release-{_major}.{_minor}.{_patch} dev")
- c.run(f"sed -i 's/{__version__}/{_major}.{_minor}.{_patch}/g' docs/__init__.py")
- print(f"Update the readme for version {_major}.{_minor}.{_patch}.")
- input("Press enter when ready.")
- c.run(f"git add -u")
- c.run(f'git commit -m "Update changelog version {_major}.{_minor}.{_patch}"')
- c.run(f"git push --set-upstream origin release-{_major}.{_minor}.{_patch}")
- c.run(f"git checkout main")
- c.run(f"git merge --no-ff release-{_major}.{_minor}.{_patch}")
- c.run(f'git tag -a {_major}.{_minor}.{_patch} -m "Release {_major}.{_minor}.{_patch}"')
- c.run(f"git push")
- c.run(f"git checkout dev")
- c.run(f"git merge --no-ff release-{_major}.{_minor}.{_patch}")
- c.run(f"git push")
- c.run(f"git branch -d release-{_major}.{_minor}.{_patch}")
- c.run(f"git push origin --tags")
- @task
- def local(c):
- """"""
- c.run("mkdir -p config data docs drawio fuseki fuseki-extra")
- c.run("docker-compose -f local.yml build")
- c.run("docker-compose -f local.yml up")
|