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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89dac36bb63313b245e1fd9318e2151c9d1daf14969420aecea105731d7586d6
4
- data.tar.gz: 601179ed285dcc825d307f3d0774887dca8217b97b29396857dca1833c4e0763
3
+ metadata.gz: 3388802794154c834921961f66099f3aa8f0e70ed436f4906fc7b8a101f3cb72
4
+ data.tar.gz: 024aba991f3b84dfff859855229c8851f8ff0eb1f5fefa6ca72c42090cd4ce8f
5
5
  SHA512:
6
- metadata.gz: bce361fbc34229875e56f564b94b9847f8a3c4b88cf6c8aefd03288ce1dfa7164d4fbc819d5ae657b0e8efec5c6d7ba5c408045a9d98cf0e1bbc573342eb7d4f
7
- data.tar.gz: 34d49a7415768d6d03dd721e342ed9cf7e53f08fe0ab78c29a0e89c212c0607c167cb8a0d8d03af82ea0534c2994fe139de328d410056008937138dab2333400
6
+ metadata.gz: 5a752952cd5da1bccc92c1348c46792696698b69414bca2a92fea356ab6cb00eee413e38b49319ef17aa0d1970e34a0c0385fc3bbe186182963c5fe4a4492d38
7
+ data.tar.gz: 265d66f29d787b2790d5e29b1a845b389d9d98d836f3676a9490d24c168cf177fc038bfb04ab736ad866ecbb6243587c26cc54d394e5acea3c960558c9d52427
checksums.yaml.gz.sig CHANGED
Binary file
data/.circleci/config.yml CHANGED
@@ -73,6 +73,21 @@ jobs:
73
73
  - checkout
74
74
  - run: |
75
75
  ruby bin/deploy_rubygem
76
+ execute_rake:
77
+ docker:
78
+ - image: cimg/ruby:3.1.2
79
+ auth:
80
+ username: $DOCKERHUB_USER
81
+ password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
82
+
83
+ environment: {}
84
+ working_directory: /home/circleci/deploy_rubygem
85
+ steps:
86
+ - checkout
87
+ - run: |
88
+ gem install git-version-bump
89
+ bundle install
90
+ rake circleci
76
91
  #...
77
92
  workflows:
78
93
  version: 2
@@ -90,4 +105,8 @@ workflows:
90
105
  filters:
91
106
  branches:
92
107
  only: master
108
+ - execute_rake:
109
+ filters:
110
+ branches:
111
+ only: master
93
112
 
data/.gitignore CHANGED
@@ -55,4 +55,5 @@ build-iPhoneSimulator/
55
55
  # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
56
  # .rubocop-https?--*
57
57
  Gemfile.lock
58
- .rspec_status
58
+ .rspec_status
59
+ inspec.lock
@@ -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/.rubocop.yml CHANGED
@@ -1,93 +1,23 @@
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
-
data/Gemfile CHANGED
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in deploy_rubygem.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ # gem 'git-version-bump', '0.19.1'
9
9
 
10
- gem "rspec", "~> 3.0"
11
-
12
- gem "rubocop", "~> 1.21"
10
+ # gem 'rake', '~> 13.0'
11
+ # gem 'rspec', '~> 3.13.0'
12
+ # gem 'rspec-aupport', '~> 3.13.0'
13
+ # gem 'rubocop', '~> 1.21'
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
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- require "rubocop/rake_task"
8
+ require 'rubocop/rake_task'
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
12
- task default: %i[spec rubocop]
12
+ # require 'git-version-bump/rake-tasks'
13
+
14
+ # task default: %i[spec rubocop] + ['version:bump:minor']
15
+
16
+ task default: %i[rubocop spec]
17
+ task circleci: %i[rubocop install:local spec]
data/bin/console CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "bundler/setup"
5
- require "deploy_rubygem"
4
+ require 'bundler/setup'
5
+ require 'deploy_rubygem'
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
9
9
 
10
- require "irb"
10
+ require 'irb'
11
11
  IRB.start(__FILE__)
