Class: Rascal::CLI::Run

Inherits:
Base
  • Object
show all
Defined in:
lib/rascal/cli/run.rb

Instance Method Summary collapse

Constructor Details

#initialize(thor, options, environment_name, command) ⇒ Run

Returns a new instance of Run.



6
7
8
9
10
# File 'lib/rascal/cli/run.rb', line 6

def initialize(thor, options, environment_name, command)
  @environment_name = environment_name
  @command = command
  super(thor, options)
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
# File 'lib/rascal/cli/run.rb', line 12

def run
  if (environment = find_environment(@environment_name))
    fail_with_error('Missing command. Example: rascal run job -- bundle exec rake') if @command.empty?
    status = environment.run_command(*@command)
    exit(exit_code_for(status))
  end
end