configoro 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.rspec +2 -1
- data/.ruby-version +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +154 -112
- data/VERSION +1 -1
- data/configoro.gemspec +37 -34
- data/lib/configoro.rb +0 -3
- data/spec/configoro/hash_spec.rb +35 -35
- data/spec/configoro_spec.rb +13 -13
- data/spec/data/config/environments/common/erb_test.yml +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +37 -23
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NmQ4MDZhY2ZiNGQ3ZWIzNWIyZGQ3N2Q2NzgxMjhlZjlhY2I5NzUyYQ==
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 37579640d17cade2d211b2b2dcc410ee8fb7d8c2fb15412452291fa996593288
|
4
|
+
data.tar.gz: 6762a81e9c94c8ffae02c8e5d56468da1aec086f6f50b8989f24ec56094076a7
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZTlhZWZmMTM3MTg2ODhhMTYyNjZmY2RhOTY4OTJkZmYwMGIyM2FlZDBlZDli
|
11
|
-
OGVlY2UxZjRmMWRlNzAwNzAxZGJjMzMzNDdiNzVkNzI0OTllYTE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDg2OTU1YmI0ODcxYTFmMmU5Mjk0MjA5NjQyMjQyOTYzOWI2YTQwMjk5NjFi
|
14
|
-
YzAyMTAwYTZiMzQwYjJmNWJmM2ZlZGE3MDQxZTViZDEyZmFkOTU2ZjA5MmRm
|
15
|
-
NTgxN2YwNzgzOTM4YzQxMTgyNGNhYTJjNjk3OGFmY2ZlYWJkYTU=
|
6
|
+
metadata.gz: 4bbd10b9f951fca7bfde52c0f3b61bac825cdec675f302c22172e304894177771533382efd2516ec71edacaebfd451efd6adb4cb101cb9a8b66f45fdb681ad16
|
7
|
+
data.tar.gz: 97be38f588250a8c72dadb085c13f08503a98a987b3bae81e08185922aead297807a3d944f8760df8669bbde00134e65bcc10fdea40fe03767bcb2470845af9a
|
data/.rspec
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
--color
|
2
|
+
--format=documentation
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.5.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,126 +1,164 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
actionpack (=
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
4
|
+
actioncable (5.1.4)
|
5
|
+
actionpack (= 5.1.4)
|
6
|
+
nio4r (~> 2.0)
|
7
|
+
websocket-driver (~> 0.6.1)
|
8
|
+
actionmailer (5.1.4)
|
9
|
+
actionpack (= 5.1.4)
|
10
|
+
actionview (= 5.1.4)
|
11
|
+
activejob (= 5.1.4)
|
12
|
+
mail (~> 2.5, >= 2.5.4)
|
13
|
+
rails-dom-testing (~> 2.0)
|
14
|
+
actionpack (5.1.4)
|
15
|
+
actionview (= 5.1.4)
|
16
|
+
activesupport (= 5.1.4)
|
17
|
+
rack (~> 2.0)
|
18
|
+
rack-test (>= 0.6.3)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
21
|
+
actionview (5.1.4)
|
22
|
+
activesupport (= 5.1.4)
|
23
|
+
builder (~> 3.1)
|
24
|
+
erubi (~> 1.4)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
27
|
+
activejob (5.1.4)
|
28
|
+
activesupport (= 5.1.4)
|
29
|
+
globalid (>= 0.3.6)
|
30
|
+
activemodel (5.1.4)
|
31
|
+
activesupport (= 5.1.4)
|
32
|
+
activerecord (5.1.4)
|
33
|
+
activemodel (= 5.1.4)
|
34
|
+
activesupport (= 5.1.4)
|
35
|
+
arel (~> 8.0)
|
36
|
+
activesupport (5.1.4)
|
37
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
38
|
+
i18n (~> 0.7)
|
39
|
+
minitest (~> 5.1)
|
40
|
+
tzinfo (~> 1.1)
|
41
|
+
addressable (2.4.0)
|
42
|
+
arel (8.0.0)
|
43
|
+
builder (3.2.3)
|
44
|
+
concurrent-ruby (1.0.5)
|
45
|
+
crass (1.0.3)
|
46
|
+
descendants_tracker (0.0.4)
|
47
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
48
|
+
diff-lcs (1.3)
|
49
|
+
erubi (1.7.0)
|
50
|
+
faraday (0.9.2)
|
51
|
+
multipart-post (>= 1.2, < 3)
|
52
|
+
git (1.3.0)
|
53
|
+
github_api (0.16.0)
|
54
|
+
addressable (~> 2.4.0)
|
55
|
+
descendants_tracker (~> 0.0.4)
|
56
|
+
faraday (~> 0.8, < 0.10)
|
57
|
+
hashie (>= 3.4)
|
58
|
+
mime-types (>= 1.16, < 3.0)
|
59
|
+
oauth2 (~> 1.0)
|
60
|
+
globalid (0.4.1)
|
61
|
+
activesupport (>= 4.2.0)
|
62
|
+
hashie (3.5.7)
|
63
|
+
highline (1.7.10)
|
64
|
+
i18n (0.9.3)
|
65
|
+
concurrent-ruby (~> 1.0)
|
66
|
+
jeweler (2.3.9)
|
50
67
|
builder
|
51
|
-
bundler
|
68
|
+
bundler
|
52
69
|
git (>= 1.2.5)
|
53
|
-
github_api (
|
70
|
+
github_api (~> 0.16.0)
|
54
71
|
highline (>= 1.6.15)
|
55
|
-
nokogiri (
|
72
|
+
nokogiri (>= 1.5.10)
|
73
|
+
psych
|
56
74
|
rake
|
57
75
|
rdoc
|
58
|
-
|
59
|
-
jwt (
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
76
|
+
semver2
|
77
|
+
jwt (1.5.6)
|
78
|
+
loofah (2.1.1)
|
79
|
+
crass (~> 1.0.2)
|
80
|
+
nokogiri (>= 1.5.9)
|
81
|
+
mail (2.7.0)
|
82
|
+
mini_mime (>= 0.1.1)
|
83
|
+
method_source (0.9.0)
|
84
|
+
mime-types (2.99.3)
|
85
|
+
mini_mime (1.0.0)
|
86
|
+
mini_portile2 (2.3.0)
|
87
|
+
minitest (5.11.3)
|
88
|
+
multi_json (1.13.1)
|
89
|
+
multi_xml (0.6.0)
|
90
|
+
multipart-post (2.0.0)
|
91
|
+
nio4r (2.2.0)
|
92
|
+
nokogiri (1.8.2)
|
93
|
+
mini_portile2 (~> 2.3.0)
|
94
|
+
oauth2 (1.4.0)
|
95
|
+
faraday (>= 0.8, < 0.13)
|
96
|
+
jwt (~> 1.0)
|
97
|
+
multi_json (~> 1.3)
|
75
98
|
multi_xml (~> 0.5)
|
76
|
-
rack (
|
77
|
-
|
78
|
-
rack (
|
79
|
-
rack-test (0.
|
80
|
-
rack (>= 1.0)
|
81
|
-
rails (
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
99
|
+
rack (>= 1.2, < 3)
|
100
|
+
psych (3.0.2)
|
101
|
+
rack (2.0.4)
|
102
|
+
rack-test (0.8.2)
|
103
|
+
rack (>= 1.0, < 3)
|
104
|
+
rails (5.1.4)
|
105
|
+
actioncable (= 5.1.4)
|
106
|
+
actionmailer (= 5.1.4)
|
107
|
+
actionpack (= 5.1.4)
|
108
|
+
actionview (= 5.1.4)
|
109
|
+
activejob (= 5.1.4)
|
110
|
+
activemodel (= 5.1.4)
|
111
|
+
activerecord (= 5.1.4)
|
112
|
+
activesupport (= 5.1.4)
|
113
|
+
bundler (>= 1.3.0)
|
114
|
+
railties (= 5.1.4)
|
115
|
+
sprockets-rails (>= 2.0.0)
|
116
|
+
rails-dom-testing (2.0.3)
|
117
|
+
activesupport (>= 4.2.0)
|
118
|
+
nokogiri (>= 1.6)
|
119
|
+
rails-html-sanitizer (1.0.3)
|
120
|
+
loofah (~> 2.0)
|
121
|
+
railties (5.1.4)
|
122
|
+
actionpack (= 5.1.4)
|
123
|
+
activesupport (= 5.1.4)
|
124
|
+
method_source
|
92
125
|
rake (>= 0.8.7)
|
93
126
|
thor (>= 0.18.1, < 2.0)
|
94
|
-
rake (
|
95
|
-
rdoc (
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
rspec-
|
100
|
-
rspec-
|
101
|
-
|
102
|
-
|
103
|
-
rspec-expectations (
|
104
|
-
diff-lcs (>= 1.
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
127
|
+
rake (12.3.0)
|
128
|
+
rdoc (6.0.1)
|
129
|
+
redcarpet (3.4.0)
|
130
|
+
rspec (3.7.0)
|
131
|
+
rspec-core (~> 3.7.0)
|
132
|
+
rspec-expectations (~> 3.7.0)
|
133
|
+
rspec-mocks (~> 3.7.0)
|
134
|
+
rspec-core (3.7.1)
|
135
|
+
rspec-support (~> 3.7.0)
|
136
|
+
rspec-expectations (3.7.0)
|
137
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
138
|
+
rspec-support (~> 3.7.0)
|
139
|
+
rspec-its (1.2.0)
|
140
|
+
rspec-core (>= 3.0.0)
|
141
|
+
rspec-expectations (>= 3.0.0)
|
142
|
+
rspec-mocks (3.7.0)
|
143
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
144
|
+
rspec-support (~> 3.7.0)
|
145
|
+
rspec-support (3.7.1)
|
146
|
+
semver2 (3.4.2)
|
147
|
+
sprockets (3.7.1)
|
148
|
+
concurrent-ruby (~> 1.0)
|
149
|
+
rack (> 1, < 3)
|
150
|
+
sprockets-rails (3.2.1)
|
151
|
+
actionpack (>= 4.0)
|
152
|
+
activesupport (>= 4.0)
|
153
|
+
sprockets (>= 3.0.0)
|
154
|
+
thor (0.20.0)
|
155
|
+
thread_safe (0.3.6)
|
156
|
+
tzinfo (1.2.5)
|
157
|
+
thread_safe (~> 0.1)
|
158
|
+
websocket-driver (0.6.5)
|
159
|
+
websocket-extensions (>= 0.1.0)
|
160
|
+
websocket-extensions (0.1.3)
|
161
|
+
yard (0.9.12)
|
124
162
|
|
125
163
|
PLATFORMS
|
126
164
|
ruby
|
@@ -132,4 +170,8 @@ DEPENDENCIES
|
|
132
170
|
rails (>= 4.0)
|
133
171
|
redcarpet
|
134
172
|
rspec
|
173
|
+
rspec-its
|
135
174
|
yard
|
175
|
+
|
176
|
+
BUNDLED WITH
|
177
|
+
1.16.1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.1
|
data/configoro.gemspec
CHANGED
@@ -2,18 +2,18 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: configoro 1.4.
|
5
|
+
# stub: configoro 1.4.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "configoro"
|
9
|
-
s.version = "1.4.
|
8
|
+
s.name = "configoro".freeze
|
9
|
+
s.version = "1.4.1"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Tim Morgan"]
|
14
|
-
s.date = "
|
15
|
-
s.description = "Creates a YourApp::Configuration object whose methods are generated from environment-specific YAML files."
|
16
|
-
s.email = "git@timothymorgan.info"
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Tim Morgan".freeze]
|
14
|
+
s.date = "2018-02-07"
|
15
|
+
s.description = "Creates a YourApp::Configuration object whose methods are generated from environment-specific YAML files.".freeze
|
16
|
+
s.email = "git@timothymorgan.info".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
19
19
|
"README.md"
|
@@ -48,39 +48,42 @@ Gem::Specification.new do |s|
|
|
48
48
|
"spec/data/other/development/basic.yml",
|
49
49
|
"spec/spec_helper.rb"
|
50
50
|
]
|
51
|
-
s.homepage = "http://github.com/RISCfuture/configoro"
|
52
|
-
s.licenses = ["MIT"]
|
53
|
-
s.rubygems_version = "2.
|
54
|
-
s.summary = "Configuration object and YAML-based storage for Rails apps"
|
51
|
+
s.homepage = "http://github.com/RISCfuture/configoro".freeze
|
52
|
+
s.licenses = ["MIT".freeze]
|
53
|
+
s.rubygems_version = "2.7.5".freeze
|
54
|
+
s.summary = "Configuration object and YAML-based storage for Rails apps".freeze
|
55
55
|
|
56
56
|
if s.respond_to? :specification_version then
|
57
57
|
s.specification_version = 4
|
58
58
|
|
59
59
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
-
s.add_runtime_dependency(%q<activesupport
|
61
|
-
s.add_development_dependency(%q<rails
|
62
|
-
s.add_development_dependency(%q<rspec
|
63
|
-
s.add_development_dependency(%q<
|
64
|
-
s.add_development_dependency(%q<
|
65
|
-
s.add_development_dependency(%q<
|
66
|
-
s.add_development_dependency(%q<
|
60
|
+
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<rails>.freeze, [">= 4.0"])
|
62
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<rspec-its>.freeze, [">= 0"])
|
64
|
+
s.add_development_dependency(%q<yard>.freeze, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<redcarpet>.freeze, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
|
67
68
|
else
|
68
|
-
s.add_dependency(%q<activesupport
|
69
|
-
s.add_dependency(%q<rails
|
70
|
-
s.add_dependency(%q<rspec
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<
|
73
|
-
s.add_dependency(%q<
|
74
|
-
s.add_dependency(%q<
|
69
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 0"])
|
70
|
+
s.add_dependency(%q<rails>.freeze, [">= 4.0"])
|
71
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
72
|
+
s.add_dependency(%q<rspec-its>.freeze, [">= 0"])
|
73
|
+
s.add_dependency(%q<yard>.freeze, [">= 0"])
|
74
|
+
s.add_dependency(%q<redcarpet>.freeze, [">= 0"])
|
75
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
76
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
75
77
|
end
|
76
78
|
else
|
77
|
-
s.add_dependency(%q<activesupport
|
78
|
-
s.add_dependency(%q<rails
|
79
|
-
s.add_dependency(%q<rspec
|
80
|
-
s.add_dependency(%q<
|
81
|
-
s.add_dependency(%q<
|
82
|
-
s.add_dependency(%q<
|
83
|
-
s.add_dependency(%q<
|
79
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 0"])
|
80
|
+
s.add_dependency(%q<rails>.freeze, [">= 4.0"])
|
81
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
82
|
+
s.add_dependency(%q<rspec-its>.freeze, [">= 0"])
|
83
|
+
s.add_dependency(%q<yard>.freeze, [">= 0"])
|
84
|
+
s.add_dependency(%q<redcarpet>.freeze, [">= 0"])
|
85
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
86
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
84
87
|
end
|
85
88
|
end
|
86
89
|
|
data/lib/configoro.rb
CHANGED
data/spec/configoro/hash_spec.rb
CHANGED
@@ -5,23 +5,23 @@ describe Configoro::Hash do
|
|
5
5
|
|
6
6
|
context "[getters]" do
|
7
7
|
it "should allow access by symbol" do
|
8
|
-
subject[:string].
|
8
|
+
expect(subject[:string]).to eql('value')
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should allow access by string" do
|
12
|
-
subject['fixnum'].
|
12
|
+
expect(subject['fixnum']).to eql(123)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should allow access by method" do
|
16
|
-
subject.array.
|
17
|
-
subject.array.
|
16
|
+
expect(subject.array).to eql([ 1, 2, 3 ])
|
17
|
+
expect(subject.array).to eql([ 1, 2, 3 ])
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should allow access by predicate method" do
|
21
|
-
subject.string
|
22
|
-
subject.string
|
23
|
-
subject.nilval
|
24
|
-
subject.nilval
|
21
|
+
expect(subject.string?).to eql(true)
|
22
|
+
expect(subject.string?).to eql(true)
|
23
|
+
expect(subject.nilval?).to eql(false)
|
24
|
+
expect(subject.nilval?).to eql(false)
|
25
25
|
end
|
26
26
|
|
27
27
|
# We try the above methods twice: Once for creating the method, the other
|
@@ -30,39 +30,39 @@ describe Configoro::Hash do
|
|
30
30
|
|
31
31
|
context "[accessor methods]" do
|
32
32
|
it "should define an accessor method upon first access" do
|
33
|
-
subject.methods.
|
34
|
-
subject.methods.
|
33
|
+
expect(subject.methods).not_to include(:string)
|
34
|
+
expect(subject.methods).not_to include(:string?)
|
35
35
|
subject.string
|
36
|
-
subject.methods.
|
37
|
-
subject.methods.
|
36
|
+
expect(subject.methods).to include(:string)
|
37
|
+
expect(subject.methods).to include(:string?)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should remove the accessor method if the key is removed from the hash" do
|
41
41
|
subject.string
|
42
|
-
subject.methods.
|
43
|
-
subject.methods.
|
42
|
+
expect(subject.methods).to include(:string)
|
43
|
+
expect(subject.methods).to include(:string?)
|
44
44
|
subject.delete 'string'
|
45
|
-
|
46
|
-
subject.methods.
|
47
|
-
subject.methods.
|
45
|
+
expect { subject.string }.to raise_error(NameError)
|
46
|
+
expect(subject.methods).not_to include(:string)
|
47
|
+
expect(subject.methods).not_to include(:string?)
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should not override existing methods" do
|
51
51
|
subject['inspect'] = 'wrong!'
|
52
|
-
subject.inspect.
|
53
|
-
subject.methods.
|
52
|
+
expect(subject.inspect).not_to eql('wrong!')
|
53
|
+
expect(subject.methods).not_to include(:inspect?)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe "#include?" do
|
58
58
|
it "should accept symbols" do
|
59
|
-
subject.
|
60
|
-
subject.
|
59
|
+
expect(subject).to include(:string)
|
60
|
+
expect(subject).not_to include(:string2)
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should accept strings" do
|
64
|
-
subject.
|
65
|
-
subject.
|
64
|
+
expect(subject).to include('fixnum')
|
65
|
+
expect(subject).not_to include('fixnum2')
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -73,32 +73,32 @@ describe Configoro::Hash do
|
|
73
73
|
subject << { :a => 'b', :b => { :c => 'd' } }
|
74
74
|
subject << { :a => 'b', :b => { :d => 'e' } }
|
75
75
|
|
76
|
-
subject.a.
|
77
|
-
subject.b.c.
|
78
|
-
subject.b.d.
|
76
|
+
expect(subject.a).to eql('b')
|
77
|
+
expect(subject.b.c).to eql('d')
|
78
|
+
expect(subject.b.d).to eql('e')
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should load a YAML file and deep-merge its entries" do
|
82
82
|
subject << "#{File.dirname __FILE__}/../data/config/environments/common/hash_test.yml"
|
83
83
|
subject << "#{File.dirname __FILE__}/../data/config/environments/development/hash_test.yml"
|
84
84
|
|
85
|
-
subject.hash_test.akey.
|
86
|
-
subject.hash_test.subhash.key1.
|
87
|
-
subject.hash_test.subhash.key2.
|
85
|
+
expect(subject.hash_test.akey).to eql('value')
|
86
|
+
expect(subject.hash_test.subhash.key1).to eql('val1')
|
87
|
+
expect(subject.hash_test.subhash.key2).to eql('newval')
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should raise an error if the file is not a YAML file" do
|
91
|
-
|
91
|
+
expect { subject << "example.txt" }.to raise_error(ArgumentError)
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should not change the receiver if the file doesn't exist" do
|
95
95
|
subject << "example.yml"
|
96
|
-
subject.
|
96
|
+
expect(subject).to be_empty
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should preprocess YAML file as ERB" do
|
100
100
|
subject << "#{File.dirname __FILE__}/../data/config/environments/common/erb_test.yml"
|
101
|
-
subject.erb_test.
|
101
|
+
expect(subject.erb_test.sum_test).to eql(2)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -108,15 +108,15 @@ describe Configoro::Hash do
|
|
108
108
|
it "should merge in keys and values" do
|
109
109
|
subject['a'] = 'old'
|
110
110
|
subject.deep_merge! :a => 'new'
|
111
|
-
subject.a.
|
111
|
+
expect(subject.a).to eql('new')
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should deep-merge sub-hashes and convert them to Configoro::Hashes" do
|
115
115
|
subject['hsh'] = { 'key1' => 'val1', 'key2' => 'val2' }
|
116
116
|
subject.deep_merge! :hsh => { 'key2' => 'newval' }
|
117
117
|
|
118
|
-
subject.hsh.key1.
|
119
|
-
subject.hsh.key2.
|
118
|
+
expect(subject.hsh.key1).to eql('val1')
|
119
|
+
expect(subject.hsh.key2).to eql('newval')
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
data/spec/configoro_spec.rb
CHANGED
@@ -7,51 +7,51 @@ describe Configoro do
|
|
7
7
|
|
8
8
|
describe "#initialize" do
|
9
9
|
it "should make the configuration available to MyApp::Configuration" do
|
10
|
-
subject.
|
10
|
+
expect(subject).to be_kind_of(Configoro::Hash)
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should load data from the config files" do
|
14
|
-
subject.basic.common_only.
|
14
|
+
expect(subject.basic.common_only).to eql('common')
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should give priority to environment-specific files" do
|
18
|
-
subject.basic.env_name.
|
18
|
+
expect(subject.basic.env_name).to eql('development')
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should not load data from other environments" do
|
22
|
-
subject.basic['should_not_exist'].
|
22
|
+
expect(subject.basic['should_not_exist']).to be_nil
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should convert hashes recursively" do
|
26
|
-
subject.hash_test.akey.
|
26
|
+
expect(subject.hash_test.akey).to eql('value')
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should deep-merge hashes" do
|
30
|
-
subject.hash_test.subhash.key1.
|
31
|
-
subject.hash_test.subhash.key2.
|
30
|
+
expect(subject.hash_test.subhash.key1).to eql('val1')
|
31
|
+
expect(subject.hash_test.subhash.key2).to eql('newval')
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should not complain when there is no directory for the current environment" do
|
35
|
-
Rails.
|
35
|
+
allow(Rails).to receive(:env).and_return('unknown')
|
36
36
|
Configoro.initialize
|
37
|
-
MyApp::Configuration.
|
37
|
+
expect(MyApp::Configuration).to eql({"basic"=>{"common_only"=>"common", "env_name"=>"common"}, "erb_test" => {"sum_test" => 2}, "hash_test"=>{"akey"=>"value", "subhash"=>{"key1"=>"val1", "key2"=>"val2"}}})
|
38
38
|
end
|
39
39
|
|
40
40
|
context "[custom search paths]" do
|
41
41
|
before(:each) { Configoro.instance_variable_set :@paths, nil }
|
42
42
|
|
43
43
|
it "should use common configuration under a custom search path" do
|
44
|
-
Rails.
|
44
|
+
allow(Rails).to receive(:env).and_return('unknown')
|
45
45
|
Configoro.paths << File.join(File.dirname(__FILE__), 'data', 'other')
|
46
46
|
Configoro.initialize
|
47
|
-
MyApp::Configuration.basic.env_name.
|
47
|
+
expect(MyApp::Configuration.basic.env_name).to eql('other_common')
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should use environment-specific configuration under a custom search path" do
|
51
|
-
Rails.
|
51
|
+
allow(Rails).to receive(:env).and_return('development')
|
52
52
|
Configoro.paths << File.join(File.dirname(__FILE__), 'data', 'other')
|
53
53
|
Configoro.initialize
|
54
|
-
MyApp::Configuration.basic.env_name.
|
54
|
+
expect(MyApp::Configuration.basic.env_name).to eql('other_development')
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
---
|
2
|
-
|
2
|
+
sum_test: <%= 1 + 1 %>
|
data/spec/spec_helper.rb
CHANGED
@@ -15,8 +15,8 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
15
15
|
|
16
16
|
RSpec.configure do |config|
|
17
17
|
config.before :each do
|
18
|
-
application =
|
19
|
-
::Rails =
|
18
|
+
application = double('Rails.application', :class => 'MyApp::Application')
|
19
|
+
::Rails = double('Rails', :application => application, :env => 'development', :root => File.join(File.dirname(__FILE__), 'data'))
|
20
20
|
Configoro.initialize
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,111 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configoro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-its
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: yard
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: redcarpet
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: jeweler
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
description: Creates a YourApp::Configuration object whose methods are generated from
|
@@ -117,10 +131,10 @@ extra_rdoc_files:
|
|
117
131
|
- LICENSE.txt
|
118
132
|
- README.md
|
119
133
|
files:
|
120
|
-
- .document
|
121
|
-
- .rspec
|
122
|
-
- .ruby-gemset
|
123
|
-
- .ruby-version
|
134
|
+
- ".document"
|
135
|
+
- ".rspec"
|
136
|
+
- ".ruby-gemset"
|
137
|
+
- ".ruby-version"
|
124
138
|
- Gemfile
|
125
139
|
- Gemfile.lock
|
126
140
|
- LICENSE.txt
|
@@ -155,17 +169,17 @@ require_paths:
|
|
155
169
|
- lib
|
156
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
157
171
|
requirements:
|
158
|
-
- -
|
172
|
+
- - ">="
|
159
173
|
- !ruby/object:Gem::Version
|
160
174
|
version: '0'
|
161
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
176
|
requirements:
|
163
|
-
- -
|
177
|
+
- - ">="
|
164
178
|
- !ruby/object:Gem::Version
|
165
179
|
version: '0'
|
166
180
|
requirements: []
|
167
181
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.7.5
|
169
183
|
signing_key:
|
170
184
|
specification_version: 4
|
171
185
|
summary: Configuration object and YAML-based storage for Rails apps
|