Fallback to static version data if git unavailable.

Uses the file config/gitversion if git is unavailable.  This is to
support deployment without git (which will be necessary). Installation
script will generate the file config/gitversion when app is shipped.
This commit is contained in:
Alec Leamas 2010-10-10 16:38:01 +02:00
parent 4d58a39647
commit 0c30f544d9
2 changed files with 19 additions and 4 deletions

View file

@ -2,4 +2,22 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
GIT_INFO = `git show --name-only` s = `git show --name-only 2>/dev/null || :`
if (s.nil? or s.empty?)
path = File.expand_path("config/gitversion")
begin
if (File.exists?( path))
s = ''
f = File.open( path)
f.each_line do |line|
s += line
end
f.close
end
rescue
s = ""
end
end
GIT_INFO = s
# What's the scope of this s? Leave to GC just in case...
s = nil

View file

@ -65,9 +65,6 @@ The topmost comment's version is patched to reflect the complete version
of current specfile by 'make-dist source'. WRite the comment in this of current specfile by 'make-dist source'. WRite the comment in this
directory, copy-paste previous version nr. It will be updated. directory, copy-paste previous version nr. It will be updated.
rpmlint shows many errors, most of which related to that the server
won't start if the .git directories are not included. Needs investigation.
This has been confirmed to start up and provide basic functionality both using This has been confirmed to start up and provide basic functionality both using
the thin webserver and apache passenger, and on 32/64 bit systems. the thin webserver and apache passenger, and on 32/64 bit systems.