Class: Dip::Commands::Run

Inherits:
Dip::Command show all
Defined in:
lib/dip/commands/run.rb

Instance Method Summary collapse

Methods inherited from Dip::Command

shell, subshell

Constructor Details

#initialize(cmd, *argv) ⇒ Run

Returns a new instance of Run.

Raises:



11
12
13
14
15
16
17
18
19
20
# File 'lib/dip/commands/run.rb', line 11

def initialize(cmd, *argv)
  @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

#executeObject



22
23
24
25
26
27
# File 'lib/dip/commands/run.rb', line 22

def execute
  Dip::Commands::Compose.new(
    command[:compose][:method],
    *compose_arguments
  ).execute
end