lib/roku_builder/config.rb in roku_builder-4.6.0 vs lib/roku_builder/config.rb in roku_builder-4.6.1
- old
+ new
@@ -80,13 +80,15 @@
raise ArgumentError, "Missing Config" unless File.exist?(config_file)
end
def load_config
+ @loaded_configs = []
@config = {parent_config: @options[:config]}
depth = 1
while @config[:parent_config]
+ @loaded_configs.push(File.expand_path(@config[:parent_config]))
parent_config_hash = read_config(parent_io)
@config[:child_config] = @config[:parent_config]
@config.delete(:parent_config)
@config.merge!(parent_config_hash) {|_key, v1, _v2| v1}
depth += 1
@@ -117,20 +119,20 @@
end
end
def merge_local_config
local_config_path = "./.roku_config.json"
- if File.exist?(local_config_path)
+ if File.exist?(local_config_path) and !@loaded_configs.include?(File.expand_path(local_config_path))
local_config_hash = read_config(File.open(local_config_path))
add_missing_directories(local_config_hash)
@config = @config.deep_merge(local_config_hash)
end
end
def add_missing_directories(local_config)
if local_config[:projects]
local_config[:projects].each_pair do |key,value|
- unless value[:directory]
+ unless !value.is_a?(Hash) or value[:directory]
local_config[:projects][key][:directory] = RokuBuilder.system(command: "pwd")
end
end
end
end