r10k 1.2.4 → 1.3.0rc1
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 +8 -8
- data/{CHANGELOG → CHANGELOG.mkd} +51 -41
- data/doc/dynamic-environments/configuration.mkd +1 -1
- data/doc/dynamic-environments/git-environments.markdown +19 -0
- data/doc/dynamic-environments/usage.mkd +6 -0
- data/lib/r10k/cli/deploy.rb +15 -0
- data/lib/r10k/cli/ext/logging.rb +0 -1
- data/lib/r10k/cli/module/deploy.rb +0 -1
- data/lib/r10k/cli/puppetfile.rb +2 -2
- data/lib/r10k/cli.rb +2 -16
- data/lib/r10k/deployment/environment.rb +9 -79
- data/lib/r10k/deployment/source.rb +15 -89
- data/lib/r10k/deployment.rb +13 -14
- data/lib/r10k/environment/base.rb +42 -0
- data/lib/r10k/environment/git.rb +79 -0
- data/lib/r10k/environment/svn.rb +73 -0
- data/lib/r10k/environment.rb +7 -0
- data/lib/r10k/execution.rb +0 -1
- data/lib/r10k/git/cache.rb +11 -5
- data/lib/r10k/git/repository.rb +1 -8
- data/lib/r10k/git/working_dir.rb +11 -34
- data/lib/r10k/git.rb +0 -1
- data/lib/r10k/instance_cache.rb +32 -0
- data/lib/r10k/keyed_factory.rb +39 -0
- data/lib/r10k/module/forge.rb +2 -3
- data/lib/r10k/module/svn.rb +0 -1
- data/lib/r10k/puppetfile.rb +0 -1
- data/lib/r10k/registry.rb +3 -31
- data/lib/r10k/source/base.rb +60 -0
- data/lib/r10k/source/git.rb +195 -0
- data/lib/r10k/source/svn.rb +140 -0
- data/lib/r10k/source.rb +39 -0
- data/lib/r10k/svn/remote.rb +48 -0
- data/lib/r10k/svn/working_dir.rb +0 -2
- data/lib/r10k/svn.rb +6 -0
- data/lib/r10k/task/deployment.rb +1 -2
- data/lib/r10k/task.rb +0 -2
- data/lib/r10k/task_runner.rb +0 -1
- data/lib/r10k/util/core_ext/hash_ext.rb +19 -0
- data/lib/r10k/util/subprocess.rb +0 -1
- data/lib/r10k/version.rb +1 -1
- data/lib/r10k.rb +1 -0
- data/spec/unit/deployment/environment_spec.rb +16 -15
- data/spec/unit/environment/git_spec.rb +81 -0
- data/spec/unit/environment/svn_spec.rb +76 -0
- data/spec/unit/git/repository_spec.rb +0 -10
- data/spec/unit/git/working_dir_spec.rb +1 -110
- data/spec/unit/{registry_spec.rb → instance_cache_spec.rb} +3 -3
- data/spec/unit/keyed_factory_spec.rb +51 -0
- data/spec/unit/source/git_spec.rb +274 -0
- data/spec/unit/source/svn_spec.rb +102 -0
- data/spec/unit/source_spec.rb +10 -0
- data/spec/unit/svn/remote_spec.rb +21 -0
- data/spec/unit/util/core_ext/hash_ext_spec.rb +63 -0
- metadata +36 -10
- data/lib/r10k/git/alternates.rb +0 -49
- data/spec/unit/git/alternates_spec.rb +0 -90
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'r10k/util/core_ext/hash_ext'
|
3
|
+
|
4
|
+
describe R10K::Util::CoreExt::HashExt::SymbolizeKeys do
|
5
|
+
it "doesn't monky patch core types" do
|
6
|
+
# And now for a diatribe on monkey patching.
|
7
|
+
#
|
8
|
+
# Seriously. Monkey patching objects on a global objects without a very
|
9
|
+
# good reason is evil. On a case by case basis, sure, it can make life
|
10
|
+
# a bit easier but it also can grossly complicate things. If you do need to
|
11
|
+
# add a method to every type of an object because it'll be used everywhere,
|
12
|
+
# go for it. However if you only need a given method in a limited area,
|
13
|
+
# `Object#extend` is your friend.
|
14
|
+
#
|
15
|
+
# Fin.
|
16
|
+
expect(Hash.new).to_not respond_to(:symbolize_keys!)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "on an instance that extends #{described_class}" do
|
20
|
+
subject { Hash.new.extend(described_class) }
|
21
|
+
|
22
|
+
it "deletes all keys that are strings" do
|
23
|
+
subject['foo'] = 'bar'
|
24
|
+
subject[:baz] = 'quux'
|
25
|
+
|
26
|
+
subject.symbolize_keys!
|
27
|
+
expect(subject).to_not have_key('foo')
|
28
|
+
end
|
29
|
+
|
30
|
+
it "replaces the deleted keys with interned strings" do
|
31
|
+
subject['foo'] = 'bar'
|
32
|
+
subject[:baz] = 'quux'
|
33
|
+
|
34
|
+
subject.symbolize_keys!
|
35
|
+
expect(subject[:foo]).to eq 'bar'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "raises an error if there is an existing symbol for a given string key" do
|
39
|
+
subject['foo'] = 'bar'
|
40
|
+
subject[:foo] = 'quux'
|
41
|
+
|
42
|
+
expect {
|
43
|
+
subject.symbolize_keys!
|
44
|
+
}.to raise_error(TypeError, /An existing interned key/)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "does not modify existing symbol entries" do
|
48
|
+
subject['foo'] = 'bar'
|
49
|
+
subject[:baz] = 'quux'
|
50
|
+
|
51
|
+
subject.symbolize_keys!
|
52
|
+
expect(subject[:baz]).to eq 'quux'
|
53
|
+
end
|
54
|
+
|
55
|
+
it "does not modify keys that are not strings or symbols" do
|
56
|
+
key = %w[foo]
|
57
|
+
subject[key] = 'bar'
|
58
|
+
|
59
|
+
subject.symbolize_keys!
|
60
|
+
expect(subject[key]).to eq 'bar'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r10k
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored
|
@@ -191,7 +191,7 @@ files:
|
|
191
191
|
- .nodeset.yml
|
192
192
|
- .rspec
|
193
193
|
- .travis.yml
|
194
|
-
- CHANGELOG
|
194
|
+
- CHANGELOG.mkd
|
195
195
|
- Gemfile
|
196
196
|
- LICENSE
|
197
197
|
- README.markdown
|
@@ -224,10 +224,13 @@ files:
|
|
224
224
|
- lib/r10k/deployment/config/loader.rb
|
225
225
|
- lib/r10k/deployment/environment.rb
|
226
226
|
- lib/r10k/deployment/source.rb
|
227
|
+
- lib/r10k/environment.rb
|
228
|
+
- lib/r10k/environment/base.rb
|
229
|
+
- lib/r10k/environment/git.rb
|
230
|
+
- lib/r10k/environment/svn.rb
|
227
231
|
- lib/r10k/errors.rb
|
228
232
|
- lib/r10k/execution.rb
|
229
233
|
- lib/r10k/git.rb
|
230
|
-
- lib/r10k/git/alternates.rb
|
231
234
|
- lib/r10k/git/cache.rb
|
232
235
|
- lib/r10k/git/commit.rb
|
233
236
|
- lib/r10k/git/errors.rb
|
@@ -237,6 +240,8 @@ files:
|
|
237
240
|
- lib/r10k/git/repository.rb
|
238
241
|
- lib/r10k/git/tag.rb
|
239
242
|
- lib/r10k/git/working_dir.rb
|
243
|
+
- lib/r10k/instance_cache.rb
|
244
|
+
- lib/r10k/keyed_factory.rb
|
240
245
|
- lib/r10k/logging.rb
|
241
246
|
- lib/r10k/module.rb
|
242
247
|
- lib/r10k/module/base.rb
|
@@ -252,6 +257,12 @@ files:
|
|
252
257
|
- lib/r10k/settings.rb
|
253
258
|
- lib/r10k/settings/container.rb
|
254
259
|
- lib/r10k/settings/mixin.rb
|
260
|
+
- lib/r10k/source.rb
|
261
|
+
- lib/r10k/source/base.rb
|
262
|
+
- lib/r10k/source/git.rb
|
263
|
+
- lib/r10k/source/svn.rb
|
264
|
+
- lib/r10k/svn.rb
|
265
|
+
- lib/r10k/svn/remote.rb
|
255
266
|
- lib/r10k/svn/working_dir.rb
|
256
267
|
- lib/r10k/task.rb
|
257
268
|
- lib/r10k/task/deployment.rb
|
@@ -259,6 +270,7 @@ files:
|
|
259
270
|
- lib/r10k/task/module.rb
|
260
271
|
- lib/r10k/task/puppetfile.rb
|
261
272
|
- lib/r10k/task_runner.rb
|
273
|
+
- lib/r10k/util/core_ext/hash_ext.rb
|
262
274
|
- lib/r10k/util/platform.rb
|
263
275
|
- lib/r10k/util/purgeable.rb
|
264
276
|
- lib/r10k/util/subprocess.rb
|
@@ -297,7 +309,8 @@ files:
|
|
297
309
|
- spec/system/version_spec.rb
|
298
310
|
- spec/unit/deployment/environment_spec.rb
|
299
311
|
- spec/unit/deployment/source_spec.rb
|
300
|
-
- spec/unit/
|
312
|
+
- spec/unit/environment/git_spec.rb
|
313
|
+
- spec/unit/environment/svn_spec.rb
|
301
314
|
- spec/unit/git/cache_spec.rb
|
302
315
|
- spec/unit/git/commit_spec.rb
|
303
316
|
- spec/unit/git/head_spec.rb
|
@@ -305,14 +318,20 @@ files:
|
|
305
318
|
- spec/unit/git/repository_spec.rb
|
306
319
|
- spec/unit/git/tag_spec.rb
|
307
320
|
- spec/unit/git/working_dir_spec.rb
|
321
|
+
- spec/unit/instance_cache_spec.rb
|
322
|
+
- spec/unit/keyed_factory_spec.rb
|
308
323
|
- spec/unit/module/forge_spec.rb
|
309
324
|
- spec/unit/module/git_spec.rb
|
310
325
|
- spec/unit/module/metadata_spec.rb
|
311
326
|
- spec/unit/module/svn_spec.rb
|
312
327
|
- spec/unit/module_repository/forge_spec.rb
|
313
328
|
- spec/unit/module_spec.rb
|
314
|
-
- spec/unit/registry_spec.rb
|
315
329
|
- spec/unit/settings/container_spec.rb
|
330
|
+
- spec/unit/source/git_spec.rb
|
331
|
+
- spec/unit/source/svn_spec.rb
|
332
|
+
- spec/unit/source_spec.rb
|
333
|
+
- spec/unit/svn/remote_spec.rb
|
334
|
+
- spec/unit/util/core_ext/hash_ext_spec.rb
|
316
335
|
- spec/unit/util/subprocess_spec.rb
|
317
336
|
homepage: http://github.com/adrienthebo/r10k
|
318
337
|
licenses:
|
@@ -363,9 +382,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
363
382
|
version: '0'
|
364
383
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
365
384
|
requirements:
|
366
|
-
- - ! '
|
385
|
+
- - ! '>'
|
367
386
|
- !ruby/object:Gem::Version
|
368
|
-
version:
|
387
|
+
version: 1.3.1
|
369
388
|
requirements: []
|
370
389
|
rubyforge_project:
|
371
390
|
rubygems_version: 2.2.1
|
@@ -378,7 +397,8 @@ test_files:
|
|
378
397
|
- spec/system/module/forge/install_spec.rb
|
379
398
|
- spec/system/module/svn/update_spec.rb
|
380
399
|
- spec/system/module/svn/install_spec.rb
|
381
|
-
- spec/unit/
|
400
|
+
- spec/unit/environment/svn_spec.rb
|
401
|
+
- spec/unit/environment/git_spec.rb
|
382
402
|
- spec/unit/module_spec.rb
|
383
403
|
- spec/unit/module_repository/forge_spec.rb
|
384
404
|
- spec/unit/git/ref_spec.rb
|
@@ -387,12 +407,18 @@ test_files:
|
|
387
407
|
- spec/unit/git/commit_spec.rb
|
388
408
|
- spec/unit/git/repository_spec.rb
|
389
409
|
- spec/unit/git/head_spec.rb
|
390
|
-
- spec/unit/git/alternates_spec.rb
|
391
410
|
- spec/unit/git/tag_spec.rb
|
411
|
+
- spec/unit/keyed_factory_spec.rb
|
392
412
|
- spec/unit/deployment/environment_spec.rb
|
393
413
|
- spec/unit/deployment/source_spec.rb
|
414
|
+
- spec/unit/source_spec.rb
|
394
415
|
- spec/unit/util/subprocess_spec.rb
|
416
|
+
- spec/unit/util/core_ext/hash_ext_spec.rb
|
417
|
+
- spec/unit/instance_cache_spec.rb
|
395
418
|
- spec/unit/settings/container_spec.rb
|
419
|
+
- spec/unit/svn/remote_spec.rb
|
420
|
+
- spec/unit/source/svn_spec.rb
|
421
|
+
- spec/unit/source/git_spec.rb
|
396
422
|
- spec/unit/module/forge_spec.rb
|
397
423
|
- spec/unit/module/svn_spec.rb
|
398
424
|
- spec/unit/module/git_spec.rb
|
data/lib/r10k/git/alternates.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
# Manage `$GIT_DIR/objects/info/alternates`
|
4
|
-
#
|
5
|
-
# @see man gitrepository-layout(5)
|
6
|
-
class R10K::Git::Alternates
|
7
|
-
|
8
|
-
# @attribute [r] file
|
9
|
-
# @return [Pathname] The alternates file
|
10
|
-
attr_reader :file
|
11
|
-
|
12
|
-
# @param git_dir [String] The path to the git repository
|
13
|
-
def initialize(git_dir)
|
14
|
-
@file = Pathname.new(File.join(git_dir, 'objects', 'info', 'alternates'))
|
15
|
-
end
|
16
|
-
|
17
|
-
def to_a
|
18
|
-
read()
|
19
|
-
end
|
20
|
-
|
21
|
-
def <<(path)
|
22
|
-
write(to_a << path)
|
23
|
-
end
|
24
|
-
|
25
|
-
def include?(path)
|
26
|
-
to_a.include?(path)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def write(entries)
|
32
|
-
if ! @file.parent.directory?
|
33
|
-
raise R10K::Git::GitError, "Cannot write #{@file}; parent directory does not exist"
|
34
|
-
end
|
35
|
-
@file.open("w") do |fh|
|
36
|
-
entries.each do |entry|
|
37
|
-
fh.puts(entry)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def read
|
43
|
-
entries = []
|
44
|
-
if @file.file?
|
45
|
-
entries = @file.readlines.map(&:chomp)
|
46
|
-
end
|
47
|
-
entries
|
48
|
-
end
|
49
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'stringio'
|
3
|
-
require 'r10k/git'
|
4
|
-
|
5
|
-
describe R10K::Git::Alternates do
|
6
|
-
subject { described_class.new("/some/nonexistent/path/.git") }
|
7
|
-
|
8
|
-
it "interacts with the alternates file in the given git repository" do
|
9
|
-
expect(subject.file.to_s).to eq("/some/nonexistent/path/.git/objects/info/alternates")
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "reading alternate object entries" do
|
13
|
-
it "reads the alternates file and splits on lines" do
|
14
|
-
expect(subject.file).to receive(:file?).and_return true
|
15
|
-
expect(subject.file).to receive(:readlines).and_return([
|
16
|
-
"/var/cache/r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git\n",
|
17
|
-
"/vagrant/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git\n",
|
18
|
-
])
|
19
|
-
|
20
|
-
expect(subject.to_a).to eq([
|
21
|
-
"/var/cache/r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git",
|
22
|
-
"/vagrant/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git",
|
23
|
-
])
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns an empty array when the file is not present" do
|
27
|
-
expect(subject.file).to receive(:file?).and_return false
|
28
|
-
expect(subject.file).to receive(:readlines).never
|
29
|
-
expect(subject.to_a).to eq([])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "determining if an entry is already present" do
|
34
|
-
before do
|
35
|
-
allow(subject).to receive(:to_a).and_return([
|
36
|
-
"/var/cache/r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git",
|
37
|
-
"/vagrant/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git",
|
38
|
-
])
|
39
|
-
end
|
40
|
-
|
41
|
-
it "is true if the element is in the array of read entries" do
|
42
|
-
expect(subject).to include("/vagrant/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "is false if the element is not in the array of read entries" do
|
46
|
-
expect(subject).to_not include("/tmp/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "appending a new alternate object entry" do
|
51
|
-
describe "and the git objects/info directory does not exist" do
|
52
|
-
it "raises an error when the parent directory does not exist" do
|
53
|
-
expect {
|
54
|
-
subject << "/tmp/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git"
|
55
|
-
}.to raise_error(R10K::Git::GitError,"Cannot write /some/nonexistent/path/.git/objects/info/alternates; parent directory does not exist")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "and the git objects/info directory exists" do
|
60
|
-
let(:io) { StringIO.new }
|
61
|
-
|
62
|
-
before do
|
63
|
-
expect(subject.file).to receive(:open).with('w').and_yield(io)
|
64
|
-
subject.file.stub_chain(:parent, :directory?).and_return true
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
it "creates the alternates file with the new entry when not present" do
|
69
|
-
expect(subject).to receive(:to_a).and_return([])
|
70
|
-
subject << "/tmp/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git"
|
71
|
-
|
72
|
-
expect(io.string).to eq("/tmp/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git\n")
|
73
|
-
end
|
74
|
-
|
75
|
-
it "rewrites the file with all alternate entries" do
|
76
|
-
expect(subject).to receive(:to_a).and_return([
|
77
|
-
"/var/cache/r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git",
|
78
|
-
"/vagrant/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git",
|
79
|
-
])
|
80
|
-
subject << "/tmp/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git"
|
81
|
-
|
82
|
-
expect(io.string).to eq(<<-EOD)
|
83
|
-
/var/cache/r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git
|
84
|
-
/vagrant/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git
|
85
|
-
/tmp/.r10k/git/git---github.com-puppetlabs-puppetlabs-apache.git
|
86
|
-
EOD
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|