deploy_rubygem 0.4.1 → 0.5.1
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/bin/deploy_jimbo_management_site_website +8 -0
- data/bin/deploy_rubygem +6 -20
- data/bin/prepare_workstation +0 -4
- data/deploy_rubygem.gemspec +2 -0
- data/lib/deploy_rubygem/chef_supermarket.rb +7 -0
- data/lib/deploy_rubygem/cookbook.rb +116 -0
- data/lib/deploy_rubygem/inspec.rb +34 -0
- data/lib/deploy_rubygem/rubygem.rb +39 -0
- data/lib/deploy_rubygem.rb +28 -2
- data.tar.gz.sig +0 -0
- metadata +21 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d1273d42eb686f7cdeeb309035ca0d629403d38fa4e7a8e340df2f51d76ff8
|
4
|
+
data.tar.gz: cada978b8538b0b13cc9181e351df7b295b1ec905881fc5d1c18757153a884c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48a7136d42231df13f15424fcf0879765a04303fc4b3d8973779e59e2843c5ea14ccd59e0a8c59ede2908ccbf753ad1dd707eac00082c3b36cffee931be26590
|
7
|
+
data.tar.gz: 5182acf36da916d2288d5222b4e39324d51c2c2646bc78ffa85ed8287cb98a7b86a0b55efcbc3cf46dbc5570fb072a978e3c71ece5fb1dad501b5df83d7db782
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/deploy_rubygem
CHANGED
@@ -1,23 +1,9 @@
|
|
1
1
|
#!/opt/chef-workstation/embedded/bin/ruby
|
2
|
+
Signal.trap('INT') { exit 1 }
|
2
3
|
|
3
|
-
%w(
|
4
|
-
|
5
|
-
|
6
|
-
).each do |executable|
|
7
|
-
system("git add bin/#{executable}")
|
8
|
-
end
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w(.. lib))
|
5
|
+
require 'rubygems' unless defined?(Gem)
|
6
|
+
require 'deploy_rubygem'
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
system('git add lib')
|
14
|
-
|
15
|
-
system('git commit -m "Deploying deploy_rugygem_$(git version-bump show)"')
|
16
|
-
|
17
|
-
system('git version-bump patch') # <major|minor|patch|show>
|
18
|
-
|
19
|
-
system('gem build')
|
20
|
-
|
21
|
-
system('gem push deploy_rubygem-$(git version-bump show).gem')
|
22
|
-
|
23
|
-
system('git version-bump minor') # <major|minor|patch|show>
|
8
|
+
DeployRubygem.self_deploy
|
9
|
+
DeployRubygem.deploy_jimbo_management_site
|
data/bin/prepare_workstation
CHANGED
data/deploy_rubygem.gemspec
CHANGED
@@ -51,6 +51,8 @@ require 'git-version-bump'
|
|
51
51
|
|
52
52
|
s.add_runtime_dependency('git-version-bump')
|
53
53
|
|
54
|
+
s.add_runtime_dependency('deploy-context')
|
55
|
+
|
54
56
|
# s.add_runtime_dependency('colorator', '~> 1.0')
|
55
57
|
# s.add_runtime_dependency('em-websocket', '~> 0.5')
|
56
58
|
# s.add_runtime_dependency('i18n', '~> 1.0')
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
require 'deploy_rubygem/inspec'
|
3
|
+
|
4
|
+
module DeployRubygem
|
5
|
+
class Cookbook
|
6
|
+
attr_reader :cookbook_name
|
7
|
+
attr_reader :cookbook_info
|
8
|
+
|
9
|
+
def initialize(new_cookbook_name, new_cookbook_info)
|
10
|
+
@cookbook_name = new_cookbook_name.to_s
|
11
|
+
@cookbook_info = new_cookbook_info
|
12
|
+
end
|
13
|
+
|
14
|
+
def chef_repo
|
15
|
+
cookbook_info[__method__]
|
16
|
+
end
|
17
|
+
|
18
|
+
def cookbook_path
|
19
|
+
::File.join(chef_repo, 'cookbooks', cookbook_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
def git
|
23
|
+
cookbook_info[__method__]
|
24
|
+
end
|
25
|
+
|
26
|
+
def check_file
|
27
|
+
::File.join("#{kitchen}_check.log")
|
28
|
+
end
|
29
|
+
|
30
|
+
def connect_cookbook
|
31
|
+
system("git submodule add #{git}")
|
32
|
+
system("git submodule init cookbooks/#{cookbook_name}")
|
33
|
+
system("git submodule sync cookbooks/#{cookbook_name}")
|
34
|
+
system("git submodule foreach --recursive 'pwd && git pull'")
|
35
|
+
end
|
36
|
+
|
37
|
+
def switch_to_cookbook
|
38
|
+
Dir.chdir(chef_repo)
|
39
|
+
connect_cookbook
|
40
|
+
Dir.chdir(cookbook_path)
|
41
|
+
end
|
42
|
+
|
43
|
+
def kitchen
|
44
|
+
cookbook_info[:kitchens].first
|
45
|
+
end
|
46
|
+
|
47
|
+
def profile
|
48
|
+
cookbook_info[:profiles].first
|
49
|
+
end
|
50
|
+
|
51
|
+
def kitchen_ip
|
52
|
+
switch_to_cookbook
|
53
|
+
system("kitchen exec #{kitchen} -c 'hostname -I'")
|
54
|
+
end
|
55
|
+
|
56
|
+
def kitchen_verify(showing = true)
|
57
|
+
switch_to_cookbook
|
58
|
+
if showing
|
59
|
+
system("kitchen verify #{kitchen}")
|
60
|
+
else
|
61
|
+
system("kitchen verify #{kitchen} > #{check_file}")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def kitchen_target
|
66
|
+
kitchen_verify(false)
|
67
|
+
system("grep -n Target #{check_file}")
|
68
|
+
end
|
69
|
+
|
70
|
+
def upload_cookbook
|
71
|
+
system('git pull')
|
72
|
+
|
73
|
+
system("knife cookbook upload --cookbook-path '../' #{cookbook_name}")
|
74
|
+
|
75
|
+
system("chef install Policyfile.rb")
|
76
|
+
system("chef push jimbodragon_website_prod Policyfile.lock.json")
|
77
|
+
end
|
78
|
+
|
79
|
+
def prepare_test_environment
|
80
|
+
system("kitchen converge #{kitchen}")
|
81
|
+
end
|
82
|
+
|
83
|
+
def destroy_test_environment
|
84
|
+
system("kitchen destroy #{kitchen}")
|
85
|
+
end
|
86
|
+
|
87
|
+
def deploy
|
88
|
+
save_progress
|
89
|
+
switch_to_cookbook
|
90
|
+
save_progress
|
91
|
+
upload_cookbook
|
92
|
+
prepare_test_environment
|
93
|
+
verify
|
94
|
+
save_progress
|
95
|
+
end
|
96
|
+
|
97
|
+
def verify
|
98
|
+
puts "Verify cookbook #{cookbook_name} on target #{kitchen_target}"
|
99
|
+
|
100
|
+
kitchen_verify
|
101
|
+
|
102
|
+
cookbook_info[:profiles].each do |profile|
|
103
|
+
system("inspec vendor compliance/profiles/#{profile}")
|
104
|
+
system("inspec exec compliance/profiles/#{profile}")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def save_progress
|
109
|
+
system('git add .')
|
110
|
+
system("git commit -m \"Saving: hostname=#{ENV['HOSTNAME']}\"")
|
111
|
+
system("git push")
|
112
|
+
end
|
113
|
+
|
114
|
+
# system('sudo chef-client --override-runlist jimbo_management_site')
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
module DeployRubygem
|
3
|
+
class Inspec
|
4
|
+
attr_reader :project_options
|
5
|
+
|
6
|
+
def initialize(new_project_options)
|
7
|
+
@project_options = new_project_options
|
8
|
+
end
|
9
|
+
|
10
|
+
def deploy
|
11
|
+
%w(
|
12
|
+
deploy_rubygem
|
13
|
+
prepare_workstation
|
14
|
+
).each do |executable|
|
15
|
+
system("git add bin/#{executable}")
|
16
|
+
end
|
17
|
+
|
18
|
+
system('git add deploy_rubygem.gemspec')
|
19
|
+
system('git add .circleci/config.yml')
|
20
|
+
|
21
|
+
system('git add lib')
|
22
|
+
|
23
|
+
system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
|
24
|
+
|
25
|
+
system('git version-bump patch') # <major|minor|patch|show>
|
26
|
+
|
27
|
+
system('gem build')
|
28
|
+
|
29
|
+
system('gem push deploy_rubygem-$(git version-bump show).gem')
|
30
|
+
|
31
|
+
system('git version-bump minor') # <major|minor|patch|show>
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
module DeployRubygem
|
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 deploy
|
19
|
+
binaries.each do |executable|
|
20
|
+
system("git add bin/#{executable}")
|
21
|
+
end
|
22
|
+
|
23
|
+
system('git add deploy_rubygem.gemspec')
|
24
|
+
system('git add .circleci/config.yml')
|
25
|
+
|
26
|
+
system('git add lib')
|
27
|
+
|
28
|
+
system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
|
29
|
+
|
30
|
+
system('git version-bump patch') # <major|minor|patch|show>
|
31
|
+
|
32
|
+
system('gem build')
|
33
|
+
|
34
|
+
system('gem push deploy_rubygem-$(git version-bump show).gem')
|
35
|
+
|
36
|
+
system('git version-bump minor') # <major|minor|patch|show>
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/deploy_rubygem.rb
CHANGED
@@ -1,8 +1,34 @@
|
|
1
1
|
|
2
2
|
require 'git-version-bump'
|
3
|
+
require 'deploy_rubygem/rubygem'
|
4
|
+
require 'deploy_rubygem/cookbook'
|
3
5
|
|
4
6
|
module DeployRubygem
|
5
|
-
def
|
6
|
-
|
7
|
+
def self.self_project_options
|
8
|
+
{
|
9
|
+
project_name: 'deploy_rubygem',
|
10
|
+
binaries: %w(
|
11
|
+
deploy_rubygem
|
12
|
+
prepare_workstation
|
13
|
+
),
|
14
|
+
cookbooks: {
|
15
|
+
jimbo_management_site: {
|
16
|
+
chef_repo: '/usr/local/chef/repo/jimbodragon',
|
17
|
+
git: 'git@github.com:JimboDragonGit/jimbo_management_site.git',
|
18
|
+
kitchens: %w(base),
|
19
|
+
profiles: %w(base)
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.self_deploy
|
26
|
+
Rubygem.new(self_project_options).deploy
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.deploy_jimbo_management_site
|
30
|
+
self_project_options[:cookbooks].each do |cookbook_name, cookbook_options|
|
31
|
+
Cookbook.new(cookbook_name, cookbook_options).deploy
|
32
|
+
end
|
7
33
|
end
|
8
34
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploy_rubygem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Provencher
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
n6Pwa3EckU/5n8N6gUJTAmGyu6Ncu1pbsZtH450+BJ2z82JNXomdFYlnG8+1XNlj
|
34
34
|
3M1sBFUHvqrBg2hQkQcLHokmQYrYsRK5A7HrxwKcmwM=
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date: 2024-05-
|
36
|
+
date: 2024-05-21 00:00:00.000000000 Z
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: chef
|
@@ -77,6 +77,20 @@ dependencies:
|
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: deploy-context
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :runtime
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
80
94
|
description: Using Chef cookbook style and force any script using it to switch to
|
81
95
|
chef even if it is not install. It will install it tho ;)
|
82
96
|
email:
|
@@ -95,10 +109,15 @@ files:
|
|
95
109
|
- Gemfile
|
96
110
|
- LICENSE
|
97
111
|
- README.md
|
112
|
+
- bin/deploy_jimbo_management_site_website
|
98
113
|
- bin/deploy_rubygem
|
99
114
|
- bin/prepare_workstation
|
100
115
|
- deploy_rubygem.gemspec
|
101
116
|
- lib/deploy_rubygem.rb
|
117
|
+
- lib/deploy_rubygem/chef_supermarket.rb
|
118
|
+
- lib/deploy_rubygem/cookbook.rb
|
119
|
+
- lib/deploy_rubygem/inspec.rb
|
120
|
+
- lib/deploy_rubygem/rubygem.rb
|
102
121
|
homepage: https://github.com/JimboDragonGit/deploy_rubygem
|
103
122
|
licenses:
|
104
123
|
- MIT
|
metadata.gz.sig
CHANGED
Binary file
|