lib/build-cloud.rb in build-cloud-0.0.7 vs lib/build-cloud.rb in build-cloud-0.0.8
- old
+ new
@@ -1,10 +1,11 @@
require 'fog'
require 'yaml'
require 'pry'
require 'logger'
require 'pp'
+require 'pathname'
class BuildCloud
@config
@log
@@ -29,20 +30,18 @@
end
end
include_files.each do |include_file|
- include_path = ''
- if include_file.include? '/'
- include_path = include_file
- else
- include_path = File.join( File.dirname( first_config_file ), include_file)
- end
+ include_path = Pathname.new(File.join( File.dirname( first_config_file ), include_file)).realpath
if File.exists?( include_path )
@log.info( "Including YAML file #{include_path}" )
included_conf = YAML::load( File.open( include_path ) )
- @config = @config.merge( included_conf )
+ @config = @config.merge(included_conf) do |keys, oldval, newval|
+ (newval.is_a?(Array) ? (oldval + newval) : (oldval << newval)).uniq
+ end
+
end
end
@log.debug( @config.inspect )