lib/percheron/actions/exec.rb in percheron-0.7.16 vs lib/percheron/actions/exec.rb in percheron-0.8.0

- old
+ new

@@ -1,14 +1,13 @@ module Percheron module Actions class Exec - include Base - def initialize(unit, dependant_units, scripts, description) + def initialize(unit, needed_units, scripts, description) @unit = unit - @dependant_units = dependant_units + @needed_units = needed_units @scripts = scripts @description = description end def execute! @@ -17,26 +16,26 @@ results.compact.empty? ? nil : unit end private - attr_reader :unit, :dependant_units, :scripts, :description + attr_reader :unit, :needed_units, :scripts, :description def exec! results = [] - started_dependant_units = start_units!(dependant_units) + started_needed_units = start_units!(needed_units) results << execute_scripts_on_running_unit! - results << stop_units!(started_dependant_units) + results << stop_units!(started_needed_units) results end def execute_scripts_on_running_unit! unit_running = unit.running? Start.new(unit, exec_scripts: false).execute! unless unit_running execute_scripts! commit_and_tag_new_image! - Stop.new(unit).execute! unless unit_running + Stop.new(unit).execute! unless unit_running end def commit_and_tag_new_image! new_image = unit.container.commit new_image.tag(repo: unit.image_repo, tag: unit.version.to_s, force: true) @@ -65,11 +64,11 @@ end def start_units!(units, scripts: true) exec_on_units!(units) do |unit| next if unit.running? - units = unit.startable_dependant_units.values - Start.new(unit, dependant_units: units, exec_scripts: scripts).execute! + units = unit.startable_needed_units.values + Start.new(unit, needed_units: units, exec_scripts: scripts).execute! end end def exec_on_units!(units) units.each_with_object([]) do |unit, all|