From c2c97997cdf7aa249a68664dd8e0b6cb4258c239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Abdelkader=20Mart=C3=ADnez=20P=C3=A9rez?= Date: Tue, 17 Dec 2019 09:46:26 +0100 Subject: [PATCH] docs: Extract current version from git and use it in the install instructions. --- docs/source/conf.py | 14 ++++++++++++++ .../the_project/install_and_configure.rst | 19 ++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index b5fc4bc..24c56fa 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,6 +13,8 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) +import os +import re # -- Project information ----------------------------------------------------- @@ -20,6 +22,18 @@ project = 'Kapow!' copyright = '2019, BBVA Innovation Labs' author = 'BBVA Innovation Labs' +# The full version, including alpha/beta/rc tags. +try: + release = re.sub('^v', '', os.popen('git describe').read().strip()) +except: + release = 'unknown' + +try: + # The short X.Y.Z-rcN version. + version = re.search('^(\d+\.\d+\.\d+(:?-rc\d+)?)', release).group(0) +except: + version = release + # -- General configuration --------------------------------------------------- diff --git a/docs/source/the_project/install_and_configure.rst b/docs/source/the_project/install_and_configure.rst index e493e8f..c2f2a50 100644 --- a/docs/source/the_project/install_and_configure.rst +++ b/docs/source/the_project/install_and_configure.rst @@ -22,9 +22,10 @@ Linux Install the downloaded binary using the following command as a privileged user. -.. code-block:: console +.. parsed-literal:: + + # install kapow\_\ |version|\ _linux_amd64 /usr/local/bin/kapow - # install kapow_?.?.?-linux_amd64 /usr/local/bin/kapow Windows @@ -47,14 +48,14 @@ run: Note that *Kapow!* leverages `Go modules`_, so you can target specific releases: -.. code-block:: console +.. parsed-literal:: - $ GO111MODULE=on go get -v github.com/BBVA/kapow@v0.3.0-rc4 - go: finding github.com v0.3.0-rc4 - go: finding github.com/BBVA v0.3.0-rc4 - go: finding github.com/BBVA/kapow v0.3.0-rc4 - go: downloading github.com/BBVA/kapow v0.3.0-rc4 - go: extracting github.com/BBVA/kapow v0.3.0-rc4 + $ GO111MODULE=on go get -v github.com/BBVA/kapow@v\ |version| + go: finding github.com v\ |version| + go: finding github.com/BBVA v\ |version| + go: finding github.com/BBVA/kapow v\ |version| + go: downloading github.com/BBVA/kapow v\ |version| + go: extracting github.com/BBVA/kapow v\ |version| github.com/google/shlex github.com/google/uuid github.com/spf13/pflag