Module: ChefWorkstationInitialize::SelfBootstrap::NoChef::BerksHelpers
Instance Method Summary
collapse
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
#base_command, #get_homedir, #is_mixlib_disabled?, #main_command, #run_options
#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
#berks(*args, **run_opts) ⇒ Object
29
30
31
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 29
def berks(*args, **run_opts)
base_command('berks', *args, **run_opts)
end
|
#berks_vendor(cookbookname, project_name, berks_path, cookbook_path) ⇒ Object
63
64
65
66
67
68
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 63
def berks_vendor(cookbookname, project_name, berks_path, cookbook_path)
if dir_exist(cookbook_path)
worklog "Adding berks vendor of the cookbook #{cookbookname} into the chef repo #{project_name}"
berks("vendor #{berks_path}", cwd: cookbook_path) if file_exist?(::File.join(cookbook_path, 'Berksfile'))
end
end
|
#berks_vendor_all_cookbook ⇒ Object
53
54
55
56
57
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 53
def berks_vendor_all_cookbook
all_cookbooks.each do |cookbook|
berks_vendor_cookbook(cookbook)
end
end
|
#berks_vendor_cookbook(name) ⇒ Object
59
60
61
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 59
def berks_vendor_cookbook(name)
berks_vendor(name, project_name, workstation_berks_vendor_dir, get_git_path(name))
end
|
#berks_vendor_init ⇒ Object
33
34
35
36
37
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 33
def berks_vendor_init
worklog "Berks vendor initial cookbook\n"
berks 'install'
berks 'vendor'
end
|
#delete_all_berkslock ⇒ Object
47
48
49
50
51
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 47
def delete_all_berkslock
all_cookbooks.each do |cookbookname|
delete_cookbook_berkslock(cookbookname)
end
end
|
#delete_cookbook_berkslock(cookbookname) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 39
def delete_cookbook_berkslock(cookbookname)
if dir_exist(get_git_path(cookbookname))
cookbookdir = ::Dir.new(get_git_path(cookbookname))
berkslock = ::File.join(cookbookdir, 'Berksfile.lock')
::File.delete(berkslock) if cookbookdir.include?('Berksfile.lock')
end
end
|
#reset_berks_vendor_dir ⇒ Object
74
75
76
77
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 74
def reset_berks_vendor_dir
FileUtils.rm_rf(workstation_berks_vendor_dir)
generate_directory workstation_berks_vendor_dir
end
|
#self_berks_vendor ⇒ Object
70
71
72
|
# File 'lib/selfbootstrap/nochef/berks.rb', line 70
def self_berks_vendor
berks_vendor_cookbook(new_cookbook_name)
end
|