deploy_rubygem 0.60.0.4.ga6cf712 → 0.60.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.circleci/config.yml +19 -0
- data/.gitignore +2 -1
- data/.kitchen/logs/kitchen.log +29 -29
- data/.rubocop.yml +7 -77
- data/Gemfile +6 -5
- data/Rakefile +9 -4
- data/bin/console +3 -3
- data/bin/deploy_jimbo_management_site_website +5 -2
- data/bin/deploy_jimbodragon +1 -1
- data/bin/deploy_rubygem +2 -2
- data/bin/deploy_with_habitat +23 -0
- data/bin/inspec_deploy_rubygem +14 -0
- data/bin/local_test_deploy_rubygem +2 -2
- data/bin/prepare_workstation +0 -1
- data/bin/test_deploy_rubygem +1 -1
- data/deploy_rubygem.gemspec +13 -15
- data/exe/deploy_rubygem +1 -1
- data/lib/deploy_rubygem/cookbook.rb +45 -63
- data/lib/deploy_rubygem/deploy_rubygem_options.rb +106 -0
- data/lib/deploy_rubygem/inspec.rb +15 -3
- data/lib/deploy_rubygem/kitchen.rb +48 -0
- data/lib/deploy_rubygem/project.rb +122 -0
- data/lib/deploy_rubygem/rubygem.rb +61 -37
- data/lib/deploy_rubygem/version.rb +15 -1
- data/lib/deploy_rubygem.rb +2 -119
- data/spec/generate_test_cookbook.rb +21 -0
- data/spec/jimbo_management_site.rb +50 -0
- data/spec/spec_helper.rb +12 -2
- data/spec/unit_deploy_rubygem.rb +47 -23
- data.tar.gz.sig +4 -1
- metadata +25 -19
- metadata.gz.sig +0 -0
- data/lib/deploy_rubygem/chef_supermarket.rb +0 -7
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# DeployRubygem - deploy a gem using rake
|
4
|
+
# Containing a class
|
5
|
+
module DeployRubygem
|
6
|
+
# Using Inspec to deploy and manage Inspec
|
7
|
+
class DeployRubygemOptions
|
8
|
+
def project_name
|
9
|
+
'deploy_rubygem'
|
10
|
+
end
|
11
|
+
|
12
|
+
def git
|
13
|
+
'git@github.com:JimboDragonGit/deploy_rubygem.git'
|
14
|
+
end
|
15
|
+
|
16
|
+
def chefrepo_git
|
17
|
+
'git@github.com:JimboDragonGit/jimbodragon.git'
|
18
|
+
end
|
19
|
+
|
20
|
+
def chefrepo_path
|
21
|
+
'/usr/local/chef/repo/jimbodragon'
|
22
|
+
end
|
23
|
+
|
24
|
+
def binaries
|
25
|
+
%w[
|
26
|
+
deploy_rubygem
|
27
|
+
prepare_workstation
|
28
|
+
test_deploy_rubygem
|
29
|
+
deploy_jimbodragon
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def dependencies
|
34
|
+
%w[
|
35
|
+
deploy_rubygem
|
36
|
+
jimbo_management_site
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
def path
|
41
|
+
File.join(ENV['HOME'], 'deploy_rubygem')
|
42
|
+
end
|
43
|
+
|
44
|
+
def jimbodragon_profiles
|
45
|
+
%w[
|
46
|
+
jimbodragon-accept
|
47
|
+
jimbodragon-applications
|
48
|
+
jimbodragon-deploy-context
|
49
|
+
jimbodragon-environment
|
50
|
+
jimbodragon-git
|
51
|
+
]
|
52
|
+
end
|
53
|
+
|
54
|
+
def workstation_profiles
|
55
|
+
%w[
|
56
|
+
jimbodragon-linux-baseline
|
57
|
+
jimbodragon-manual-push
|
58
|
+
jimbodragon-push
|
59
|
+
jimbodragon-services
|
60
|
+
jimbodragon-users
|
61
|
+
jimbodragon-workstation
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
def compliance_profiles
|
66
|
+
jimbodragon_profiles + workstation_profiles
|
67
|
+
end
|
68
|
+
|
69
|
+
def jimbo_management_site_cookbook
|
70
|
+
{
|
71
|
+
git: 'git@github.com:JimboDragonGit/jimbo_management_site.git',
|
72
|
+
path: File.join(ENV['HOME'], 'jimbo_management_site'),
|
73
|
+
kitchens: %w[base],
|
74
|
+
compliance_profiles: compliance_profiles,
|
75
|
+
execute_profiles: %w[jimbodragon-accept],
|
76
|
+
groups: %w[base]
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
def jimbo_management_site_profile
|
81
|
+
{
|
82
|
+
input: 'compliance/inputs/user.yml',
|
83
|
+
profile: 'jimbodragon-management-site'
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
def cookbooks
|
88
|
+
{
|
89
|
+
jimbo_management_site: jimbo_management_site_cookbook
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
def compile
|
94
|
+
{
|
95
|
+
project_name: project_name,
|
96
|
+
git: git,
|
97
|
+
chefrepo_git: chefrepo_git,
|
98
|
+
chefrepo_path: chefrepo_path,
|
99
|
+
binaries: binaries,
|
100
|
+
dependencies: dependencies,
|
101
|
+
path: path,
|
102
|
+
cookbooks: cookbooks
|
103
|
+
}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -1,15 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
3
|
+
require 'deploy_rubygem/project'
|
4
|
+
|
5
|
+
# DeployRubygem - deploy a gem using rake
|
6
|
+
# Containing a class
|
2
7
|
module DeployRubygem
|
8
|
+
# Using Inspec to deploy and manage Inspec
|
3
9
|
class Inspec
|
4
|
-
attr_reader :inspec_name
|
10
|
+
attr_reader :inspec_name, :input_file
|
5
11
|
|
6
|
-
def initialize(inspec_name)
|
12
|
+
def initialize(inspec_name, input_file = nil)
|
7
13
|
@inspec_name = inspec_name
|
14
|
+
@input_file = input_file
|
8
15
|
end
|
9
16
|
|
10
17
|
def apply
|
18
|
+
puts "ActuaL Dir #{Dir.pwd}"
|
19
|
+
puts "inspec_name = #{inspec_name}"
|
20
|
+
puts "input_file = #{input_file}"
|
11
21
|
system("inspec check compliance/profiles/#{inspec_name}")
|
12
|
-
|
22
|
+
cmd_opt = ''
|
23
|
+
cmd_opt = "--input-file #{input_file}" unless input_file.nil?
|
24
|
+
system("inspec exec compliance/profiles/#{inspec_name} #{cmd_opt}")
|
13
25
|
end
|
14
26
|
|
15
27
|
def update
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'deploy_rubygem/inspec'
|
4
|
+
|
5
|
+
# DeployRubygem - deploy a gem using rake
|
6
|
+
# Containing a class
|
7
|
+
module DeployRubygem
|
8
|
+
# Using Kitchen to deploy and manage Kitchen
|
9
|
+
class Kitchen
|
10
|
+
attr_reader :kitchen_name, :cookbook
|
11
|
+
|
12
|
+
def initialize(kitchen_name, cookbook)
|
13
|
+
@kitchen_name = kitchen_name
|
14
|
+
@cookbook = cookbook
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_file
|
18
|
+
::File.join("#{kitchen_name}_check.log")
|
19
|
+
end
|
20
|
+
|
21
|
+
def converge
|
22
|
+
system("kitchen converge #{kitchen_name}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy
|
26
|
+
system("kitchen destroy #{kitchen_name}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def ip
|
30
|
+
switch_to_cookbook
|
31
|
+
system("kitchen exec #{kitchen_name} -c 'hostname -I'")
|
32
|
+
end
|
33
|
+
|
34
|
+
def verify(showing: true)
|
35
|
+
cookbook.switch_to_cookbook
|
36
|
+
if showing
|
37
|
+
system("kitchen verify #{kitchen_name}")
|
38
|
+
else
|
39
|
+
system("kitchen verify #{kitchen_name} > #{check_file}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def target
|
44
|
+
verify(showing: false)
|
45
|
+
system("grep -n Target #{check_file}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# DeployRubygem - deploy a gem using rake
|
4
|
+
# Containing a class
|
5
|
+
module DeployRubygem
|
6
|
+
# Using Project to deploy and manage Project
|
7
|
+
class Project
|
8
|
+
attr_reader :project_options, :cookbooks, :compliance_profile
|
9
|
+
|
10
|
+
def initialize(new_project_options)
|
11
|
+
@project_options = new_project_options
|
12
|
+
@cookbooks = project_options[:cookbooks]&.map do |cookbook_name, cookbook_options|
|
13
|
+
new_cookbook_option = cookbook_options.dup
|
14
|
+
new_cookbook_option[:project_name] = cookbook_name
|
15
|
+
new_cookbook_option[:chefrepo_path] = chefrepo_path
|
16
|
+
Cookbook.new(new_cookbook_option)
|
17
|
+
end
|
18
|
+
@compliance_profile = Inspec.new(project_options[:compliance_profile])
|
19
|
+
end
|
20
|
+
|
21
|
+
# Wrapping GVB to fetch project version
|
22
|
+
class DeployVersion
|
23
|
+
attr_reader :path
|
24
|
+
|
25
|
+
def initialize(git_path)
|
26
|
+
@path = git_path
|
27
|
+
end
|
28
|
+
|
29
|
+
def execute_in_folder
|
30
|
+
current_folder = Dir.pwd
|
31
|
+
Dir.chdir path
|
32
|
+
get_gvb = yield if block_given?
|
33
|
+
Dir.chdir current_folder
|
34
|
+
get_gvb
|
35
|
+
end
|
36
|
+
|
37
|
+
def method_missing(method_name)
|
38
|
+
execute_in_folder { GVB.send(method_name) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def respond_to_missing?(method_name)
|
42
|
+
GVB.methods.include?(method_name)
|
43
|
+
end
|
44
|
+
|
45
|
+
def patch_bump
|
46
|
+
execute_in_folder { system('git version-bump patch') }
|
47
|
+
end
|
48
|
+
|
49
|
+
def short_version
|
50
|
+
"#{major_version}.#{minor_version}.#{patch_version}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def project_name
|
55
|
+
project_options[__method__]
|
56
|
+
end
|
57
|
+
|
58
|
+
def binaries
|
59
|
+
project_options[__method__]
|
60
|
+
end
|
61
|
+
|
62
|
+
def dependencies
|
63
|
+
project_options[__method__]
|
64
|
+
end
|
65
|
+
|
66
|
+
def path
|
67
|
+
project_options[__method__]
|
68
|
+
end
|
69
|
+
|
70
|
+
def git
|
71
|
+
project_options[__method__]
|
72
|
+
end
|
73
|
+
|
74
|
+
def chefrepo_git
|
75
|
+
project_options[__method__]
|
76
|
+
end
|
77
|
+
|
78
|
+
def chefrepo_path
|
79
|
+
project_options[__method__]
|
80
|
+
end
|
81
|
+
|
82
|
+
def deploy_cookbooks
|
83
|
+
cookbooks.each(&:deploy)
|
84
|
+
end
|
85
|
+
|
86
|
+
def release_cookbooks
|
87
|
+
project_options[:cookbooks].each(&:release)
|
88
|
+
end
|
89
|
+
|
90
|
+
def change_to_directory(git_path, git_url)
|
91
|
+
system("git clone #{git_url}") unless Dir.exist?(chefrepo_path)
|
92
|
+
Dir.chdir(git_path)
|
93
|
+
git_path
|
94
|
+
end
|
95
|
+
|
96
|
+
def change_to_project_folder
|
97
|
+
change_to_directory(path, git)
|
98
|
+
end
|
99
|
+
|
100
|
+
def change_to_chefrepo
|
101
|
+
change_to_directory(chefrepo_path, chefrepo_git)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_compliance
|
105
|
+
change_to_chefrepo
|
106
|
+
compliance_profile.update
|
107
|
+
compliance_profile.apply
|
108
|
+
end
|
109
|
+
|
110
|
+
def git_commit
|
111
|
+
system('git add .') || exit(106)
|
112
|
+
system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
|
113
|
+
system("git commit -m 'Self valifated for version #{GVB.version}'") || exit(107)
|
114
|
+
system('git push') || exit(108)
|
115
|
+
end
|
116
|
+
|
117
|
+
def gvb_version
|
118
|
+
@gvb_version ||= DeployVersion.new(path)
|
119
|
+
@gvb_version
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -1,61 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
|
3
|
-
class Rubygem
|
4
|
-
attr_reader :project_options
|
5
|
-
|
6
|
-
def initialize(new_project_options)
|
7
|
-
@project_options = new_project_options
|
8
|
-
end
|
9
|
-
|
10
|
-
def project_name
|
11
|
-
project_options[__method__]
|
12
|
-
end
|
13
|
-
|
14
|
-
def binaries
|
15
|
-
project_options[__method__]
|
16
|
-
end
|
17
|
-
|
18
|
-
def dependencies
|
19
|
-
project_options[__method__]
|
20
|
-
end
|
21
|
-
|
22
|
-
def path
|
23
|
-
project_options[__method__]
|
24
|
-
end
|
3
|
+
require 'deploy_rubygem/cookbook'
|
25
4
|
|
26
|
-
|
5
|
+
# DeployRubygem - deploy a gem using rake
|
6
|
+
# Containing a class
|
7
|
+
module DeployRubygem
|
8
|
+
# Using Rubygem to deploy and manage Rubygem
|
9
|
+
class Rubygem < Project
|
10
|
+
def deploy_dependencies
|
27
11
|
dependencies.each do |git_depends|
|
28
12
|
Dir.chdir(::File.join(ENV['HOME'], git_depends))
|
29
13
|
system('git pull')
|
30
14
|
|
31
|
-
system(
|
32
|
-
|
15
|
+
system('git add .')
|
16
|
+
|
33
17
|
system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
|
34
18
|
|
35
19
|
system('git push')
|
36
20
|
end
|
21
|
+
end
|
37
22
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
binaries.each do |executable|
|
23
|
+
def git_prepare
|
24
|
+
binaries.each do |executable|
|
42
25
|
system("git add bin/#{executable}")
|
43
26
|
end
|
44
|
-
|
27
|
+
|
45
28
|
system('git add deploy_rubygem.gemspec')
|
46
29
|
system('git add .circleci/config.yml')
|
47
|
-
|
30
|
+
|
48
31
|
system('git add lib')
|
49
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
def git_sync
|
35
|
+
Dir.chdir(path)
|
36
|
+
system('git pull')
|
37
|
+
end
|
38
|
+
|
39
|
+
def push_minor_bump
|
50
40
|
system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
|
51
|
-
|
52
41
|
system('git version-bump patch') # <major|minor|patch|show>
|
53
|
-
|
54
42
|
system('gem build')
|
55
|
-
|
56
43
|
system('gem push deploy_rubygem-$(git version-bump show).gem')
|
57
|
-
|
58
44
|
system('git version-bump minor') # <major|minor|patch|show>
|
59
45
|
end
|
46
|
+
|
47
|
+
def deploy_with_git
|
48
|
+
deploy_dependencies
|
49
|
+
git_sync
|
50
|
+
git_prepare
|
51
|
+
|
52
|
+
push_minor_bump
|
53
|
+
end
|
54
|
+
|
55
|
+
def rake_test
|
56
|
+
File.delete('Gemfile.lock') if File.exist?('Gemfile.lock')
|
57
|
+
system('bundle') || exit(100)
|
58
|
+
system('rake') || exit(101)
|
59
|
+
system('rake build') || exit(102)
|
60
|
+
system('rake install:local') || exit(103)
|
61
|
+
end
|
62
|
+
|
63
|
+
def rake_release
|
64
|
+
change_to_project_folder
|
65
|
+
git_commit
|
66
|
+
system('rake install') || exit(104)
|
67
|
+
system('rake release') || exit(105)
|
68
|
+
end
|
69
|
+
|
70
|
+
def release
|
71
|
+
change_to_project_folder
|
72
|
+
rake_test
|
73
|
+
rake_release
|
74
|
+
end
|
75
|
+
|
76
|
+
def deploy
|
77
|
+
change_to_chefrepo
|
78
|
+
deploy_cookbooks
|
79
|
+
change_to_project_folder
|
80
|
+
|
81
|
+
release
|
82
|
+
test_compliance
|
83
|
+
end
|
60
84
|
end
|
61
85
|
end
|
@@ -1,6 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'git-version-bump'
|
4
|
+
|
5
|
+
require 'deploy_rubygem/rubygem'
|
6
|
+
require 'deploy_rubygem/deploy_rubygem_options'
|
7
|
+
|
8
|
+
# Set version for DeployRubygem
|
4
9
|
module DeployRubygem
|
5
|
-
|
10
|
+
def self.project_name
|
11
|
+
'deploy_rubygem'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.new_deploy_rubygem
|
15
|
+
@self_project = Rubygem.new(DeployRubygemOptions.new.compile) if @self_project.nil?
|
16
|
+
@self_project
|
17
|
+
end
|
18
|
+
|
19
|
+
VERSION = new_deploy_rubygem.gvb_version.short_version
|
6
20
|
end
|
data/lib/deploy_rubygem.rb
CHANGED
@@ -1,124 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
require 'deploy_rubygem/rubygem'
|
3
|
-
require 'deploy_rubygem/cookbook'
|
4
3
|
require 'deploy_rubygem/version'
|
5
4
|
|
5
|
+
# DeployRubygem - deploy a gem using rake
|
6
6
|
module DeployRubygem
|
7
|
-
def self.project_name
|
8
|
-
'deploy_rubygem'
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.self_project_options
|
12
|
-
{
|
13
|
-
project_name: project_name,
|
14
|
-
git: 'git@github.com:JimboDragonGit/deploy_rubygem.git',
|
15
|
-
chefrepo_git: 'git@github.com:JimboDragonGit/jimbodragon.git',
|
16
|
-
binaries: %w(
|
17
|
-
deploy_rubygem
|
18
|
-
prepare_workstation
|
19
|
-
test_deploy_rubygem
|
20
|
-
deploy_jimbodragon
|
21
|
-
),
|
22
|
-
dependencies: %w(
|
23
|
-
deploy_rubygem
|
24
|
-
jimbo_management_site
|
25
|
-
),
|
26
|
-
path: DeployRubygem.deploy_rubygem_path,
|
27
|
-
cookbooks: {
|
28
|
-
jimbo_management_site: {
|
29
|
-
chef_repo: DeployRubygem.chefrepo_path,
|
30
|
-
git: 'git@github.com:JimboDragonGit/jimbo_management_site.git',
|
31
|
-
kitchens: %w(base),
|
32
|
-
profiles: %w(
|
33
|
-
jimbodragon-accept
|
34
|
-
jimbodragon-applications
|
35
|
-
jimbodragon-deploy-context
|
36
|
-
jimbodragon-environment
|
37
|
-
jimbodragon-git/
|
38
|
-
jimbodragon-linux-baseline
|
39
|
-
jimbodragon-manual-push
|
40
|
-
jimbodragon-push
|
41
|
-
jimbodragon-services
|
42
|
-
jimbodragon-users
|
43
|
-
jimbodragon-workstation
|
44
|
-
),
|
45
|
-
execute_profiles: %w(jimbodragon-accept),
|
46
|
-
groups: %w(base)
|
47
|
-
}
|
48
|
-
}
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.self_deploy
|
53
|
-
Rubygem.new(self_project_options).deploy
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.deploy_jimbo_management_site
|
57
|
-
self_project_options[:cookbooks].each do |cookbook_name, cookbook_options|
|
58
|
-
Cookbook.new(cookbook_name, cookbook_options).deploy
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
def self.deploy_rubygem_path
|
64
|
-
File.join(ENV['HOME'], project_name)
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def self.jimbo_management_site_path
|
69
|
-
File.join(ENV['HOME'], 'jimbo_management_site')
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.chefrepo_path
|
73
|
-
"/usr/local/chef/repo/jimbodragon"
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
def self.change_to_directory(git_path, git_url)
|
78
|
-
if not Dir.exist?(chefrepo_path)
|
79
|
-
system("git clone #{git_url}")
|
80
|
-
end
|
81
|
-
Dir.chdir(git_path)
|
82
|
-
git_path
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.main
|
86
|
-
DeployRubygem.change_to_directory(DeployRubygem.chefrepo_path, self_project_options[:chefrepo_git])
|
87
|
-
DeployRubygem.change_to_directory(DeployRubygem.jimbo_management_site_path, self_project_options[:cookbooks][:jimbo_management_site][:git])
|
88
|
-
DeployRubygem.change_to_directory(DeployRubygem.deploy_rubygem_path, self_project_options[:git])
|
89
|
-
|
90
|
-
DeployRubygem.self_deploy
|
91
|
-
DeployRubygem.deploy_jimbo_management_site
|
92
|
-
end
|
93
|
-
|
94
|
-
def self.rake_test
|
95
|
-
File.delete('Gemfile.lock') if File.exist?('Gemfile.lock')
|
96
|
-
system("bundle") || exit(100)
|
97
|
-
system("rake") || exit(101)
|
98
|
-
system("rake build") || exit(102)
|
99
|
-
system("rake install:local") || exit(103)
|
100
|
-
end
|
101
|
-
|
102
|
-
def self.rake_release
|
103
|
-
git_commit
|
104
|
-
system("rake install") || exit(104)
|
105
|
-
system("rake release") || exit(105)
|
106
|
-
end
|
107
|
-
|
108
|
-
def self.git_commit
|
109
|
-
system("git add .") || exit(106)
|
110
|
-
system("git commit -m 'Self valifated for version #{GVB.version}'") || exit(107)
|
111
|
-
system("git push") || exit(108)
|
112
|
-
end
|
113
|
-
|
114
|
-
def self.release
|
115
|
-
DeployRubygem.change_to_directory(DeployRubygem.deploy_rubygem_path, self_project_options[:git])
|
116
|
-
rake_test
|
117
|
-
rake_release
|
118
|
-
end
|
119
|
-
|
120
|
-
def self.deploy_jimbodragon
|
121
|
-
Dir.chdir(jimbo_management_site_path)
|
122
|
-
system('sudo rm -rf /tmp/jimbodragon/; chef exec inspec exec compliance/profiles/jimbodragon-chef')
|
123
|
-
end
|
124
7
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# RSpec.describe 'testing with cookbook' do
|
4
|
+
# it "create a test cookbook" do
|
5
|
+
# change_repo = DeployRubygem.change_to_directory(DeployRubygem.chefrepo_path, 'git@github.com:JimboDragonGit/jimbodragon.git')
|
6
|
+
# expect(change_repo).not_to be nil
|
7
|
+
# expect(change_repo).to include DeployRubygem.chefrepo_path
|
8
|
+
# end
|
9
|
+
|
10
|
+
# it "Change to jimbo_management_site folder" do
|
11
|
+
# change_repo = DeployRubygem.change_to_directory(DeployRubygem.jimbo_management_site_path, 'git@github.com:JimboDragonGit/jimbo_management_site.git')
|
12
|
+
# expect(change_repo).not_to be nil
|
13
|
+
# expect(change_repo).to include DeployRubygem.jimbo_management_site_path
|
14
|
+
# end
|
15
|
+
|
16
|
+
# it "Change to deploy_rubygem folder" do
|
17
|
+
# change_repo = DeployRubygem.change_to_directory(DeployRubygem.deploy_rubygem_path, 'git@github.com:JimboDragonGit/deploy_rubygem.git')
|
18
|
+
# expect(change_repo).not_to be nil
|
19
|
+
# expect(change_repo).to include DeployRubygem.deploy_rubygem_path
|
20
|
+
# end
|
21
|
+
# end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe 'Get jimbo_management_site cookbook' do
|
4
|
+
it 'should not be null' do
|
5
|
+
expect(jimbo_management_site_cookbook).not_to be nil
|
6
|
+
end
|
7
|
+
it 'should be a Project' do
|
8
|
+
expect(jimbo_management_site_cookbook).to be_kind_of(DeployRubygem::Project)
|
9
|
+
end
|
10
|
+
it 'should be a Cookbook' do
|
11
|
+
expect(jimbo_management_site_cookbook).to be_kind_of(DeployRubygem::Cookbook)
|
12
|
+
end
|
13
|
+
%w[deploy].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(jimbo_management_site_cookbook.methods.include?(method.to_sym)).to eq(true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec.describe 'Upload jimbo_management_site cookbook' do
|
21
|
+
it 'should switch to cookbook folder' do
|
22
|
+
switch_output = jimbo_management_site_cookbook.switch_to_cookbook
|
23
|
+
expect(switch_output).to be_kind_of(String)
|
24
|
+
expect(switch_output).to eq(jimbo_management_site_cookbook.path)
|
25
|
+
end
|
26
|
+
it 'should save progress' do
|
27
|
+
expect(jimbo_management_site_cookbook.save_progress).to be true
|
28
|
+
end
|
29
|
+
it 'should upload cookbook' do
|
30
|
+
upload_cookbook_output = jimbo_management_site_cookbook.upload_cookbook
|
31
|
+
expect(upload_cookbook_output).to be_kind_of(Array)
|
32
|
+
expect(upload_cookbook_output).to match(jimbo_management_site_cookbook.groups)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec.describe 'Test jimbo_management_site cookbook' do
|
37
|
+
it 'should prepare test environment' do
|
38
|
+
prepare_test_environment_output = jimbo_management_site_cookbook.prepare_test_environment
|
39
|
+
expect(prepare_test_environment_output).to be_kind_of(Array)
|
40
|
+
expect(prepare_test_environment_output).to match(jimbo_management_site_cookbook.kitchens)
|
41
|
+
end
|
42
|
+
it 'should verify' do
|
43
|
+
verify_output = jimbo_management_site_cookbook.verify
|
44
|
+
expect(verify_output).to be_kind_of(Array)
|
45
|
+
expect(verify_output).to match(jimbo_management_site_cookbook.execute_profiles)
|
46
|
+
end
|
47
|
+
it 'should save progress again' do
|
48
|
+
expect(jimbo_management_site_cookbook.save_progress).to be true
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'deploy_rubygem'
|
4
4
|
|
5
5
|
RSpec.configure do |config|
|
6
6
|
# Enable flags like --only-failures and --next-failure
|
7
|
-
config.example_status_persistence_file_path =
|
7
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
8
8
|
|
9
9
|
# Disable RSpec exposing methods globally on `Module` and `main`
|
10
10
|
config.disable_monkey_patching!
|
@@ -13,3 +13,13 @@ RSpec.configure do |config|
|
|
13
13
|
c.syntax = :expect
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
def deploy_rubygem
|
18
|
+
DeployRubygem.new_deploy_rubygem
|
19
|
+
end
|
20
|
+
|
21
|
+
def jimbo_management_site_cookbook
|
22
|
+
deploy_rubygem.cookbooks.select do |cookbook|
|
23
|
+
cookbook.cookbook_name.match? 'jimbo_management_site'
|
24
|
+
end.first
|
25
|
+
end
|