From 4b6a096c968401a8875cee7b13f2ee315b734690 Mon Sep 17 00:00:00 2001 From: Bruno Bord Date: Sat, 23 Apr 2016 00:11:53 +0200 Subject: [PATCH 1/2] added version in the HTML page footer --- CHANGELOG.md | 4 ++++ build.py | 10 ++++++++-- templates/base.html | 2 +- tox.ini | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2b0834..ed8200a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## master (unreleased) + +* added the automatic version number on the built HTML page footer (#9) + ## 1.0.0 (2016-04-22) This is the first version of the *open gaming content* "SRD" of "The Black Hack" roleplaying game. Please refer to the [README](README.md) for more information. diff --git a/build.py b/build.py index cf88d22..cb468e2 100644 --- a/build.py +++ b/build.py @@ -11,10 +11,13 @@ import markdown from mdx_gfm import GithubFlavoredMarkdownExtension import yaml +from shell import shell if __name__ == '__main__': + version = shell('git describe --tags').output(raw=True) + build_path = 'build' static_path = join(build_path, 'static') with open(join('templates', 'base.html')) as fd: @@ -48,6 +51,7 @@ body=body, title=directory, static='../static', + version=version, ) target_dir = join(build_path, directory) if not os.path.isdir(target_dir): @@ -97,7 +101,8 @@ html = template.substitute( body=body_html, title="Home", - static='static' + static='static', + version=version ) with open(join(build_path, 'index.html'), 'w') as fd: fd.write(html) @@ -113,7 +118,8 @@ html = template.substitute( body=license_html, title="Open Gaming License", - static='static' + static='static', + version=version ) with open(join(build_path, 'license.html'), 'w') as fd: fd.write(html) diff --git a/templates/base.html b/templates/base.html index 465d89d..3e0d389 100644 --- a/templates/base.html +++ b/templates/base.html @@ -70,7 +70,7 @@
$body
diff --git a/tox.ini b/tox.ini index 5a69923..f7131f5 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,8 @@ basepython = python3.4 deps = py-gfm PyYAML + shell + # For debuggin purposes ipdb commands = python build.py From 7db4258d0e11eae72b185b61c276c7bbea4b9390 Mon Sep 17 00:00:00 2001 From: Bruno Bord Date: Sat, 23 Apr 2016 00:20:43 +0200 Subject: [PATCH 2/2] "human readable version" along with the "git describe" version --- build.py | 10 +++++++--- templates/base.html | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index cb468e2..2591f4f 100644 --- a/build.py +++ b/build.py @@ -16,7 +16,8 @@ if __name__ == '__main__': - version = shell('git describe --tags').output(raw=True) + version = shell('git describe --tags --abbrev=0').output(raw=True).strip() + git_version = shell('git describe --tags').output(raw=True).strip() build_path = 'build' static_path = join(build_path, 'static') @@ -52,6 +53,7 @@ title=directory, static='../static', version=version, + git_version=git_version, ) target_dir = join(build_path, directory) if not os.path.isdir(target_dir): @@ -102,7 +104,8 @@ body=body_html, title="Home", static='static', - version=version + version=version, + git_version=git_version, ) with open(join(build_path, 'index.html'), 'w') as fd: fd.write(html) @@ -119,7 +122,8 @@ body=license_html, title="Open Gaming License", static='static', - version=version + version=version, + git_version=git_version, ) with open(join(build_path, 'license.html'), 'w') as fd: fd.write(html) diff --git a/templates/base.html b/templates/base.html index 3e0d389..1b29778 100644 --- a/templates/base.html +++ b/templates/base.html @@ -70,7 +70,7 @@
$body