mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
15 lines
490 B
Ruby
15 lines
490 B
Ruby
# Get the first 6 characters of the current git commit hash
|
|
git_hash = `git rev-parse HEAD`.strip[0..5] rescue "unknown"
|
|
|
|
# Check if there are any uncommitted changes
|
|
is_dirty = `git status --porcelain`.strip.length > 0 rescue false
|
|
|
|
# Append "-dirty" if there are uncommitted changes
|
|
version = is_dirty ? "#{git_hash}-dirty" : git_hash
|
|
|
|
# Store server start time
|
|
Rails.application.config.server_start_time = Time.current
|
|
|
|
# Store the version
|
|
Rails.application.config.git_version = version
|