From 0c30f544d9901a88a7fdba8abca1601e61f36afe Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Sun, 10 Oct 2010 16:38:01 +0200 Subject: [PATCH] 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. --- config/initializers/git_info.rb | 20 +++++++++++++++++++- pkg/fedora/README.md | 3 --- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/config/initializers/git_info.rb b/config/initializers/git_info.rb index e7aaffdda..09b540703 100644 --- a/config/initializers/git_info.rb +++ b/config/initializers/git_info.rb @@ -2,4 +2,22 @@ # licensed under the Affero General Public License version 3 or later. See # 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 diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md index 96c9c47d9..2dade7700 100644 --- a/pkg/fedora/README.md +++ b/pkg/fedora/README.md @@ -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 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 the thin webserver and apache passenger, and on 32/64 bit systems.