constantinople 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/constantinople.rb
CHANGED
@@ -22,9 +22,14 @@ module Constantinople
|
|
22
22
|
['.yml.default', '.yml', '.yml.override'].each do |ext|
|
23
23
|
Dir.glob(File.join(dir,"*#{ext}")) do |path|
|
24
24
|
filename = File.basename(path,ext)
|
25
|
-
|
26
|
-
sub
|
27
|
-
|
25
|
+
sub = YAML.load_file(path)
|
26
|
+
if sub
|
27
|
+
sub = Map.new(sub)
|
28
|
+
sub.deeper_merge!(sub[env]) if sub.include?(env)
|
29
|
+
else
|
30
|
+
sub = {}
|
31
|
+
end
|
32
|
+
result.deeper_merge!(filename => sub)
|
28
33
|
end
|
29
34
|
end
|
30
35
|
result
|
File without changes
|
data/spec/config/spec.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
c: override
|
1
|
+
c: override
|
@@ -13,6 +13,9 @@ describe Constantinople do
|
|
13
13
|
CONFIG.spec.a.should == 'default'
|
14
14
|
CONFIG.spec.b.should == 'standard'
|
15
15
|
CONFIG.spec.c.should == 'override'
|
16
|
+
CONFIG.spec.monkey.should == 'banana'
|
17
|
+
CONFIG.spec.test.monkey.should == 'test-banana'
|
16
18
|
CONFIG.spec.animal.should == 'turtle' # from test environment
|
19
|
+
CONFIG.empty.should be_empty
|
17
20
|
end
|
18
21
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constantinople
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Johnson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-15 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- lib/constantinople.rb
|
159
159
|
- lib/constantinople/deep_merge_map.rb
|
160
160
|
- lib/constantinople/version.rb
|
161
|
+
- spec/config/empty.yml
|
161
162
|
- spec/config/spec.yml
|
162
163
|
- spec/config/spec.yml.default
|
163
164
|
- spec/config/spec.yml.override
|
@@ -198,6 +199,7 @@ signing_key:
|
|
198
199
|
specification_version: 3
|
199
200
|
summary: Load all your config/*.yml files
|
200
201
|
test_files:
|
202
|
+
- spec/config/empty.yml
|
201
203
|
- spec/config/spec.yml
|
202
204
|
- spec/config/spec.yml.default
|
203
205
|
- spec/config/spec.yml.override
|