Fallback on 'version' in case git fails
This commit is contained in:
parent
cfaff60c7b
commit
3c02acab4c
1 changed files with 7 additions and 1 deletions
|
@ -46,10 +46,16 @@ module Utils
|
|||
end
|
||||
|
||||
##
|
||||
# @note
|
||||
# This method returns the website version in
|
||||
# case git fails or is unavailable
|
||||
# @return [String]
|
||||
# Returns the most recent git commit hash
|
||||
def commit
|
||||
@commit ||= cmd("git", "rev-parse", "HEAD").stdout.strip
|
||||
@commit ||= begin
|
||||
r = cmd("git", "rev-parse", "HEAD")
|
||||
r.success? ? r.stdout.strip : version
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue