constantinople 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- result.deeper_merge!(filename => YAML.load_file(path))
26
- sub = result[filename]
27
- sub.deeper_merge!(sub[env]) if sub.include?(env)
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
@@ -1,3 +1,3 @@
1
1
  module Constantinople
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
File without changes
@@ -1,6 +1,7 @@
1
1
  b: standard
2
2
  c: standard
3
3
  animal: unicorn
4
+ monkey: banana
4
5
  development:
5
6
  animal: dolphin
6
7
  test:
@@ -1,3 +1,10 @@
1
1
  a: default
2
2
  b: default
3
- c: default
3
+ c: default
4
+
5
+ development:
6
+ monkey: development-banana
7
+ test:
8
+ monkey: test-banana
9
+ production:
10
+ monkey: production-banana
@@ -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: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.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-08-04 00:00:00 -05:00
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