Class: Herve::CLI::RubyCommands::Run

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/herve/cli/ruby_commands/run.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #logger

Instance Method Summary collapse

Methods inherited from BaseCommand

inherited

Instance Method Details

#call(version:, **args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/herve/cli/ruby_commands/run.rb', line 10

def call(version:, **args)
  ruby = RubyCommands.find_ruby(config, version)
  env = Config.env_for(ruby)
  raise Herve::Ruby::RequestError, "no version #{request} installed" if ruby.nil?

  cmd = [ruby.executable_path.to_s] + args[:args]
  Kernel.exec(env, *cmd)
end