Class: ChefCLI::Command::GemForwarder

Inherits:
Base
  • Object
show all
Defined in:
lib/chef-cli/command/gem.rb

Overview

Forwards all commands to rubygems.

Instance Method Summary collapse

Methods inherited from Base

#check_license_acceptance, #initialize, #needs_help?, #run_with_default_options

Methods included from Helpers

#err, #git_bin_dir, #git_windows_bin_dir, #msg, #omnibus_bin_dir, #omnibus_embedded_bin_dir, #omnibus_env, #omnibus_expand_path, #omnibus_install?, #omnibus_root, #package_home, #stderr, #stdout, #system_command, #usr_bin_path, #usr_bin_prefix

Constructor Details

This class inherits a constructor from ChefCLI::Command::Base

Instance Method Details

#needs_version?(params) ⇒ Boolean

Lazy solution: By automatically returning false, we force ChefCLI::Base to call this class’ run method, so that Gem::GemRunner can handle the -v flag appropriately (showing the gem version, or installing a specific version of a gem).

Returns:

  • (Boolean)


42
43
44
# File 'lib/chef-cli/command/gem.rb', line 42

def needs_version?(params)
  false
end

#run(params) ⇒ Object



31
32
33
34
35
36
# File 'lib/chef-cli/command/gem.rb', line 31

def run(params)
  retval = Gem::GemRunner.new.run( params.clone )
  retval.nil? ? true : retval
rescue Gem::SystemExitException => e
  exit( e.exit_code )
end