Files
sure/config/initializers/version.rb
eureka928 7e58458faa Handle missing git binary in commit_sha initializer
Rescues Errno::ENOENT when git is not installed, falling back to
BUILD_COMMIT_SHA env var or "unknown". Fixes crash in Docker
development containers that lack git.
2026-01-29 13:49:58 +01:00

23 lines
397 B
Ruby

module Sure
class << self
def version
Semver.new(semver)
end
def commit_sha
if Rails.env.production?
ENV["BUILD_COMMIT_SHA"]
else
ENV["BUILD_COMMIT_SHA"] || `git rev-parse HEAD`.chomp
end
rescue Errno::ENOENT
ENV.fetch("BUILD_COMMIT_SHA", "unknown")
end
private
def semver
"0.6.8-alpha.2"
end
end
end