Allow custom version to be passed in via CLI

This commit is contained in:
David Heinemeier Hansson
2023-01-20 17:46:09 +01:00
parent 3d66e9ed33
commit 3bf56c2fdb
7 changed files with 39 additions and 29 deletions

View File

@@ -10,13 +10,13 @@ class Mrsk::Configuration
delegate :argumentize, to: Mrsk::Utils
class << self
def create_from(base_config_file, destination: nil)
def create_from(base_config_file, destination: nil, version: "missing")
new(load_config_file(base_config_file).tap do |config|
if destination
config.merge! \
load_config_file destination_config_file(base_config_file, destination)
end
end)
end, version: version)
end
private
@@ -34,8 +34,9 @@ class Mrsk::Configuration
end
end
def initialize(config, validate: true)
def initialize(config, version: "missing", validate: true)
@config = ActiveSupport::InheritableOptions.new(config)
@version = version
ensure_required_keys_present if validate
end
@@ -62,7 +63,7 @@ class Mrsk::Configuration
def version
@version ||= ENV["VERSION"] || `git rev-parse HEAD`.strip
@version
end
def repository