@@ -1,8 +1,11 @@
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.deploy_jimbo_management_site
8
+ DeployRubygem.new_deploy_rubygem.cookbooks.select do |cookbook|
9
+ puts "CHecking cookbook #{cookbook.cookbook_name}"
10
+ cookbook.cookbook_name.match 'jimbo_management_site'
11
+ end.first.deploy
@@ -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
@@ -0,0 +1,23 @@
1
+ #!/opt/chef-workstation/embedded/bin/ruby
2
+ Signal.trap('INT') { exit 1 }
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
5
+ require 'rubygems' unless defined?(Gem)
6
+ require 'json'
7
+ require 'deploy_rubygem'
8
+
9
+ def inspect_query(query)
10
+ puts "class = #{query.class}"
11
+ # puts "class = #{query}"
12
+ end
13
+
14
+ query = JSON.parse(`knife search node name:habitat_chef_client_builder --format json`)
15
+
16
+ puts query['results']
17
+ query['rows'].each do |client|
18
+ puts client['name']
19
+ `knife node delete #{client['name']} -y`
20
+ `knife client delete #{client['name']} -y`
21
+ end
22
+
23
+ `hab pkg build habitat/plan.sh`
@@ -0,0 +1,14 @@
1
+ #!/opt/chef-workstation/embedded/bin/ruby
2
+ Signal.trap('INT') { exit 1 }
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
5
+ require 'rubygems' unless defined?(Gem)
6
+ require 'deploy_rubygem'
7
+
8
+ profile_options = DeployRubygem::DeployRubygemOptions.new
9
+ jimbo_option = profile_options.jimbo_management_site_profile
10
+
11
+ inspec_profile = DeployRubygem::Inspec.new(jimbo_option[:profile], jimbo_option[:input])
12
+
13
+ inspec_profile.update
14
+ inspec_profile.apply
@@ -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.release
8
+ DeployRubygem.new_deploy_rubygem.release
@@ -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
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'git-version-bump'
4
4
 
@@ -11,7 +11,7 @@ require 'git-version-bump'
11
11
  s.summary = 'A auto chef bootstrapper and wrapper cookbook to deploy code and context'
12
12
  s.description = 'Using Chef cookbook style and force any script using it to switch to chef even if it is not install. It will install it tho ;)'
13
13
 
14
- s.version = GVB.version
14
+ s.version = "#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}"
15
15
  s.date = GVB.date
16
16
 
17
17
  # all_files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
@@ -22,16 +22,14 @@ require 'git-version-bump'
22
22
  # s.executables = %w(selfbootstrap)
23
23
  # s.bindir = 'exe'
24
24
 
25
-
26
- s.extra_rdoc_files = ["README.md"]
27
- s.files = `git ls-files`.split("\n")
28
- s.executables = %w(
25
+ s.files = `git ls-files`.split("\n")
26
+ s.executables = %w[
29
27
  deploy_rubygem
30
28
  prepare_workstation
31
29
  test_deploy_rubygem
32
30
  deploy_rubygem_manually
33
31
  deploy_jimbodragon
34
- )
32
+ ]
35
33
 
36
34
  # s.cert_chain = [File.expand_path('../jimbodragon/certs/public/jimbodragon.pem')]
37
35
  # s.signing_key = File.expand_path('../jimbodragon/certs/private/jimbodragon-gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
@@ -39,20 +37,22 @@ require 'git-version-bump'
39
37
  s.metadata = {
40
38
  # 'source_code_uri' => '/home/git/selfbootstrap.git/',
41
39
  'bug_tracker_uri' => 'https://github.com/JimboDragonGit/deploy_rubygem/issues',
42
- 'changelog_uri' => 'https://github.com/JimboDragonGit/deploy_rubygem/releases',
43
- 'homepage_uri' => s.homepage,
40
+ 'changelog_uri' => 'https://github.com/JimboDragonGit/deploy_rubygem/releases',
41
+ 'homepage_uri' => s.homepage
44
42
  }
45
43
 
46
44
  s.rdoc_options = ['--charset=UTF-8']
47
- s.extra_rdoc_files = %w(README.md LICENSE)
45
+ s.extra_rdoc_files = %w[README.md LICENSE]
48
46
 
49
- # s.required_ruby_version = '>= 3.1.2'
47
+ s.required_ruby_version = '>= 3.0'
50
48
  # s.required_rubygems_version = '>= 2.7.0'
51
49
 
52
- s.add_development_dependency('chef')
53
- s.add_development_dependency('test-kitchen')
50
+ # s.add_development_dependency('chef')
51
+ # s.add_development_dependency('test-kitchen')
54
52
 
55
53
  s.add_runtime_dependency('git-version-bump')
54
+ s.add_runtime_dependency('rspec', '~> 3.13.0')
55
+ s.add_runtime_dependency('rspec-support', '~> 3.13.0')
56
56
  s.add_runtime_dependency('rubocop-rake')
57
57
  s.add_runtime_dependency('rubocop-rspec')
58
58
 
@@ -73,5 +73,3 @@ require 'git-version-bump'
73
73
  # s.add_runtime_dependency('terminal-table', '>= 1.8', '< 4.0')
