Class: DeployRubygem::Project
Overview
Using Project to deploy and manage Project
Constant Summary
VERSION
Instance Attribute Summary collapse
Instance Method Summary
collapse
#check_current_version, #help_rspec, #install_gem_via_git, #testing_chef, #testing_gem, #testing_inspec, #testing_project, #testing_workstation
#bootstrap_chef_workstation, #chef_accept_cmd, #chef_env_cmd, deployer, exemple_cookbook, #install_chef_workstation, #no_option_txt, #rubygem_test, #unknown_option_txt
Constructor Details
#initialize(new_project_options) ⇒ Project
Returns a new instance of Project.
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/deploy_rubygem/project.rb', line 16
def initialize(new_project_options)
@project_options = new_project_options
@cookbooks = project_options[:cookbooks]&.map do |cookbook_name, cookbook_options|
new_cookbook_option = cookbook_options.dup
new_cookbook_option[:project_name] = cookbook_name
new_cookbook_option[:chefrepo_path] = chefrepo_path
Cookbook.new(new_cookbook_option)
end
@compliance_profile = InspecTestor.new(project_options[:compliance_profile])
end
|
Instance Attribute Details
#compliance_profile ⇒ Object
Returns the value of attribute compliance_profile.
14
15
16
|
# File 'lib/deploy_rubygem/project.rb', line 14
def compliance_profile
@compliance_profile
end
|
#cookbooks ⇒ Object
Returns the value of attribute cookbooks.
14
15
16
|
# File 'lib/deploy_rubygem/project.rb', line 14
def cookbooks
@cookbooks
end
|
#project_options ⇒ Object
Returns the value of attribute project_options.
14
15
16
|
# File 'lib/deploy_rubygem/project.rb', line 14
def project_options
@project_options
end
|
Instance Method Details
#binaries ⇒ Object
31
32
33
|
# File 'lib/deploy_rubygem/project.rb', line 31
def binaries
project_options[__method__]
end
|
#change_to_chefrepo ⇒ Object
73
74
75
|
# File 'lib/deploy_rubygem/project.rb', line 73
def change_to_chefrepo
change_to_directory(chefrepo_path, chefrepo_git)
end
|
#change_to_directory(git_path, git_url) ⇒ Object
63
64
65
66
67
|
# File 'lib/deploy_rubygem/project.rb', line 63
def change_to_directory(git_path, git_url)
system("git clone #{git_url}") unless Dir.exist?(chefrepo_path)
Dir.chdir(git_path)
git_path
end
|
#change_to_project_folder ⇒ Object
69
70
71
|
# File 'lib/deploy_rubygem/project.rb', line 69
def change_to_project_folder
change_to_directory(path, git)
end
|
#chefrepo_git ⇒ Object
47
48
49
|
# File 'lib/deploy_rubygem/project.rb', line 47
def chefrepo_git
project_options[__method__]
end
|
#chefrepo_path ⇒ Object
51
52
53
|
# File 'lib/deploy_rubygem/project.rb', line 51
def chefrepo_path
project_options[__method__]
end
|
#dependencies ⇒ Object
35
36
37
|
# File 'lib/deploy_rubygem/project.rb', line 35
def dependencies
project_options[__method__]
end
|
#deploy_cookbooks ⇒ Object
55
56
57
|
# File 'lib/deploy_rubygem/project.rb', line 55
def deploy_cookbooks
cookbooks.each(&:deploy)
end
|
#git ⇒ Object
43
44
45
|
# File 'lib/deploy_rubygem/project.rb', line 43
def git
project_options[__method__]
end
|
#git_commit ⇒ Object
83
84
85
86
87
|
# File 'lib/deploy_rubygem/project.rb', line 83
def git_commit
system('git add .') || return
system("git commit -m 'Self validated for version #{GVB.version}'") || return
system('git push') || abort("Cannot push #{project_name} #{GVB.version}")
end
|
#path ⇒ Object
39
40
41
|
# File 'lib/deploy_rubygem/project.rb', line 39
def path
project_options[__method__]
end
|
#project_name ⇒ Object
27
28
29
|
# File 'lib/deploy_rubygem/project.rb', line 27
def project_name
project_options[__method__]
end
|
#release_cookbooks ⇒ Object
59
60
61
|
# File 'lib/deploy_rubygem/project.rb', line 59
def release_cookbooks
project_options[:cookbooks].each(&:release)
end
|
#test_compliance ⇒ Object
77
78
79
80
81
|
# File 'lib/deploy_rubygem/project.rb', line 77
def test_compliance
change_to_chefrepo
compliance_profile.update
compliance_profile.apply
end
|