deploy_rubygem 0.60.0.4.ga6cf712 → 0.60.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89dac36bb63313b245e1fd9318e2151c9d1daf14969420aecea105731d7586d6
4
- data.tar.gz: 601179ed285dcc825d307f3d0774887dca8217b97b29396857dca1833c4e0763
3
+ metadata.gz: b46534489fbc676e1cafd33d24882ec3a52a5e12ce14e241235ae7a730e94ff0
4
+ data.tar.gz: 1aec76802ed9d0d78320d19df474063e50f32979ef37e9a7f40d687e60f8063b
5
5
  SHA512:
6
- metadata.gz: bce361fbc34229875e56f564b94b9847f8a3c4b88cf6c8aefd03288ce1dfa7164d4fbc819d5ae657b0e8efec5c6d7ba5c408045a9d98cf0e1bbc573342eb7d4f
7
- data.tar.gz: 34d49a7415768d6d03dd721e342ed9cf7e53f08fe0ab78c29a0e89c212c0607c167cb8a0d8d03af82ea0534c2994fe139de328d410056008937138dab2333400
6
+ metadata.gz: cc9bd2bbd6e0c348b4f39d800e987e72dd647f4d8359364b8d2197471a5f7914e9a4f0232402cc048dbcc3a620a99a4820b054c579f607876e580ec52c5d7f5f
7
+ data.tar.gz: 699abadf754c54747852902744121e6323839d376462c5d4a355e1fee66cfbddf0d1288d87492b7b03800923b79abb8c592393846673ae04f8943162bacf8d60
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,29 +1,29 @@
1
- I, [2024-05-29T14:03:31.984983 #184666] INFO -- Kitchen: -----> Starting Test Kitchen (v3.3.2)
2
- E, [2024-05-29T14:03:31.985280 #184666] ERROR -- Kitchen: ------Exception-------
3
- E, [2024-05-29T14:03:31.985311 #184666] ERROR -- Kitchen: Class: Kitchen::UserError
4
- E, [2024-05-29T14:03:31.985333 #184666] ERROR -- Kitchen: Message: Kitchen YAML file /home/jimboadmin/deploy_rubygem/kitchen.yml does not exist.
5
- E, [2024-05-29T14:03:31.985353 #184666] ERROR -- Kitchen: ----------------------
6
- E, [2024-05-29T14:03:31.985372 #184666] ERROR -- Kitchen: ------Backtrace-------
7
- E, [2024-05-29T14:03:31.985393 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/loader/yaml.rb:65:in `read'
8
- E, [2024-05-29T14:03:31.985414 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:153:in `data'
9
- E, [2024-05-29T14:03:31.985435 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:131:in `suites'
10
- E, [2024-05-29T14:03:31.985455 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:183:in `filter_instances'
11
- E, [2024-05-29T14:03:31.985479 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:142:in `build_instances'
12
- E, [2024-05-29T14:03:31.985501 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:116:in `instances'
13
- E, [2024-05-29T14:03:31.985522 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command.rb:109:in `filtered_instances'
14
- E, [2024-05-29T14:03:31.985544 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command.rb:139:in `parse_subcommand'
15
- E, [2024-05-29T14:03:31.985564 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command/action.rb:34:in `block in call'
16
- E, [2024-05-29T14:03:31.985583 #184666] ERROR -- Kitchen: /home/jimboadmin/.chef/gem/ruby/3.0.0/gems/benchmark-0.2.1/lib/benchmark.rb:296:in `measure'
17
- E, [2024-05-29T14:03:31.985604 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command/action.rb:33:in `call'
18
- E, [2024-05-29T14:03:31.985625 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/cli.rb:52:in `perform'
19
- E, [2024-05-29T14:03:31.985645 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/cli.rb:198:in `block (2 levels) in <class:CLI>'
20
- E, [2024-05-29T14:03:31.985666 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
21
- E, [2024-05-29T14:03:31.985686 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
22
- E, [2024-05-29T14:03:31.985707 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
23
- E, [2024-05-29T14:03:31.985727 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
24
- E, [2024-05-29T14:03:31.985747 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/bin/kitchen:11:in `block in <top (required)>'
25
- E, [2024-05-29T14:03:31.985769 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/errors.rb:183:in `with_friendly_errors'
26
- E, [2024-05-29T14:03:31.985790 #184666] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/bin/kitchen:11:in `<top (required)>'
27
- E, [2024-05-29T14:03:31.985811 #184666] ERROR -- Kitchen: /opt/chef-workstation/bin/kitchen:389:in `load'
28
- E, [2024-05-29T14:03:31.985840 #184666] ERROR -- Kitchen: /opt/chef-workstation/bin/kitchen:389:in `<main>'
29
- E, [2024-05-29T14:03:31.985863 #184666] ERROR -- Kitchen: ----End Backtrace-----
1
+ I, [2024-05-30T17:21:52.504900 #1051516] INFO -- Kitchen: -----> Starting Test Kitchen (v3.3.2)
2
+ E, [2024-05-30T17:21:52.505259 #1051516] ERROR -- Kitchen: ------Exception-------
3
+ E, [2024-05-30T17:21:52.505291 #1051516] ERROR -- Kitchen: Class: Kitchen::UserError
4
+ E, [2024-05-30T17:21:52.505315 #1051516] ERROR -- Kitchen: Message: Kitchen YAML file /home/jimboadmin/deploy_rubygem/kitchen.yml does not exist.
5
+ E, [2024-05-30T17:21:52.505338 #1051516] ERROR -- Kitchen: ----------------------
6
+ E, [2024-05-30T17:21:52.505360 #1051516] ERROR -- Kitchen: ------Backtrace-------
7
+ E, [2024-05-30T17:21:52.505381 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/loader/yaml.rb:65:in `read'
8
+ E, [2024-05-30T17:21:52.505407 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:153:in `data'
9
+ E, [2024-05-30T17:21:52.505430 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:131:in `suites'
10
+ E, [2024-05-30T17:21:52.505456 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:183:in `filter_instances'
11
+ E, [2024-05-30T17:21:52.505479 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:142:in `build_instances'
12
+ E, [2024-05-30T17:21:52.505501 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/config.rb:116:in `instances'
13
+ E, [2024-05-30T17:21:52.505524 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command.rb:109:in `filtered_instances'
14
+ E, [2024-05-30T17:21:52.505552 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command.rb:139:in `parse_subcommand'
15
+ E, [2024-05-30T17:21:52.505584 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command/action.rb:34:in `block in call'
16
+ E, [2024-05-30T17:21:52.505610 #1051516] ERROR -- Kitchen: /home/jimboadmin/.chef/gem/ruby/3.0.0/gems/benchmark-0.2.1/lib/benchmark.rb:296:in `measure'
17
+ E, [2024-05-30T17:21:52.505634 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/command/action.rb:33:in `call'
18
+ E, [2024-05-30T17:21:52.505658 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/cli.rb:52:in `perform'
19
+ E, [2024-05-30T17:21:52.505681 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/cli.rb:198:in `block (2 levels) in <class:CLI>'
20
+ E, [2024-05-30T17:21:52.505704 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
21
+ E, [2024-05-30T17:21:52.505728 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
22
+ E, [2024-05-30T17:21:52.505752 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
23
+ E, [2024-05-30T17:21:52.505776 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
24
+ E, [2024-05-30T17:21:52.505800 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/bin/kitchen:11:in `block in <top (required)>'
25
+ E, [2024-05-30T17:21:52.505823 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/lib/kitchen/errors.rb:183:in `with_friendly_errors'
26
+ E, [2024-05-30T17:21:52.505847 #1051516] ERROR -- Kitchen: /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/test-kitchen-3.3.2/bin/kitchen:11:in `<top (required)>'
27
+ E, [2024-05-30T17:21:52.505870 #1051516] ERROR -- Kitchen: /opt/chef-workstation/bin/kitchen:389:in `load'
28
+ E, [2024-05-30T17:21:52.505902 #1051516] ERROR -- Kitchen: /opt/chef-workstation/bin/kitchen:389:in `<main>'
29
+ E, [2024-05-30T17:21:52.505926 #1051516] ERROR -- Kitchen: ----End Backtrace-----
data/.rspec CHANGED
@@ -1,4 +1,3 @@
1
1
  --format documentation
2
2
  --color
3
3
  --require spec_helper
4
- --require unit_deploy_rubygem
data/.rubocop.yml CHANGED
@@ -1,93 +1,27 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 3.0
3
3
 
4
4
  Style/StringLiterals:
5
- Enabled: false
6
- EnforcedStyle: double_quotes
5
+ Enabled: true
6
+ EnforcedStyle: single_quotes
7
7
 
8
8
  Style/StringLiteralsInInterpolation:
9
- Enabled: false
10
- EnforcedStyle: double_quotes
9
+ Enabled: true
10
+ EnforcedStyle: single_quotes
11
11
 
12
12
  Layout/LineLength:
13
- Enabled: false
14
- Max: 120
13
+ Enabled: true
14
+ Max: 155
15
15
 
16
- Style/PercentLiteralDelimiters:
17
- Enabled: false
18
-
19
- Layout/TrailingWhitespace:
20
- Enabled: false
21
-
22
16
  Style/FrozenStringLiteralComment:
23
17
  Enabled: false
24
18
 
25
- Metrics/MethodLength:
26
- Enabled: false
27
-
28
- Layout/LeadingEmptyLines:
29
- Enabled: false
30
-
31
- Style/Documentation:
32
- Enabled: false
33
-
34
- Style/AccessorGrouping:
35
- Enabled: false
36
-
37
- Style/OptionalBooleanParameter:
38
- Enabled: false
39
-
40
19
  Metrics/AbcSize:
41
20
  Enabled: false
42
21
 
43
- Style/Not:
44
- Enabled: false
45
-
46
- Style/NegatedIf:
47
- Enabled: false
48
-
49
- Style/IfUnlessModifier:
50
- Enabled: false
51
-
52
- Layout/EmptyLineBetweenDefs:
53
- Enabled: false
54
-
55
- Gemspec/DuplicatedAssignment:
56
- Enabled: false
57
-
58
- Style/TrailingCommaInHashLiteral:
59
- Enabled: false
60
-
61
- Layout/HashAlignment:
62
- Enabled: false
63
-
64
- Layout/SpaceAroundOperators:
65
- Enabled: false
66
-
67
- Layout/ExtraSpacing:
68
- Enabled: false
69
-
70
- Layout/IndentationConsistency:
71
- Enabled: false
72
-
73
- Layout/IndentationStyle:
74
- Enabled: false
75
-
76
- Layout/EmptyLines:
77
- Enabled: false
78
-
79
22
  Layout/CommentIndentation:
80
23
  Enabled: false
81
-
82
- Style/EmptyMethod:
83
- Enabled: false
84
-
85
- Layout/TrailingEmptyLines:
86
- Enabled: false
87
-
88
- Lint/ScriptPermission:
89
- Enabled: false
90
-
91
- Gemspec/RequiredRubyVersion:
92
- Enabled: false
93
-
24
+
25
+ Metrics/MethodLength:
26
+ Enabled: true
27
+ Max: 15
data/LICENSE.txt CHANGED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2024 Jimmy Provencher
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
5
 
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require "rubocop/rake_task"
6
+ require 'rubocop/rake_task'
9
7
 
8
+ RSpec::Core::RakeTask.new(:spec)
10
9
  RuboCop::RakeTask.new
11
10
 
12
- task default: %i[spec rubocop]
11
+ task test_framework: %i[clean rubocop spec]
12
+ task default: %i[test_framework build install:local]
13
+ task cicd: %i[default release test_version]
14
+ task test_version: %i[install compliance]
15
+ task :compliance do
16
+ system('inspec exec git@github.com:JimboDragonGit/rubygem_baseline.git --input-file compliance.yml')
17
+ end
@@ -1,7 +1,7 @@
1
1
  #!/opt/chef-workstation/embedded/bin/ruby
2
2
  Signal.trap('INT') { exit 1 }
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w(.. lib))
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
5
5
  require 'rubygems' unless defined?(Gem)
6
6
  require 'deploy_rubygem'
7
7
 
data/bin/deploy_rubygem CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/opt/chef-workstation/embedded/bin/ruby
2
2
  Signal.trap('INT') { exit 1 }
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w(.. lib))
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
5
5
  require 'rubygems' unless defined?(Gem)
6
6
  require 'deploy_rubygem'
7
7
 
8
- DeployRubygem.main
8
+ DeployRubygem.new_deploy_rubygem.deploy
@@ -1,4 +1,3 @@
1
1
  #!/opt/chef-workstation/embedded/bin/ruby
2
2
 
3
-
4
3
  system('chef-client')
@@ -4,4 +4,4 @@ Signal.trap('INT') { exit 1 }
4
4
  require 'rubygems' unless defined?(Gem)
5
5
  require 'deploy_rubygem'
6
6
 
7
- DeployRubygem.main
7
+ DeployRubygem.new_deploy_rubygem.release
data/exe/deploy_rubygem CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "deploy_rubygem"
3
+ require 'deploy_rubygem'
@@ -1,22 +1,42 @@
1
+ # frozen_string_literal: true
1
2
 
2
- require 'deploy_rubygem/inspec'
3
+ require_relative 'project'
4
+ require_relative 'kitchen'
5
+ require_relative 'inspec'
6
+ require_relative 'rubygem'
3
7
 
8
+ # DeployRubygem - deploy a gem using rake
9
+ # Containing a class
4
10
  module DeployRubygem
5
- class Cookbook
6
- attr_reader :cookbook_name
7
- attr_reader :cookbook_info
11
+ # Using Cookbook to deploy and manage cookbook
12
+ class Cookbook < Project
13
+ attr_reader :profiles, :kitchens, :execute_profiles
14
+
15
+ def initialize(new_cookbook_info)
16
+ super(new_cookbook_info)
17
+ @profiles = cookbook_info[:compliance_profiles].map do |profile_name|
18
+ input_file = File.join(%w[compliance inputs] + ["#{cookbook_name}.yml"])
19
+ waiver_file = File.join(%w[compliance waivers] + ["#{cookbook_name}.yml"])
20
+ Inspec.new(profile_name, input_file, waiver_file)
21
+ end
22
+ @kitchens = cookbook_info[:kitchens].map do |kitchen_name|
23
+ Kitchen.new(kitchen_name, self)
24
+ end
25
+ @execute_profiles = cookbook_info[:execute_profiles].map do |profile_name|
26
+ Inspec.new(profile_name)
27
+ end
28
+ end
8
29
 
9
- def initialize(new_cookbook_name, new_cookbook_info)
10
- @cookbook_name = new_cookbook_name.to_s
11
- @cookbook_info = new_cookbook_info
30
+ def cookbook_name
31
+ project_name
12
32
  end
13
33
 
14
- def chef_repo
15
- cookbook_info[__method__]
34
+ def cookbook_info
35
+ project_options
16
36
  end
17
37
 
18
38
  def cookbook_path
19
- ::File.join(chef_repo, 'cookbooks', cookbook_name)
39
+ ::File.join(chefrepo_path, 'cookbooks', cookbook_name.to_s)
20
40
  end
21
41
 
22
42
  def git
@@ -27,10 +47,6 @@ module DeployRubygem
27
47
  cookbook_info[__method__]
28
48
  end
29
49
 
30
- def check_file
31
- ::File.join("#{kitchen}_check.log")
32
- end
33
-
34
50
  def connect_cookbook
35
51
  system("git submodule add #{git}")
36
52
  system("git submodule init cookbooks/#{cookbook_name}")
@@ -39,47 +55,20 @@ module DeployRubygem
39
55
  end
40
56
 
41
57
  def switch_to_cookbook
42
- Dir.chdir(chef_repo)
58
+ change_to_chefrepo
43
59
  connect_cookbook
44
- Dir.chdir(cookbook_path)
45
- end
46
-
47
- def kitchen
48
- cookbook_info[:kitchens].first
49
- end
50
-
51
- def profile
52
- cookbook_info[:profiles].first
53
- end
54
-
55
- def kitchen_ip
56
- switch_to_cookbook
57
- system("kitchen exec #{kitchen} -c 'hostname -I'")
58
- end
59
-
60
- def kitchen_verify(showing = true)
61
- switch_to_cookbook
62
- if showing
63
- system("kitchen verify #{kitchen}")
64
- else
65
- system("kitchen verify #{kitchen} > #{check_file}")
66
- end
67
- end
68
-
69
- def kitchen_target
70
- kitchen_verify(false)
71
- system("grep -n Target #{check_file}")
60
+ change_to_project_folder
72
61
  end
73
62
 
74
63
  def upload_cookbook
75
64
  system('git pull')
76
65
 
77
- system("chef clean-policy-cookbooks")
78
- # system("chef clean-policy-revisions")
79
-
66
+ system('chef clean-policy-cookbooks')
67
+ # system('chef clean-policy-revisions')
68
+
80
69
  system("knife cookbook upload --cookbook-path '../' #{cookbook_name}")
81
70
 
82
- system("chef install Policyfile.rb")
71
+ system('chef install Policyfile.rb')
83
72
 
84
73
  groups.each do |group|
85
74
  system("chef push #{group} Policyfile.lock.json")
@@ -87,15 +76,12 @@ module DeployRubygem
87
76
  end
88
77
 
89
78
  def prepare_test_environment
90
- cookbook_info[:profiles].each do |inspec_profile|
91
- profile = DeployRubygem::Inspec.new(inspec_profile)
92
- profile.update
93
- end
94
- system("kitchen converge #{kitchen}")
79
+ profiles.each(&:update)
80
+ kitchens.each(&:converge)
95
81
  end
96
82
 
97
83
  def destroy_test_environment
98
- system("kitchen destroy #{kitchen}")
84
+ kitchens.each(&:destroy)
99
85
  end
100
86
 
101
87
  def deploy
@@ -109,23 +95,23 @@ module DeployRubygem
109
95
  end
110
96
 
111
97
  def verify
112
- puts "Verify cookbook #{cookbook_name} on target #{kitchen_target}"
113
-
114
- kitchen_verify
115
-
116
- cookbook_info[:execute_profiles].each do |inspec_profile|
117
- profile = DeployRubygem::Inspec.new(inspec_profile)
118
- profile.update
119
- profile.apply
98
+ kitchens.each do |kitchen|
99
+ puts "Verify cookbook #{cookbook_name} on target #{kitchen.target}"
100
+ kitchen.verify
101
+ end
102
+
103
+ execute_profiles.each do |inspec_profile|
104
+ inspec_profile.update
105
+ inspec_profile.apply
120
106
  end
121
107
  end
122
108
 
123
109
  def save_progress
124
110
  system('git add .')
125
111
  system("git commit -m \"Saving: hostname=#{ENV['HOSTNAME']}, cookbook_name=#{cookbook_name}\"")
126
- system("git push")
112
+ system('git push')
127
113
  end
128
-
114
+
129
115
  # system('sudo chef-client --override-runlist jimbo_management_site')
130
116
  end
131
117
  end
@@ -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,36 @@
1
+ # frozen_string_literal: true
1
2
 
3
+ # DeployRubygem - deploy a gem using rake
4
+ # Containing a class
2
5
  module DeployRubygem
6
+ # Using Inspec to deploy and manage Inspec
3
7
  class Inspec
4
- attr_reader :inspec_name
8
+ attr_reader :inspec_name, :input_file
5
9
 
6
- def initialize(inspec_name)
10
+ def initialize(inspec_name, input_file = nil, waiver_file = nil)
7
11
  @inspec_name = inspec_name
12
+ @input_file = input_file
13
+ @waiver_file = waiver_file
8
14
  end
9
15
 
10
16
  def apply
17
+ puts "ActuaL Dir #{Dir.pwd}"
18
+ puts "inspec_name = #{inspec_name}"
19
+ puts "input_file = #{input_file}"
20
+ puts "waiver_file = #{waiver_file}"
11
21
  system("inspec check compliance/profiles/#{inspec_name}")
12
- system("inspec exec compliance/profiles/#{inspec_name}")
22
+ cmd_opt = []
23
+
24
+ unless input_file.nil?
25
+ cmd_opt << '--input-file'
26
+ cmd_opt << input_file
27
+ end
28
+
29
+ unless waiver_file.nil?
30
+ cmd_opt << '--waiver-file'
31
+ cmd_opt << waiver_file
32
+ end
33
+ system("inspec exec compliance/profiles/#{inspec_name} #{cmd_opt.join(' ')}")
13
34
  end
14
35
 
15
36
  def update
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # DeployRubygem - deploy a gem using rake
4
+ # Containing a class
5
+ module DeployRubygem
6
+ # Using Kitchen to deploy and manage Kitchen
7
+ class Kitchen
8
+ attr_reader :kitchen_name, :cookbook
9
+
10
+ def initialize(kitchen_name, cookbook)
11
+ @kitchen_name = kitchen_name
12
+ @cookbook = cookbook
13
+ end
14
+
15
+ def check_file
16
+ ::File.join("#{kitchen_name}_check.log")
17
+ end
18
+
19
+ def converge
20
+ system("kitchen converge #{kitchen_name}")
21
+ end
22
+
23
+ def destroy
24
+ system("kitchen destroy #{kitchen_name}")
25
+ end
26
+
27
+ def ip
28
+ switch_to_cookbook
29
+ system("kitchen exec #{kitchen_name} -c 'hostname -I'")
30
+ end
31
+
32
+ def verify(showing: true)
33
+ cookbook.switch_to_cookbook
34
+ if showing
35
+ system("kitchen verify #{kitchen_name}")
36
+ else
37
+ system("kitchen verify #{kitchen_name} > #{check_file}")
38
+ end
39
+ end
40
+
41
+ def target
42
+ verify(showing: false)
43
+ system("grep -n Target #{check_file}")
44
+ end
45
+ end
46
+ end