74
74
  # s.add_runtime_dependency('webrick', '~> 1.7')
75
75
  end
76
-
77
-
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,38 @@
1
+ # frozen_string_literal: true
1
2
 
2
- require 'deploy_rubygem/inspec'
3
+ require 'deploy_rubygem/project'
4
+ require 'deploy_rubygem/kitchen'
3
5
 
6
+ # DeployRubygem - deploy a gem using rake
7
+ # Containing a class
4
8
  module DeployRubygem
5
- class Cookbook
6
- attr_reader :cookbook_name
7
- attr_reader :cookbook_info
9
+ # Using Cookbook to deploy and manage cookbook
10
+ class Cookbook < Project
11
+ attr_reader :profiles, :kitchens, :execute_profiles
12
+
13
+ def initialize(new_cookbook_info)
14
+ super(new_cookbook_info)
15
+ @profiles = cookbook_info[:compliance_profiles].map do |profile_name|
16
+ Inspec.new(profile_name)
17
+ end
18
+ @kitchens = cookbook_info[:kitchens].map do |kitchen_name|
19
+ Kitchen.new(kitchen_name, self)
20
+ end
21
+ @execute_profiles = cookbook_info[:execute_profiles].map do |profile_name|
22
+ Inspec.new(profile_name)
23
+ end
24
+ end
8
25
 
9
- def initialize(new_cookbook_name, new_cookbook_info)
10
- @cookbook_name = new_cookbook_name.to_s
11
- @cookbook_info = new_cookbook_info
26
+ def cookbook_name
27
+ project_name
12
28
  end
13
29
 
14
- def chef_repo
15
- cookbook_info[__method__]
30
+ def cookbook_info
31
+ project_options
16
32
  end
17
33
 
18
34
  def cookbook_path
19
- ::File.join(chef_repo, 'cookbooks', cookbook_name)
35
+ ::File.join(chefrepo_path, 'cookbooks', cookbook_name.to_s)
20
36
  end
21
37
 
22
38
  def git
@@ -27,10 +43,6 @@ module DeployRubygem
27
43
  cookbook_info[__method__]
28
44
  end
29
45
 
30
- def check_file
31
- ::File.join("#{kitchen}_check.log")
32
- end
33
-
34
46
  def connect_cookbook
35
47
  system("git submodule add #{git}")
36
48
  system("git submodule init cookbooks/#{cookbook_name}")
@@ -39,47 +51,20 @@ module DeployRubygem
39
51
  end
40
52
 
41
53
  def switch_to_cookbook
42
- Dir.chdir(chef_repo)
54
+ change_to_chefrepo
43
55
  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}")
56
+ change_to_project_folder
72
57
  end
73
58
 
74
59
  def upload_cookbook
75
60
  system('git pull')
76
61
 
77
- system("chef clean-policy-cookbooks")
78
- # system("chef clean-policy-revisions")
79
-
62
+ system('chef clean-policy-cookbooks')
63
+ # system('chef clean-policy-revisions')
64
+
80
65
  system("knife cookbook upload --cookbook-path '../' #{cookbook_name}")
81
66
 
82
- system("chef install Policyfile.rb")
67
+ system('chef install Policyfile.rb')
83
68
 
84
69
  groups.each do |group|
85
70
  system("chef push #{group} Policyfile.lock.json")
@@ -87,15 +72,12 @@ module DeployRubygem
87
72
  end
88
73
 
89
74
  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}")
75
+ profiles.each(&:update)
76
+ kitchens.each(&:converge)
95
77
  end
96
78
 
97
79
  def destroy_test_environment
98
- system("kitchen destroy #{kitchen}")
80
+ kitchens.each(&:destroy)
99
81
  end
100
82
 
101
83
  def deploy
@@ -109,23 +91,23 @@ module DeployRubygem
109
91
  end
110
92
 
111
93
  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
94
+ kitchens.each do |kitchen|
95
+ puts "Verify cookbook #{cookbook_name} on target #{kitchen.target}"
96
+ kitchen.verify
97
+ end
98
+
99
+ execute_profiles.each do |inspec_profile|
100
+ inspec_profile.update
101
+ inspec_profile.apply
120
102
  end
121
103
  end
122
104
 
123
105
  def save_progress
124
106
  system('git add .')
125
107
  system("git commit -m \"Saving: hostname=#{ENV['HOSTNAME']}, cookbook_name=#{cookbook_name}\"")
126
- system("git push")
108
+ system('git push')
127
109
  end
128
-
110
+
129
111
  # system('sudo chef-client --override-runlist jimbo_management_site')
130
112
  end
131
113
  end