Merge branch '4465-workbench-version-links'
[arvados.git] / apps / workbench / app / helpers / version_helper.rb
1 module VersionHelper
2   include ArvadosApiClientHelper
3
4   # api_version returns the git commit hash for the API server's current version.
5   # It is extracted from api_version_text, which returns the source_version provided
6   # by the discovery document and may have the word "-modified" appended to it (if
7   # the API server is running from a locally modified repository).
8
9   def api_version()
10     api_version_text().sub(/[^[:xdigit:]].*/, '')
11   end
12
13   def api_version_text()
14     arvados_api_client.discovery[:source_version]
15   end
16
17   # wb_version and wb_version_text provide the same strings for the
18   # code version that this Workbench is currently running.
19
20   def wb_version()
21     Rails.configuration.source_version
22   end
23
24   def wb_version_text()
25     wbv = wb_version
26     wbv += Rails.configuration.local_modified if Rails.configuration.local_modified
27     wbv
28   end
29 end