Class: ChefCLI::Command::Install
- Includes:
 - ChefCLI::Configurable
 
- Defined in:
 - lib/chef-cli/command/install.rb
 
Instance Attribute Summary collapse
- 
  
    
      #policyfile_relative_path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute policyfile_relative_path.
 - 
  
    
      #ui  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute ui.
 
Instance Method Summary collapse
- #apply_params!(params) ⇒ Object
 - #config_path ⇒ Object
 - #debug? ⇒ Boolean
 - #handle_error(error) ⇒ Object
 - 
  
    
      #initialize(*args)  ⇒ Install 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Install.
 - #installer ⇒ Object
 - #run(params = []) ⇒ Object
 
Methods included from ChefCLI::Configurable
#chef_config, #chefcli_config, #config_loader, #generator_config, #knife_config, #reset_config!
Methods inherited from Base
#check_license_acceptance, #needs_help?, #needs_version?, #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
Instance Attribute Details
#policyfile_relative_path ⇒ Object (readonly)
Returns the value of attribute policyfile_relative_path.
      49 50 51  | 
    
      # File 'lib/chef-cli/command/install.rb', line 49 def policyfile_relative_path @policyfile_relative_path end  | 
  
#ui ⇒ Object
Returns the value of attribute ui.
      51 52 53  | 
    
      # File 'lib/chef-cli/command/install.rb', line 51 def ui @ui end  | 
  
Instance Method Details
#apply_params!(params) ⇒ Object
      98 99 100 101 102 103 104 105 106 107  | 
    
      # File 'lib/chef-cli/command/install.rb', line 98 def apply_params!(params) remaining_args = (params) if remaining_args.size > 1 ui.err(opt_parser) false else @policyfile_relative_path = remaining_args.first true end end  | 
  
#config_path ⇒ Object
      84 85 86  | 
    
      # File 'lib/chef-cli/command/install.rb', line 84 def config_path config[:config_file] end  | 
  
#debug? ⇒ Boolean
      80 81 82  | 
    
      # File 'lib/chef-cli/command/install.rb', line 80 def debug? !!config[:debug] end  | 
  
#handle_error(error) ⇒ Object
      88 89 90 91 92 93 94 95 96  | 
    
      # File 'lib/chef-cli/command/install.rb', line 88 def handle_error(error) ui.err("Error: #{error.}") if error.respond_to?(:reason) ui.err("Reason: #{error.reason}") ui.err("") ui.err(error.extended_error_info) if debug? ui.err(error.cause.backtrace.join("\n")) if debug? end end  | 
  
#installer ⇒ Object
      76 77 78  | 
    
      # File 'lib/chef-cli/command/install.rb', line 76 def installer @installer ||= PolicyfileServices::Install.new(policyfile: policyfile_relative_path, ui:, root_dir: Dir.pwd, config: chef_config) end  | 
  
#run(params = []) ⇒ Object
      61 62 63 64 65 66 67 68 69 70 71 72 73 74  | 
    
      # File 'lib/chef-cli/command/install.rb', line 61 def run(params = []) return 1 unless apply_params!(params) # Force config file to be loaded. We don't use the configuration # directly, but the user may have SSL configuration options that they # need to talk to a private supermarket (e.g., trusted_certs or # ssl_verify_mode) chef_config installer.run 0 rescue PolicyfileServiceError => e handle_error(e) 1 end  |