Class: Percheron::Actions::Start
- Inherits:
-
Object
- Object
- Percheron::Actions::Start
- Includes:
- Base
- Defined in:
- lib/percheron/actions/start.rb
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(unit, needed_units: [], create: true, cmd: false, exec_scripts: true) ⇒ Start
constructor
A new instance of Start.
Methods included from Base
#base_dir, #in_working_directory
Constructor Details
#initialize(unit, needed_units: [], create: true, cmd: false, exec_scripts: true) ⇒ Start
Returns a new instance of Start.
6 7 8 9 10 11 12 |
# File 'lib/percheron/actions/start.rb', line 6 def initialize(unit, needed_units: [], create: true, cmd: false, exec_scripts: true) @unit = unit @needed_units = needed_units @create = create @cmd = cmd @exec_scripts = exec_scripts end |
Instance Method Details
#execute! ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/percheron/actions/start.rb', line 14 def execute! return nil if unit.running? results = [ create! ] if unit.startable? results << start! results << execute_post_start_scripts! end results.compact.empty? ? nil : unit end |