Module: ChefWorkstationInitialize::SelfBootstrap::NoChef::ChefHelpers

Includes:
BerksHelpers
Included in:
KitchenHelpers
Defined in:
lib/selfbootstrap/nochef/chef.rb

Instance Method Summary collapse

Methods included from BerksHelpers

#berks, #berks_vendor, #berks_vendor_all_cookbook, #berks_vendor_cookbook, #berks_vendor_init, #delete_all_berkslock, #delete_cookbook_berkslock, #reset_berks_vendor_dir, #self_berks_vendor

Methods included from GitHelpers

#all_cookbooks, #generate_git_submodules, #generate_json_repo, #get_git_path, #get_git_relative_path, #get_git_server, #get_git_submodule, #get_self_git, #git_exec, #git_submodule_init, #repository_list

Methods included from SSHHelpers

#delete_hostkey, #delete_hostkey_ip_or_name, #generate_private_key, #ssh, #ssh_command, #ssh_keygen

Methods included from CommandlineHelpers

#base_command, #get_homedir, #is_mixlib_disabled?, #main_command, #run_options

Methods included from DefaultMethodsHelpers

#analyse_object, #check_install_dir, #debug_worklog, #default_chefzero_portrange, #default_hostname, #default_install_dir, #define_resource_requirements, #error_worklog, #generate_default_install_dir, #generate_directory, #get_out_of_cache_path, #get_out_of_folder, #get_out_of_local_chef_path, #get_path, #is_chef_constant_enabled?, #parent_nil?, #require_implement_method, #search_local_project_folder, #warning_worklog, #worklog, #worklog_counter

Instance Method Details

#chef(*args, **run_opts) ⇒ Object



63
64
65
# File 'lib/selfbootstrap/nochef/chef.rb', line 63

def chef(*args, **run_opts)
  base_command('chef', args, run_opts)
end

#chef_client(*args, **run_opts) ⇒ Object



67
68
69
# File 'lib/selfbootstrap/nochef/chef.rb', line 67

def chef_client(*args, **run_opts)
  base_command('chef-client', args, run_opts)
end

#install_chef_workstationObject



75
76
77
# File 'lib/selfbootstrap/nochef/chef.rb', line 75

def install_chef_workstation
  base_command('curl -L https://omnitruck.chef.io/install.sh | bash -s -- -s once -P chef-workstation', [], as_system: true)
end

#is_chef_cli_command?Boolean



37
38
39
# File 'lib/selfbootstrap/nochef/chef.rb', line 37

def is_chef_cli_command?
  ::File.basename($PROGRAM_NAME).eql?('chef-cli')
end

#is_chef_client_command?Boolean



41
42
43
# File 'lib/selfbootstrap/nochef/chef.rb', line 41

def is_chef_client_command?
  ::File.basename($PROGRAM_NAME).eql?('chef-client')
end

#is_chef_command?Boolean



33
34
35
# File 'lib/selfbootstrap/nochef/chef.rb', line 33

def is_chef_command?
  ::File.basename($PROGRAM_NAME).eql?('chef')
end

#is_chef_enabled?Boolean



29
30
31
# File 'lib/selfbootstrap/nochef/chef.rb', line 29

def is_chef_enabled?
  is_chef_constant_enabled? :Chef
end

#is_chef_installed?Boolean



45
46
47
# File 'lib/selfbootstrap/nochef/chef.rb', line 45

def is_chef_installed?
  ::Dir.exist?('/opt/chef-workstation')
end

#is_chef_profile_set?Boolean



49
50
51
# File 'lib/selfbootstrap/nochef/chef.rb', line 49

def is_chef_profile_set?
  is_chef_installed? ? (base_command('which ruby', [], as_system: true).include? '/opt/chef-workstation') : false
end

#is_chefworkstation_available?Boolean



53
54
55
56
57
58
59
60
61
# File 'lib/selfbootstrap/nochef/chef.rb', line 53

def is_chefworkstation_available?
  if is_chef_profile_set?
    $LOAD_PATH.select do |loaded_path|
      loaded_path.include? '/opt/chef-workstation'
    end.count > 0
  else
    false
  end
end

#is_knife_gem_install?Boolean



71
72
73
# File 'lib/selfbootstrap/nochef/chef.rb', line 71

def is_knife_gem_install?
  chef('gem list -i knife') == 'true'
end