Class: ChefDK::Command::GemForwarder

Inherits:
Base
  • Object
show all
Defined in:
lib/chef-dk/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

#chefdk_home, #err, #git_bin_dir, #git_windows_bin_dir, #msg, #omnibus_apps_dir, #omnibus_bin_dir, #omnibus_chefdk_location, #omnibus_embedded_bin_dir, #omnibus_env, #omnibus_install?, #omnibus_root, #stderr, #stdout, #system_command, #usr_bin_path, #usr_bin_prefix

Constructor Details

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

Instance Method Details

#needs_version?(params) ⇒ Boolean

Lazy solution: By automatically returning false, we force ChefDK::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)


43
44
45
# File 'lib/chef-dk/command/gem.rb', line 43

def needs_version?(params)
  false
end

#run(params) ⇒ Object



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

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