Class: ChefDK::Command::Exec

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

Instance Method Summary collapse

Methods inherited from Base

#initialize, #run_with_default_options

Methods included from Helpers

#chefdk_home, #err, #msg, #omnibus_apps_dir, #omnibus_bin_dir, #omnibus_chefdk_location, #omnibus_embedded_bin_dir, #omnibus_install?, #omnibus_root, #stderr, #stdout, #system_command

Constructor Details

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

Instance Method Details

#needs_help?(params) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/chef-dk/command/exec.rb', line 39

def needs_help?(params)
  ['-h', '--help'].include? params[0]
end

#needs_version?(params) ⇒ Boolean

Returns:

  • (Boolean)


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

def needs_version?(params)
  # Force version to get passed down to command
  false
end

#run(params) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/chef-dk/command/exec.rb', line 26

def run(params)
  # Set ENV directly on the "parent" process (us) before running #exec to
  # ensure the custom PATH is honored when finding the command to exec
  omnibus_env.each {|var, value| ENV[var] = value }
  exec(*params)
  raise "Exec failed without an exception, your ruby is buggy"  # should never get here
end