def initialize(values = {})
super({})
merge!(
:file => ENV['BG_CONFIG_FILE'] || "#{ENV['HOME']}/.boxgrinder/config",
:name => 'BoxGrinder Build',
:platform => :none,
:delivery => :none,
:force => false,
:log_level => :info,
:backtrace => false,
:dir => {
:root => Dir.pwd,
:build => 'build',
:cache => '/var/cache/boxgrinder',
:tmp => '/tmp'
},
:os_config => {},
:platform_config => {},
:delivery_config => {},
:additional_plugins => []
)
if ENV['BG_CONFIG_FILE']
raise "You specified empty configuration file path. Please make sure you set correct path for BG_CONFIG_FILE environment variable." if ENV['BG_CONFIG_FILE'].strip.empty?
raise "Configuration file '#{ENV['BG_CONFIG_FILE']}' couldn't be found. Please make sure you set correct path for BG_CONFIG_FILE environment variable." unless File.exists?(ENV['BG_CONFIG_FILE'])
end
deep_merge!(YAML.load_file(self.file)) if File.exists?(self.file)
merge_with_symbols!(values)
self.backtrace = true if [:debug, :trace].include?(self.log_level)
populate_user_ids!
end