vagrant-config_builder 0.6.0 → 0.7.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 +15 -0
- data/CHANGELOG +12 -0
- data/Gemfile +4 -0
- data/lib/config_builder/loader/yaml.rb +2 -1
- data/lib/config_builder/version.rb +1 -1
- data/spec/config_builder/loader/yaml_spec.rb +76 -0
- data/vagrant-config_builder.gemspec +2 -0
- metadata +20 -9
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODkzZWVlNDVkOGVjNWZjN2I0OWU0Zjg4OTllMTJjNmFhMGM5Y2Y0Zg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Mzc0NzNmZmZhNzE5MzMwMWI1NzgzYTRjOTY5N2I1NzcwNzYzOWZhNQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2YzNjQ2NzNkY2M3ZjQyYTlkMTdiYWQ4YWU1YTNhZGRkNDE0NjAyMWY0NDM5
|
10
|
+
ZjU2NWQxYWQyNmU3MWUzYjkyZDllYWVhODU1MTM4MTk3YjVkMDVmMjUwNmVl
|
11
|
+
NDA1NTczNjhiMDM3ZmVjMTIxZjY1Yzg5OGE1MjE5M2VkMThlYmQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjViZjQ1MDU0MmU3MTlkMzY3YzQ1YzlkMjlmMmI0NDQ2NmJiZGRjMGIyNjQz
|
14
|
+
YTc0OTI3NzFiNGQ1ZDBkZTZkNGNiZWEyMTlhZTIwMTA0N2VjMzA0YWU1NDY0
|
15
|
+
N2M5YzkxZGQyYTVlYmY2ZGNkMjUzMWYzYThmMDJlNjk1MmZhM2Y=
|
data/CHANGELOG
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
0.7.0
|
5
|
+
-----
|
6
|
+
|
7
|
+
2014-03-19
|
8
|
+
|
9
|
+
This is a backwards compatible feature release.
|
10
|
+
|
11
|
+
* (GH-15) Deep merge data when loading configurations. This allows
|
12
|
+
individual top level keys to be split up between files.
|
13
|
+
|
14
|
+
Thanks to Charlie Sharpsteen creating this release.
|
15
|
+
|
4
16
|
0.6.0
|
5
17
|
-----
|
6
18
|
|
data/Gemfile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'deep_merge'
|
2
3
|
|
3
4
|
class ConfigBuilder::Loader::YAML
|
4
5
|
|
@@ -23,7 +24,7 @@ class ConfigBuilder::Loader::YAML
|
|
23
24
|
files.each do |file|
|
24
25
|
contents = ::YAML.load_file(file)
|
25
26
|
if contents.is_a? Hash
|
26
|
-
rv.
|
27
|
+
rv.deep_merge! contents
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ConfigBuilder::Loader::YAML do
|
4
|
+
describe '#yamldir' do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
# Simulate directories of YAML files for the loader.
|
8
|
+
allow(File).to receive(:join).with('tst_dir_a', anything()).and_return('tst_dir_a')
|
9
|
+
allow(File).to receive(:join).with('tst_dir_b', anything()).and_return('tst_dir_b')
|
10
|
+
|
11
|
+
allow(Dir).to receive(:glob).with('tst_dir_a').and_return(['a/boxes.yaml', 'a/roles.yaml'])
|
12
|
+
allow(Dir).to receive(:glob).with('tst_dir_b').and_return(['b/boxes.yaml', 'b/roles.yaml'])
|
13
|
+
|
14
|
+
allow(::YAML).to receive(:load_file).with('a/boxes.yaml').and_return(::YAML.load <<-EOF)
|
15
|
+
---
|
16
|
+
boxes:
|
17
|
+
'box-a': 'http://puppet-vagrant-boxes.puppetlabs.com/'
|
18
|
+
EOF
|
19
|
+
|
20
|
+
allow(::YAML).to receive(:load_file).with('a/roles.yaml').and_return(::YAML.load <<-EOF)
|
21
|
+
---
|
22
|
+
roles:
|
23
|
+
base:
|
24
|
+
private_networks:
|
25
|
+
- {ip: '0.0.0.0', auto_network: true}
|
26
|
+
EOF
|
27
|
+
|
28
|
+
allow(::YAML).to receive(:load_file).with('b/boxes.yaml').and_return(::YAML.load <<-EOF)
|
29
|
+
---
|
30
|
+
boxes:
|
31
|
+
'box-b': 'http://puppet-vagrant-boxes.puppetlabs.com/'
|
32
|
+
EOF
|
33
|
+
|
34
|
+
allow(::YAML).to receive(:load_file).with('b/roles.yaml').and_return(::YAML.load <<-EOF)
|
35
|
+
---
|
36
|
+
roles:
|
37
|
+
base:
|
38
|
+
private_networks:
|
39
|
+
- {ip: '10.0.0.1'}
|
40
|
+
EOF
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
it 'loads from single directories' do
|
45
|
+
subject.yamldir('tst_dir_a')
|
46
|
+
|
47
|
+
expect(::YAML).to have_received(:load_file).exactly(2).times
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'loads from multiple directories' do
|
51
|
+
subject.yamldir(['tst_dir_a', 'tst_dir_b'])
|
52
|
+
|
53
|
+
expect(::YAML).to have_received(:load_file).exactly(4).times
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'merges separate hashes' do
|
57
|
+
config = subject.yamldir('tst_dir_a')
|
58
|
+
|
59
|
+
expect(config).to have_key('boxes')
|
60
|
+
expect(config).to have_key('roles')
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'when merging overlapping configs' do
|
64
|
+
let(:config) { subject.yamldir(['tst_dir_a', 'tst_dir_b']) }
|
65
|
+
|
66
|
+
it 'merges subhashes' do
|
67
|
+
expect(config['boxes']).to have_key('box-a')
|
68
|
+
expect(config['boxes']).to have_key('box-b')
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'concatenates subarrays' do
|
72
|
+
expect(config['roles']['base']['private_networks']).to have(2).items
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-config_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Adrien Thebo
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: deep_merge
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
14
27
|
- !ruby/object:Gem::Dependency
|
15
28
|
name: rspec
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
30
|
requirements:
|
19
31
|
- - ~>
|
20
32
|
- !ruby/object:Gem::Version
|
@@ -22,7 +34,6 @@ dependencies:
|
|
22
34
|
type: :development
|
23
35
|
prerelease: false
|
24
36
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
37
|
requirements:
|
27
38
|
- - ~>
|
28
39
|
- !ruby/object:Gem::Version
|
@@ -69,33 +80,33 @@ files:
|
|
69
80
|
- lib/vagrant-config_builder.rb
|
70
81
|
- spec/config_builder/filter/boxes_spec.rb
|
71
82
|
- spec/config_builder/filter/roles_spec.rb
|
83
|
+
- spec/config_builder/loader/yaml_spec.rb
|
72
84
|
- spec/spec_helper.rb
|
73
85
|
- templates/locales/en.yml
|
74
86
|
- vagrant-config_builder.gemspec
|
75
87
|
homepage: https://github.com/adrienthebo/vagrant-config_builder
|
76
88
|
licenses:
|
77
89
|
- Apache 2.0
|
90
|
+
metadata: {}
|
78
91
|
post_install_message:
|
79
92
|
rdoc_options: []
|
80
93
|
require_paths:
|
81
94
|
- lib
|
82
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
96
|
requirements:
|
85
97
|
- - ! '>='
|
86
98
|
- !ruby/object:Gem::Version
|
87
99
|
version: '0'
|
88
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
101
|
requirements:
|
91
102
|
- - ! '>='
|
92
103
|
- !ruby/object:Gem::Version
|
93
104
|
version: '0'
|
94
105
|
requirements: []
|
95
106
|
rubyforge_project:
|
96
|
-
rubygems_version:
|
107
|
+
rubygems_version: 2.2.1
|
97
108
|
signing_key:
|
98
|
-
specification_version:
|
109
|
+
specification_version: 4
|
99
110
|
summary: Generate Vagrant configurations from arbitrary data
|
100
111
|
test_files: []
|
101
112
|
has_rdoc: true
|