Class: Dip::Commands::Run
- Inherits:
-
Dip::Command
- Object
- Dip::Command
- Dip::Commands::Run
- Defined in:
- lib/dip/commands/run.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(cmd, *argv, publish: nil) ⇒ Run
constructor
A new instance of Run.
Methods inherited from Dip::Command
Constructor Details
#initialize(cmd, *argv, publish: nil) ⇒ Run
Returns a new instance of Run.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dip/commands/run.rb', line 12 def initialize(cmd, *argv, publish: nil) @publish = publish @command, @argv = InteractionTree .new(Dip.config.interaction) .find(cmd, *argv)&.values_at(:command, :argv) raise Dip::Error, "Command `#{[cmd, *argv].join(" ")}` not recognized!" unless command Dip.env.merge(command[:environment]) end |
Instance Method Details
#execute ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dip/commands/run.rb', line 24 def execute if command[:service].nil? exec_program(command[:command], get_args, shell: command[:shell]) else Dip::Commands::Compose.new( command[:compose][:method], *compose_arguments, shell: command[:shell] ).execute end end |