lib/percheron/config.rb in percheron-0.7.16 vs lib/percheron/config.rb in percheron-0.8.0

- old
+ new

@@ -76,11 +76,12 @@ def invalidate_memoised_values! @stacks = @yaml_contents = @raw_contents = @contents = nil end - def process_stacks! # FIXME: bugs here :( + # FIXME: bugs here :( + def process_stacks! stacks_by_name = contents.stacks.to_hash_by_key(:name) scanned = scan_unit_configs(stacks_by_name) stacks_by_name.each do |_, stack| stack_units = stack.fetch(:units, []).each_with_object({}) do |unit_config, all| merge_or_replace(all, unit_config, scanned) @@ -101,18 +102,19 @@ def merge_scanned(all, config, scanned) all.merge!(expand_unit_config(config, scanned[config.name])) end def replace_scanned(all, config, scanned) - match = config.fetch(:dependant_unit_names, []) + match = config.fetch(:needed_unit_names, []) unless (match & scanned.keys).empty? - config.dependant_unit_names = match.map { |v| scanned[v] }.flatten + config.needed_unit_names = match.map { |v| scanned[v] }.flatten end all[config.name] = config end - def scan_unit_configs(stacks_by_name) # FIXME + # FIXME + def scan_unit_configs(stacks_by_name) all = {} stacks_by_name.each do |_, stack| stack.fetch(:units, []).each do |unit_config| next if unit_config.fetch(:instances, 1) == 1 all[unit_config.name] = 1.upto(unit_config.instances).map do |number| @@ -121,10 +123,11 @@ end end all end - def expand_unit_config(unit_config, new_unit_names) # FIXME + # FIXME + def expand_unit_config(unit_config, new_unit_names) new_unit_names.each_with_object({}) do |new_name, all| temp_unit_config = unit_config.dup temp_unit_config.delete(:instances) temp_unit_config.pseudo_name = unit_config.name temp_unit_config.name = new_name