constantinople 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -1
- data/lib/constantinople.rb +17 -2
- data/lib/constantinople/version.rb +1 -1
- data/spec/config/.constantinopleignore +1 -0
- data/spec/config/error.yml +4 -0
- data/spec/lib/constantinople_spec.rb +10 -0
- metadata +40 -36
data/Rakefile
CHANGED
data/lib/constantinople.rb
CHANGED
@@ -8,19 +8,26 @@ module Constantinople
|
|
8
8
|
|
9
9
|
def self.reload!
|
10
10
|
result = Map.new
|
11
|
+
ignore_files = []
|
11
12
|
caller_config_directories do |dir|
|
12
|
-
|
13
|
+
ignore_files += files_to_ignore(dir)
|
14
|
+
end
|
15
|
+
ignore_files.uniq!
|
16
|
+
caller_config_directories do |dir|
|
17
|
+
result.deeper_merge!(load_from_directory(dir, :ignore => ignore_files))
|
13
18
|
end
|
14
19
|
result # I'm the map, I'm the map, I'm the map, I'm the map...
|
15
20
|
end
|
16
21
|
|
17
22
|
private
|
18
23
|
|
19
|
-
def self.load_from_directory(dir)
|
24
|
+
def self.load_from_directory(dir, args={})
|
20
25
|
env = environment
|
21
26
|
result = Map.new
|
27
|
+
ignore_files = args[:ignore]
|
22
28
|
['.yml.default', '.yml', '.yml.override'].each do |ext|
|
23
29
|
Dir.glob(File.join(dir,"*#{ext}")) do |path|
|
30
|
+
next if ignore_files.include?(File.basename(path))
|
24
31
|
filename = File.basename(path,ext)
|
25
32
|
sub = load_yaml_or_warn(path)
|
26
33
|
if sub
|
@@ -74,6 +81,14 @@ module Constantinople
|
|
74
81
|
end
|
75
82
|
end
|
76
83
|
|
84
|
+
def self.files_to_ignore(dir)
|
85
|
+
File.open(File.join(dir,".constantinopleignore")) do |f|
|
86
|
+
f.readlines
|
87
|
+
end
|
88
|
+
rescue Exception => e
|
89
|
+
[]
|
90
|
+
end
|
91
|
+
|
77
92
|
end
|
78
93
|
|
79
94
|
CONSTANTINOPLE = Constantinople.reload!
|
@@ -0,0 +1 @@
|
|
1
|
+
error.yml
|
@@ -18,4 +18,14 @@ describe Constantinople do
|
|
18
18
|
CONFIG.spec.animal.should == 'turtle' # from test environment
|
19
19
|
CONFIG.empty.should be_empty
|
20
20
|
end
|
21
|
+
|
22
|
+
describe "ignore files" do
|
23
|
+
it "should read .constantinopleignore if it exists" do
|
24
|
+
Constantinople.send(:files_to_ignore, "spec/config").should == ['error.yml']
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should not bother reading error.yml" do
|
28
|
+
CONFIG.should_not include(:error)
|
29
|
+
end
|
30
|
+
end
|
21
31
|
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: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Johnson
|
@@ -15,10 +15,12 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-03-01 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
21
|
+
name: map
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
24
|
none: false
|
23
25
|
requirements:
|
24
26
|
- - ~>
|
@@ -28,12 +30,12 @@ dependencies:
|
|
28
30
|
- 4
|
29
31
|
- 2
|
30
32
|
version: "4.2"
|
31
|
-
requirement: *id001
|
32
33
|
type: :runtime
|
33
|
-
|
34
|
-
name: map
|
34
|
+
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
36
|
+
name: deep_merge
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
39
|
none: false
|
38
40
|
requirements:
|
39
41
|
- - ~>
|
@@ -43,12 +45,12 @@ dependencies:
|
|
43
45
|
- 1
|
44
46
|
- 0
|
45
47
|
version: "1.0"
|
46
|
-
requirement: *id002
|
47
48
|
type: :runtime
|
48
|
-
|
49
|
-
name: deep_merge
|
49
|
+
version_requirements: *id002
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
51
|
+
name: rspec
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
54
|
none: false
|
53
55
|
requirements:
|
54
56
|
- - ~>
|
@@ -58,12 +60,12 @@ dependencies:
|
|
58
60
|
- 2
|
59
61
|
- 6
|
60
62
|
version: "2.6"
|
61
|
-
requirement: *id003
|
62
63
|
type: :development
|
63
|
-
|
64
|
-
name: rspec
|
64
|
+
version_requirements: *id003
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
|
66
|
+
name: simplecov
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
69
|
none: false
|
68
70
|
requirements:
|
69
71
|
- - ~>
|
@@ -73,12 +75,12 @@ dependencies:
|
|
73
75
|
- 0
|
74
76
|
- 4
|
75
77
|
version: "0.4"
|
76
|
-
requirement: *id004
|
77
78
|
type: :development
|
78
|
-
|
79
|
-
name: simplecov
|
79
|
+
version_requirements: *id004
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
|
-
|
81
|
+
name: rb-fsevent
|
82
|
+
prerelease: false
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
84
|
none: false
|
83
85
|
requirements:
|
84
86
|
- - ~>
|
@@ -88,12 +90,12 @@ dependencies:
|
|
88
90
|
- 0
|
89
91
|
- 4
|
90
92
|
version: "0.4"
|
91
|
-
requirement: *id005
|
92
93
|
type: :development
|
93
|
-
|
94
|
-
name: rb-fsevent
|
94
|
+
version_requirements: *id005
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
|
96
|
+
name: guard
|
97
|
+
prerelease: false
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
99
|
none: false
|
98
100
|
requirements:
|
99
101
|
- - ~>
|
@@ -103,12 +105,12 @@ dependencies:
|
|
103
105
|
- 0
|
104
106
|
- 5
|
105
107
|
version: "0.5"
|
106
|
-
requirement: *id006
|
107
108
|
type: :development
|
108
|
-
|
109
|
-
name: guard
|
109
|
+
version_requirements: *id006
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
|
111
|
+
name: guard-bundler
|
112
|
+
prerelease: false
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
112
114
|
none: false
|
113
115
|
requirements:
|
114
116
|
- - ~>
|
@@ -118,12 +120,12 @@ dependencies:
|
|
118
120
|
- 0
|
119
121
|
- 1
|
120
122
|
version: "0.1"
|
121
|
-
requirement: *id007
|
122
123
|
type: :development
|
123
|
-
|
124
|
-
name: guard-bundler
|
124
|
+
version_requirements: *id007
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
|
126
|
+
name: guard-rspec
|
127
|
+
prerelease: false
|
128
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
127
129
|
none: false
|
128
130
|
requirements:
|
129
131
|
- - ~>
|
@@ -133,10 +135,8 @@ dependencies:
|
|
133
135
|
- 0
|
134
136
|
- 4
|
135
137
|
version: "0.4"
|
136
|
-
requirement: *id008
|
137
138
|
type: :development
|
138
|
-
|
139
|
-
name: guard-rspec
|
139
|
+
version_requirements: *id008
|
140
140
|
description: Supports defaults, over-rides, and environments
|
141
141
|
email:
|
142
142
|
- chris@kindkid.com
|
@@ -157,8 +157,10 @@ files:
|
|
157
157
|
- lib/constantinople.rb
|
158
158
|
- lib/constantinople/deep_merge_map.rb
|
159
159
|
- lib/constantinople/version.rb
|
160
|
+
- spec/config/.constantinopleignore
|
160
161
|
- spec/config/empty.yml
|
161
162
|
- spec/config/erby.yml
|
163
|
+
- spec/config/error.yml
|
162
164
|
- spec/config/spec.yml
|
163
165
|
- spec/config/spec.yml.default
|
164
166
|
- spec/config/spec.yml.override
|
@@ -198,8 +200,10 @@ signing_key:
|
|
198
200
|
specification_version: 3
|
199
201
|
summary: Load all your config/*.yml files
|
200
202
|
test_files:
|
203
|
+
- spec/config/.constantinopleignore
|
201
204
|
- spec/config/empty.yml
|
202
205
|
- spec/config/erby.yml
|
206
|
+
- spec/config/error.yml
|
203
207
|
- spec/config/spec.yml
|
204
208
|
- spec/config/spec.yml.default
|
205
209
|
- spec/config/spec.yml.override
|