lib/fulmar/domain/service/configuration_service.rb in fulmar-1.6.2 vs lib/fulmar/domain/service/configuration_service.rb in fulmar-1.6.3
- old
+ new
@@ -1,6 +1,7 @@
require 'yaml'
+require 'pp'
module Fulmar
module Domain
module Service
# Loads and prepares the configuration from the yaml file
@@ -170,19 +171,34 @@
@config = BLANK_CONFIG
config_files.each do |config_file|
@config = @config.deep_merge((YAML.load_file(config_file) || {}).symbolize)
end
+ prepare_environments
+ prepare_dependencies
# Iterate over all environments and targets to prepare them
+ @config[:environments].delete(:all)
+ @config
+ end
+
+ def prepare_environments
@config[:environments].each_key do |env|
next if env == :all
@config[:environments][env].each_key do |target|
fill_target(env, target)
check_path(env, target)
end
end
- @config[:environments].delete(:all)
- @config
+ end
+
+ def prepare_dependencies
+ @config[:dependencies].each_pair do |_env, repos|
+ repos.each_pair do |_name, repo|
+ next if repo[:path].blank?
+ full_path = File.expand_path("#{base_path}/#{repo[:path]}")
+ repo[:path] = full_path unless repo[:path][0,1] == '/'
+ end
+ end
end
def check_path(env, target)
return if @config[:environments][env][target][:local_path].blank?
@config[:environments][env][target][:local_path] = File.expand_path(@config[:environments][env][target][:local_path])