puppet-armature 0.4.1 → 0.5.0
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 +5 -5
- data/Gemfile.lock +4 -2
- data/README.md +4 -0
- data/bin/armature +23 -0
- data/docs/puppetfile-syntax.md +10 -5
- data/lib/armature/environments.rb +3 -38
- data/lib/armature/puppetfile.rb +43 -0
- data/lib/armature/run.rb +8 -0
- data/lib/armature/version.rb +1 -1
- data/puppet-armature.gemspec +2 -2
- data/test/{deploy_test.rb → environment_deploy_test.rb} +19 -23
- data/test/helpers.rb +12 -5
- data/test/puppetfile_deploy_test.rb +83 -0
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 36a266d3305f422219a9eaf907a09dabf8f20ec1a873d4d83287dc5803b689da
|
4
|
+
data.tar.gz: d2a08d0fd13a15eafccd593b008e85a0fab4836b5dce1e029054880a8413d5a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a11fbaa894fe37e062238a0e5ca3d8f249e621163c638aabde40f7bf50afc79cc0c31cdd256e42b8eea42d235f3913f3131f2edd0738cb840cf3fa4c8745ca
|
7
|
+
data.tar.gz: 9b065e837cb6cdd6330a634be60793b08a7d6b30ef17ad4ed075e06097d414be4abc143b7ea50e8b081ca8b5c58226f32d8cddd6f8667e8d6f7137dc9ef08bf4
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
puppet-armature (0.
|
4
|
+
puppet-armature (0.5.0)
|
5
5
|
gli (= 2.14.0)
|
6
6
|
logging (~> 2)
|
7
7
|
|
@@ -15,6 +15,7 @@ GEM
|
|
15
15
|
multi_json (~> 1.10)
|
16
16
|
minitest (5.10.1)
|
17
17
|
multi_json (1.13.1)
|
18
|
+
rake (12.3.2)
|
18
19
|
|
19
20
|
PLATFORMS
|
20
21
|
ruby
|
@@ -23,6 +24,7 @@ PLATFORMS
|
|
23
24
|
DEPENDENCIES
|
24
25
|
minitest (~> 5.9)
|
25
26
|
puppet-armature!
|
27
|
+
rake
|
26
28
|
|
27
29
|
BUNDLED WITH
|
28
|
-
1.17.
|
30
|
+
1.17.2
|
data/README.md
CHANGED
@@ -38,6 +38,10 @@ options, or `armature help <command>` to learn about a specific command.
|
|
38
38
|
|
39
39
|
Deploys branches from a git repository as environments.
|
40
40
|
|
41
|
+
### `armature deploy-puppetfile`
|
42
|
+
|
43
|
+
Deploys the Puppetfile in the current directory into `./modules`.
|
44
|
+
|
41
45
|
### `armature update`
|
42
46
|
|
43
47
|
Updates all branches in the cache. This will update all environments to their
|
data/bin/armature
CHANGED
@@ -110,6 +110,29 @@ command "deploy-branches" do |c|
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
desc 'Deploy ./Puppetfile into ./modules'
|
114
|
+
long_desc 'By default this deploys the Puppetfile in the current directory into
|
115
|
+
./modules.
|
116
|
+
|
117
|
+
You may specify another directory to use instead of the current directory.
|
118
|
+
It\'s equivalent to cding into the other directory and then running
|
119
|
+
`armature deploy-puppetfile`.'
|
120
|
+
arg 'SOURCE-DIRECTORY', :optional
|
121
|
+
command "deploy-puppetfile" do |c|
|
122
|
+
c.action do |global_options, options, arguments|
|
123
|
+
@cache.lock File::LOCK_SH do
|
124
|
+
puppetfile = Armature::Puppetfile.new(@cache)
|
125
|
+
|
126
|
+
source_directory = arguments[0] || "."
|
127
|
+
if ! puppetfile.load_control_directory(source_directory)
|
128
|
+
abort() # A warning is displayed in load_control_directory()
|
129
|
+
end
|
130
|
+
|
131
|
+
puppetfile.update_modules(source_directory)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
113
136
|
desc 'Remove unused objects from cache'
|
114
137
|
command :gc do |c|
|
115
138
|
c.action { @cache.garbage_collect(@environments_path) }
|
data/docs/puppetfile-syntax.md
CHANGED
@@ -2,11 +2,6 @@
|
|
2
2
|
|
3
3
|
The Puppetfile is just ruby. There are a few important declarations:
|
4
4
|
|
5
|
-
### `forge 'https://forge.puppet.com'`
|
6
|
-
|
7
|
-
This specifies what “forge” to use. You don't need to specify this unless you
|
8
|
-
have a caching proxy, or your own Forge-like web site.
|
9
|
-
|
10
5
|
### `mod 'owner-name', 'version'`
|
11
6
|
|
12
7
|
Install a module from the Forge. This will use whatever “forge” was last set
|
@@ -39,6 +34,16 @@ one, it will default to the master branch.
|
|
39
34
|
You can also use `:ref` to specify any of the above, or another type of git
|
40
35
|
ref. Using this will cause armature to check for updates on every deploy.
|
41
36
|
|
37
|
+
### `forge 'https://forge.puppet.com'`
|
38
|
+
|
39
|
+
This specifies what “forge” to use. You don't need to specify this unless you
|
40
|
+
have a caching proxy, or your own Forge-like web site.
|
41
|
+
|
42
|
+
### `moduledir 'modules'`
|
43
|
+
|
44
|
+
What directory should the modules go in? You should almost never need to
|
45
|
+
specify this.
|
46
|
+
|
42
47
|
## Example
|
43
48
|
|
44
49
|
~~~ ruby
|
@@ -82,18 +82,9 @@ module Armature
|
|
82
82
|
return
|
83
83
|
end
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
module_refs = Armature::Puppetfile.new(@cache).include(puppetfile_path)
|
89
|
-
@logger.debug "Loaded Puppetfile in environment '#{name}' with" \
|
90
|
-
" #{module_refs.length} modules"
|
91
|
-
else
|
92
|
-
@logger.debug "No Puppetfile in environment '#{name}'"
|
93
|
-
module_refs = {}
|
94
|
-
end
|
95
|
-
|
96
|
-
update_modules(ref_path, module_refs)
|
85
|
+
puppetfile = Armature::Puppetfile.new(@cache)
|
86
|
+
puppetfile.load_control_directory(ref_path)
|
87
|
+
puppetfile.update_modules(ref_path)
|
97
88
|
|
98
89
|
# Make the change live
|
99
90
|
@cache.atomic_symlink(ref_path, "#{@path}/#{name}")
|
@@ -101,31 +92,5 @@ module Armature
|
|
101
92
|
" environment '#{name}'"
|
102
93
|
end
|
103
94
|
end
|
104
|
-
|
105
|
-
private
|
106
|
-
|
107
|
-
# Apply the results of the Puppetfile to a ref (e.g. an environment)
|
108
|
-
#
|
109
|
-
### FIXME This could update modules in an existing check out.
|
110
|
-
def update_modules(target_path, module_refs)
|
111
|
-
modules_path = "#{target_path}/modules"
|
112
|
-
if ! Dir.exist? modules_path
|
113
|
-
Dir.mkdir(modules_path)
|
114
|
-
end
|
115
|
-
|
116
|
-
module_refs.each do |name, info|
|
117
|
-
self.class.assert_valid_module_name(name)
|
118
|
-
|
119
|
-
ref_path = info[:ref].check_out()
|
120
|
-
@cache.atomic_symlink(ref_path, "#{modules_path}/#{name}")
|
121
|
-
end
|
122
|
-
|
123
|
-
Dir.foreach(modules_path) do |name|
|
124
|
-
if ! module_refs.has_key? name and name != "." and name != ".."
|
125
|
-
# All paths should be symlinks.
|
126
|
-
File.delete("#{modules_path}/#{name}")
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
95
|
end
|
131
96
|
end
|
data/lib/armature/puppetfile.rb
CHANGED
@@ -7,6 +7,21 @@ module Armature
|
|
7
7
|
@results = {}
|
8
8
|
@logger = Logging.logger[self]
|
9
9
|
@forge_url = "https://forge.puppet.com"
|
10
|
+
@moduledir = 'modules'
|
11
|
+
end
|
12
|
+
|
13
|
+
def load_control_directory(control_directory)
|
14
|
+
puppetfile_path = "#{control_directory}/Puppetfile"
|
15
|
+
if File.exist?(puppetfile_path)
|
16
|
+
@logger.debug "Found #{puppetfile_path}"
|
17
|
+
include(puppetfile_path)
|
18
|
+
@logger.debug "Loaded #{puppetfile_path}: #{@results.length} modules"
|
19
|
+
return true
|
20
|
+
else
|
21
|
+
@logger.warn "#{puppetfile_path} does not exist"
|
22
|
+
@results = {}
|
23
|
+
return false
|
24
|
+
end
|
10
25
|
end
|
11
26
|
|
12
27
|
### FIXME this will have access to @cache and @results
|
@@ -15,10 +30,38 @@ module Armature
|
|
15
30
|
@results
|
16
31
|
end
|
17
32
|
|
33
|
+
# Apply the results of the Puppetfile to a ref (e.g. an environment)
|
34
|
+
#
|
35
|
+
### FIXME This could update modules in an existing check out.
|
36
|
+
def update_modules(target_path, module_refs=@results)
|
37
|
+
modules_path = "#{target_path}/#{@moduledir}"
|
38
|
+
if ! Dir.exist? modules_path
|
39
|
+
Dir.mkdir(modules_path)
|
40
|
+
end
|
41
|
+
|
42
|
+
module_refs.each do |name, info|
|
43
|
+
Armature::Environments.assert_valid_module_name(name)
|
44
|
+
|
45
|
+
ref_path = info[:ref].check_out()
|
46
|
+
@cache.atomic_symlink(ref_path, "#{modules_path}/#{name}")
|
47
|
+
end
|
48
|
+
|
49
|
+
Dir.foreach(modules_path) do |name|
|
50
|
+
if ! module_refs.has_key? name and name != "." and name != ".."
|
51
|
+
# All paths should be symlinks.
|
52
|
+
File.delete("#{modules_path}/#{name}")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
18
57
|
def forge(url)
|
19
58
|
@forge_url = url.chomp("/")
|
20
59
|
end
|
21
60
|
|
61
|
+
def moduledir(path)
|
62
|
+
@moduledir = path
|
63
|
+
end
|
64
|
+
|
22
65
|
def mod(full_name, options={})
|
23
66
|
name = full_name.split("-", 2).last()
|
24
67
|
Armature::Environments.assert_valid_module_name(name)
|
data/lib/armature/run.rb
CHANGED
@@ -48,6 +48,14 @@ module Armature::Run
|
|
48
48
|
logger.debug("Run with input: " + command_to_string(cmd))
|
49
49
|
end
|
50
50
|
|
51
|
+
# The default doesn't really do anything; it's just there for a little
|
52
|
+
# clarity. If we're passed an environment, it will be a Hash. Otherwise,
|
53
|
+
# `environment` captured the first value in cmd.
|
54
|
+
if ! environment.kind_of?(Hash)
|
55
|
+
cmd.unshift(environment)
|
56
|
+
environment = {}
|
57
|
+
end
|
58
|
+
|
51
59
|
start_time = Time.now
|
52
60
|
output, status = nil, nil
|
53
61
|
Open3.popen2e(environment, *cmd) do |pipe_in, pipe_out, promise|
|
data/lib/armature/version.rb
CHANGED
data/puppet-armature.gemspec
CHANGED
@@ -16,13 +16,13 @@ spec = Gem::Specification.new do |s|
|
|
16
16
|
It is designed as a much faster replacement for r10k, though it does not
|
17
17
|
have all of r10k's features.
|
18
18
|
EOF
|
19
|
-
s.files = `git ls-files`.split("\n")
|
19
|
+
s.files = `git ls-files`.split("\n") - [".gitignore"]
|
20
20
|
s.require_paths << 'lib'
|
21
|
-
s.has_rdoc = false
|
22
21
|
s.bindir = 'bin'
|
23
22
|
s.executables << 'armature'
|
24
23
|
s.required_ruby_version = '>= 2.0.0'
|
25
24
|
s.add_runtime_dependency('gli','2.14.0')
|
26
25
|
s.add_runtime_dependency('logging','~> 2')
|
27
26
|
s.add_development_dependency('minitest','~> 5.9')
|
27
|
+
s.add_development_dependency('rake','<999')
|
28
28
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'helpers'
|
3
3
|
|
4
|
-
class
|
4
|
+
class EnvironmentDeployTest < Minitest::Test
|
5
5
|
include ArmatureTestHelpers
|
6
6
|
|
7
7
|
def test_deploy_just_master_branch
|
8
|
-
|
8
|
+
with_environment_context do
|
9
9
|
repo = Armature::Repo::Git::from_url(@cache, repo_path("control"))
|
10
10
|
branches = Set.new(repo.get_branches())
|
11
11
|
|
@@ -27,7 +27,7 @@ class DeployTest < Minitest::Test
|
|
27
27
|
|
28
28
|
### FIXME: should this generate an error?
|
29
29
|
def test_deploy_nonexistant_branch
|
30
|
-
|
30
|
+
with_environment_context do
|
31
31
|
repo = Armature::Repo::Git::from_url(@cache, repo_path("control"))
|
32
32
|
branches = Set.new(repo.get_branches())
|
33
33
|
|
@@ -42,7 +42,7 @@ class DeployTest < Minitest::Test
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_deploy_all_branches
|
45
|
-
|
45
|
+
with_environment_context do
|
46
46
|
repo = Armature::Repo::Git::from_url(@cache, repo_path("control"))
|
47
47
|
branches = Set.new(repo.get_branches())
|
48
48
|
|
@@ -66,7 +66,7 @@ class DeployTest < Minitest::Test
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_deploy_one_module
|
69
|
-
|
69
|
+
with_environment_context do
|
70
70
|
repo = Armature::Repo::Git::from_url(@cache, repo_path("control"))
|
71
71
|
@environments.check_out_ref(repo, "master")
|
72
72
|
|
@@ -78,7 +78,7 @@ class DeployTest < Minitest::Test
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def test_adding_module_and_redeploying
|
81
|
-
|
81
|
+
with_environment_context do
|
82
82
|
repo = Armature::Repo::Git::from_url(@cache, repo_path("control"))
|
83
83
|
@environments.check_out_ref(repo, "master")
|
84
84
|
|
@@ -108,7 +108,7 @@ class DeployTest < Minitest::Test
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def test_removing_module_and_redeploying
|
111
|
-
|
111
|
+
with_environment_context do
|
112
112
|
repo = Armature::Repo::Git::from_url(@cache, repo_path("control"))
|
113
113
|
@environments.check_out_ref(repo, "master")
|
114
114
|
|
@@ -128,7 +128,7 @@ class DeployTest < Minitest::Test
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def test_module_with_bad_ref
|
131
|
-
|
131
|
+
with_environment_context do
|
132
132
|
repo_commit("control", "Set module-1 to bad ref") do
|
133
133
|
File.write("Puppetfile", <<-PUPPETFILE)
|
134
134
|
forge "https://forge.puppet.com"
|
@@ -152,7 +152,7 @@ class DeployTest < Minitest::Test
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def test_redeploying_module_with_bad_ref
|
155
|
-
|
155
|
+
with_environment_context do
|
156
156
|
repo = Armature::Repo::Git::from_url(@cache, repo_path("control"))
|
157
157
|
@environments.check_out_ref(repo, "master")
|
158
158
|
|
@@ -169,18 +169,14 @@ class DeployTest < Minitest::Test
|
|
169
169
|
@environments.check_out_ref(repo, "master")
|
170
170
|
end
|
171
171
|
|
172
|
-
### FIXME state of repo after an error is undefined
|
173
172
|
### What happens if other modules already exist?
|
174
|
-
|
175
|
-
|
176
|
-
[".", "..", "module1"].sort(),
|
177
|
-
Dir.entries(@environments.path + "/master/modules").sort(),
|
178
|
-
"Modules installed after test incorrect")
|
173
|
+
assert(! File.directory?(@environments.path + "/master/modules"),
|
174
|
+
"Incorrectly created modules directory")
|
179
175
|
end
|
180
176
|
end
|
181
177
|
|
182
178
|
def test_redeploying_module_with_ref_tag
|
183
|
-
|
179
|
+
with_environment_context do
|
184
180
|
set_up_interesting_module("interesting")
|
185
181
|
redeploy_module_with_ref_of_type("ref", "tag_one") do
|
186
182
|
assert_module_manifests("interesting", ["one.pp"],
|
@@ -190,7 +186,7 @@ class DeployTest < Minitest::Test
|
|
190
186
|
end
|
191
187
|
|
192
188
|
def test_redeploying_module_with_ref_branch
|
193
|
-
|
189
|
+
with_environment_context do
|
194
190
|
set_up_interesting_module("interesting")
|
195
191
|
redeploy_module_with_ref_of_type("ref", "branch_two") do
|
196
192
|
assert_module_manifests("interesting", ["one.pp", "two.pp", "two_a.pp"],
|
@@ -200,7 +196,7 @@ class DeployTest < Minitest::Test
|
|
200
196
|
end
|
201
197
|
|
202
198
|
def test_redeploying_module_with_ref_commit
|
203
|
-
|
199
|
+
with_environment_context do
|
204
200
|
set_up_interesting_module("interesting")
|
205
201
|
sha = repo_git("interesting", "rev-parse", "branch_two^").chomp
|
206
202
|
redeploy_module_with_ref_of_type("ref", sha) do
|
@@ -211,7 +207,7 @@ class DeployTest < Minitest::Test
|
|
211
207
|
end
|
212
208
|
|
213
209
|
def test_redeploying_module_with_tag
|
214
|
-
|
210
|
+
with_environment_context do
|
215
211
|
set_up_interesting_module("interesting")
|
216
212
|
redeploy_module_with_ref_of_type("tag", "tag_one") do
|
217
213
|
assert_module_manifests("interesting", ["one.pp"],
|
@@ -221,7 +217,7 @@ class DeployTest < Minitest::Test
|
|
221
217
|
end
|
222
218
|
|
223
219
|
def test_redeploying_module_with_branch
|
224
|
-
|
220
|
+
with_environment_context do
|
225
221
|
set_up_interesting_module("interesting")
|
226
222
|
redeploy_module_with_ref_of_type("branch", "branch_two") do
|
227
223
|
assert_module_manifests("interesting", ["one.pp", "two.pp", "two_a.pp"],
|
@@ -231,7 +227,7 @@ class DeployTest < Minitest::Test
|
|
231
227
|
end
|
232
228
|
|
233
229
|
def test_redeploying_module_with_commit
|
234
|
-
|
230
|
+
with_environment_context do
|
235
231
|
set_up_interesting_module("interesting")
|
236
232
|
sha = repo_git("interesting", "rev-parse", "branch_two^").chomp
|
237
233
|
redeploy_module_with_ref_of_type("commit", sha) do
|
@@ -242,7 +238,7 @@ class DeployTest < Minitest::Test
|
|
242
238
|
end
|
243
239
|
|
244
240
|
def test_redeploying_module_with_updated_branch
|
245
|
-
|
241
|
+
with_environment_context do
|
246
242
|
set_up_interesting_module("interesting")
|
247
243
|
redeploy_module_with_ref_of_type("ref", "branch_two") do
|
248
244
|
repo_git("interesting", "checkout", "branch_two")
|
@@ -259,7 +255,7 @@ class DeployTest < Minitest::Test
|
|
259
255
|
end
|
260
256
|
|
261
257
|
def test_updating_branches_on_module_with_updated_branch
|
262
|
-
|
258
|
+
with_environment_context do
|
263
259
|
set_up_interesting_module("interesting")
|
264
260
|
redeploy_module_with_ref_of_type("ref", "branch_two") do
|
265
261
|
repo_git("interesting", "checkout", "branch_two")
|
data/test/helpers.rb
CHANGED
@@ -84,11 +84,21 @@ module ArmatureTestHelpers
|
|
84
84
|
with_temp_dir("context") do
|
85
85
|
@cache = Armature::Cache.new("cache")
|
86
86
|
|
87
|
+
repo_init("module-1")
|
88
|
+
|
89
|
+
yield
|
90
|
+
end
|
91
|
+
ensure
|
92
|
+
# Ensure that code trying to use these after this point fails in a
|
93
|
+
# predictable way.
|
94
|
+
@cache = nil
|
95
|
+
end
|
96
|
+
|
97
|
+
def with_environment_context
|
98
|
+
with_context do
|
87
99
|
Dir.mkdir("environments")
|
88
100
|
@environments = Armature::Environments.new("environments", @cache)
|
89
101
|
|
90
|
-
repo_init("module-1")
|
91
|
-
|
92
102
|
repo_init("control") do
|
93
103
|
File.write("Puppetfile", <<-PUPPETFILE)
|
94
104
|
forge "https://forge.puppet.com"
|
@@ -100,9 +110,6 @@ module ArmatureTestHelpers
|
|
100
110
|
yield
|
101
111
|
end
|
102
112
|
ensure
|
103
|
-
# Ensure that code trying to use these after this point fails in a
|
104
|
-
# predictable way.
|
105
|
-
@cache = nil
|
106
113
|
@environments = nil
|
107
114
|
end
|
108
115
|
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'helpers'
|
3
|
+
|
4
|
+
class PuppetfileDeployTest < Minitest::Test
|
5
|
+
include ArmatureTestHelpers
|
6
|
+
|
7
|
+
def test_deploy_puppetfile
|
8
|
+
with_control do
|
9
|
+
@cache.lock File::LOCK_SH do
|
10
|
+
puppetfile = Armature::Puppetfile.new(@cache)
|
11
|
+
success = puppetfile.load_control_directory("control")
|
12
|
+
assert(success, "Failed to load control/Puppetfile")
|
13
|
+
|
14
|
+
puppetfile.update_modules("control")
|
15
|
+
end
|
16
|
+
|
17
|
+
assert(File.directory?("control/modules"),
|
18
|
+
"Failed to create control/modules")
|
19
|
+
assert_equal(
|
20
|
+
[".", "..", "module1"].sort(),
|
21
|
+
Dir.entries("control/modules").sort(),
|
22
|
+
"Installed modules incorrectly")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_deploy_nonexistent_puppetfile
|
27
|
+
with_context do
|
28
|
+
Dir.mkdir("control")
|
29
|
+
|
30
|
+
@cache.lock File::LOCK_SH do
|
31
|
+
puppetfile = Armature::Puppetfile.new(@cache)
|
32
|
+
success = puppetfile.load_control_directory("control")
|
33
|
+
assert(!success, "Loaded non-existent Puppetfile")
|
34
|
+
end
|
35
|
+
|
36
|
+
assert(! File.directory?("control/modules"),
|
37
|
+
"Incorrectly created control/modules")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_deploy_puppetfile_moduledir
|
42
|
+
with_control do
|
43
|
+
File.write("control/Puppetfile", <<-PUPPETFILE)
|
44
|
+
forge "https://forge.puppet.com"
|
45
|
+
moduledir "vendor"
|
46
|
+
|
47
|
+
mod "module1", :git=>"#{repo_path('module-1')}"
|
48
|
+
PUPPETFILE
|
49
|
+
|
50
|
+
@cache.lock File::LOCK_SH do
|
51
|
+
puppetfile = Armature::Puppetfile.new(@cache)
|
52
|
+
success = puppetfile.load_control_directory("control")
|
53
|
+
assert(success, "Failed to load control/Puppetfile")
|
54
|
+
|
55
|
+
puppetfile.update_modules("control")
|
56
|
+
end
|
57
|
+
|
58
|
+
assert(! File.directory?("control/modules"),
|
59
|
+
"Incorrectly created control/modules")
|
60
|
+
assert(File.directory?("control/vendor"),
|
61
|
+
"Failed to create control/vendor")
|
62
|
+
assert_equal(
|
63
|
+
[".", "..", "module1"].sort(),
|
64
|
+
Dir.entries("control/vendor").sort(),
|
65
|
+
"Installed modules incorrectly")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def with_control
|
72
|
+
with_context do
|
73
|
+
Dir.mkdir("control")
|
74
|
+
File.write("control/Puppetfile", <<-PUPPETFILE)
|
75
|
+
forge "https://forge.puppet.com"
|
76
|
+
|
77
|
+
mod "module1", :git=>"#{repo_path('module-1')}"
|
78
|
+
PUPPETFILE
|
79
|
+
|
80
|
+
yield
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-armature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Parks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "<"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '999'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "<"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '999'
|
55
69
|
description: |2
|
56
70
|
Armature sets up Puppet environments for each branch in your control repo,
|
57
71
|
then installs the modules specified in the Puppetfile for each environment.
|
@@ -88,8 +102,9 @@ files:
|
|
88
102
|
- lib/armature/util.rb
|
89
103
|
- lib/armature/version.rb
|
90
104
|
- puppet-armature.gemspec
|
91
|
-
- test/
|
105
|
+
- test/environment_deploy_test.rb
|
92
106
|
- test/helpers.rb
|
107
|
+
- test/puppetfile_deploy_test.rb
|
93
108
|
- test/puppetfile_test.rb
|
94
109
|
homepage: https://github.com/danielparks/armature
|
95
110
|
licenses:
|
@@ -111,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
126
|
- !ruby/object:Gem::Version
|
112
127
|
version: '0'
|
113
128
|
requirements: []
|
114
|
-
|
115
|
-
rubygems_version: 2.5.2.1
|
129
|
+
rubygems_version: 3.0.1
|
116
130
|
signing_key:
|
117
131
|
specification_version: 4
|
118
132
|
summary: Deploy Puppet environments and manage modules
|