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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3388802794154c834921961f66099f3aa8f0e70ed436f4906fc7b8a101f3cb72
|
4
|
+
data.tar.gz: 024aba991f3b84dfff859855229c8851f8ff0eb1f5fefa6ca72c42090cd4ce8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/.kitchen/logs/kitchen.log
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
I, [2024-05-
|
2
|
-
E, [2024-05-
|
3
|
-
E, [2024-05-
|
4
|
-
E, [2024-05-
|
5
|
-
E, [2024-05-
|
6
|
-
E, [2024-05-
|
7
|
-
E, [2024-05-
|
8
|
-
E, [2024-05-
|
9
|
-
E, [2024-05-
|
10
|
-
E, [2024-05-
|
11
|
-
E, [2024-05-
|
12
|
-
E, [2024-05-
|
13
|
-
E, [2024-05-
|
14
|
-
E, [2024-05-
|
15
|
-
E, [2024-05-
|
16
|
-
E, [2024-05-
|
17
|
-
E, [2024-05-
|
18
|
-
E, [2024-05-
|
19
|
-
E, [2024-05-
|
20
|
-
E, [2024-05-
|
21
|
-
E, [2024-05-
|
22
|
-
E, [2024-05-
|
23
|
-
E, [2024-05-
|
24
|
-
E, [2024-05-
|
25
|
-
E, [2024-05-
|
26
|
-
E, [2024-05-
|
27
|
-
E, [2024-05-
|
28
|
-
E, [2024-05-
|
29
|
-
E, [2024-05-
|
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
|
+
TargetRubyVersion: 3.0
|
3
3
|
|
4
4
|
Style/StringLiterals:
|
5
|
-
Enabled:
|
6
|
-
EnforcedStyle:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: single_quotes
|
7
7
|
|
8
8
|
Style/StringLiteralsInInterpolation:
|
9
|
-
Enabled:
|
10
|
-
EnforcedStyle:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: single_quotes
|
11
11
|
|
12
12
|
Layout/LineLength:
|
13
|
-
Enabled:
|
14
|
-
Max:
|
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
|
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
|
8
|
+
# gem 'git-version-bump', '0.19.1'
|
9
9
|
|
10
|
-
gem
|
11
|
-
|
12
|
-
gem
|
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
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'rubocop/rake_task'
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
12
|
-
|
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
|
5
|
-
require
|
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
|
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
|
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.
|
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
|
data/bin/deploy_jimbodragon
CHANGED
@@ -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
|
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
|
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.
|
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
|
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
|
data/bin/prepare_workstation
CHANGED
data/bin/test_deploy_rubygem
CHANGED
data/deploy_rubygem.gemspec
CHANGED
@@ -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.
|
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
|
-
|
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'
|
43
|
-
'homepage_uri'
|
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
|
45
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
48
46
|
|
49
|
-
|
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,22 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
require 'deploy_rubygem/
|
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
|
-
|
6
|
-
|
7
|
-
attr_reader :
|
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
|
10
|
-
|
11
|
-
@cookbook_info = new_cookbook_info
|
26
|
+
def cookbook_name
|
27
|
+
project_name
|
12
28
|
end
|
13
29
|
|
14
|
-
def
|
15
|
-
|
30
|
+
def cookbook_info
|
31
|
+
project_options
|
16
32
|
end
|
17
33
|
|
18
34
|
def cookbook_path
|
19
|
-
::File.join(
|
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
|
-
|
54
|
+
change_to_chefrepo
|
43
55
|
connect_cookbook
|
44
|
-
|
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(
|
78
|
-
# system(
|
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(
|
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
|
-
|
91
|
-
|
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
|
-
|
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
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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(
|
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
|