[#748] Make ChiliProject::Version.revision more resilient
* Won't output errors when the ChiliProject git repo isn't there anymore, * Works even if not invoked from the ChiliProject root directory, * Moved the formatting logic to the git call.
This commit is contained in:
parent
6a616a5f13
commit
d943efd0eb
|
@ -38,12 +38,7 @@ module ChiliProject
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.revision
|
def self.revision
|
||||||
revision = `git rev-parse HEAD`
|
`git --git-dir="#{Rails.root.join('.git')}" rev-parse --short=9 HEAD`.chomp if File.directory? Rails.root.join('.git')
|
||||||
if revision.present?
|
|
||||||
revision.strip[0..8]
|
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
REVISION = self.revision
|
REVISION = self.revision
|
||||||
|
|
Loading…
Reference in New Issue