configoro 1.4.0 → 1.4.2
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 +5 -13
- data/.rspec +2 -1
- data/.ruby-version +1 -1
- data/Gemfile +2 -1
- data/Gemfile.lock +179 -113
- data/README.md +6 -0
- data/Rakefile +7 -9
- data/VERSION +1 -1
- data/configoro.gemspec +79 -67
- data/generators/configoro_generator.rb +4 -4
- data/lib/configoro/base.rb +2 -2
- data/lib/configoro/hash.rb +37 -29
- data/lib/configoro/simple.rb +1 -1
- data/lib/configoro.rb +0 -3
- data/spec/configoro/hash_spec.rb +47 -47
- data/spec/configoro_spec.rb +19 -19
- data/spec/data/config/environments/common/erb_test.yml +1 -1
- data/spec/spec_helper.rb +4 -3
- metadata +55 -36
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: b1854c36e4c9ccc3c9553de62ac889716c66ea41dca713440e2c49ff80202c8a
|
|
4
|
+
data.tar.gz: 2bb06b77da453040f408d14166c15288d607fa7e58a3b96f2637ad73b4d68e24
|
|
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: 14add6d5588645408dcbbfb360850ec33c2887b53d24215ea3a5d8171283d698f7276a842e280e8e504d718ea043d388498b3e05096178bff4a5003c53e3846e
|
|
7
|
+
data.tar.gz: 3036db0e3843e4d1989d5f7bbbd95090ac4f195a7bcc0eea2cf154a1f810793d52f7cdbad4cab96e109ed3770798444a8969f68d7ba98054d41a61991ca4afcf
|
data/.rspec
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
--color
|
|
2
|
+
--format=documentation
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.7.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,126 +1,188 @@
|
|
|
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 (6.0.2.1)
|
|
5
|
+
actionpack (= 6.0.2.1)
|
|
6
|
+
nio4r (~> 2.0)
|
|
7
|
+
websocket-driver (>= 0.6.1)
|
|
8
|
+
actionmailbox (6.0.2.1)
|
|
9
|
+
actionpack (= 6.0.2.1)
|
|
10
|
+
activejob (= 6.0.2.1)
|
|
11
|
+
activerecord (= 6.0.2.1)
|
|
12
|
+
activestorage (= 6.0.2.1)
|
|
13
|
+
activesupport (= 6.0.2.1)
|
|
14
|
+
mail (>= 2.7.1)
|
|
15
|
+
actionmailer (6.0.2.1)
|
|
16
|
+
actionpack (= 6.0.2.1)
|
|
17
|
+
actionview (= 6.0.2.1)
|
|
18
|
+
activejob (= 6.0.2.1)
|
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
|
20
|
+
rails-dom-testing (~> 2.0)
|
|
21
|
+
actionpack (6.0.2.1)
|
|
22
|
+
actionview (= 6.0.2.1)
|
|
23
|
+
activesupport (= 6.0.2.1)
|
|
24
|
+
rack (~> 2.0, >= 2.0.8)
|
|
25
|
+
rack-test (>= 0.6.3)
|
|
26
|
+
rails-dom-testing (~> 2.0)
|
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
28
|
+
actiontext (6.0.2.1)
|
|
29
|
+
actionpack (= 6.0.2.1)
|
|
30
|
+
activerecord (= 6.0.2.1)
|
|
31
|
+
activestorage (= 6.0.2.1)
|
|
32
|
+
activesupport (= 6.0.2.1)
|
|
33
|
+
nokogiri (>= 1.8.5)
|
|
34
|
+
actionview (6.0.2.1)
|
|
35
|
+
activesupport (= 6.0.2.1)
|
|
36
|
+
builder (~> 3.1)
|
|
37
|
+
erubi (~> 1.4)
|
|
38
|
+
rails-dom-testing (~> 2.0)
|
|
39
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
40
|
+
activejob (6.0.2.1)
|
|
41
|
+
activesupport (= 6.0.2.1)
|
|
42
|
+
globalid (>= 0.3.6)
|
|
43
|
+
activemodel (6.0.2.1)
|
|
44
|
+
activesupport (= 6.0.2.1)
|
|
45
|
+
activerecord (6.0.2.1)
|
|
46
|
+
activemodel (= 6.0.2.1)
|
|
47
|
+
activesupport (= 6.0.2.1)
|
|
48
|
+
activestorage (6.0.2.1)
|
|
49
|
+
actionpack (= 6.0.2.1)
|
|
50
|
+
activejob (= 6.0.2.1)
|
|
51
|
+
activerecord (= 6.0.2.1)
|
|
52
|
+
marcel (~> 0.3.1)
|
|
53
|
+
activesupport (6.0.2.1)
|
|
54
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
55
|
+
i18n (>= 0.7, < 2)
|
|
56
|
+
minitest (~> 5.1)
|
|
57
|
+
tzinfo (~> 1.1)
|
|
58
|
+
zeitwerk (~> 2.2)
|
|
59
|
+
addressable (2.4.0)
|
|
60
|
+
builder (3.2.4)
|
|
61
|
+
concurrent-ruby (1.1.5)
|
|
62
|
+
crass (1.0.5)
|
|
63
|
+
descendants_tracker (0.0.4)
|
|
64
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
65
|
+
diff-lcs (1.3)
|
|
66
|
+
erubi (1.9.0)
|
|
67
|
+
faraday (0.9.2)
|
|
68
|
+
multipart-post (>= 1.2, < 3)
|
|
69
|
+
git (1.5.0)
|
|
70
|
+
github_api (0.16.0)
|
|
71
|
+
addressable (~> 2.4.0)
|
|
72
|
+
descendants_tracker (~> 0.0.4)
|
|
73
|
+
faraday (~> 0.8, < 0.10)
|
|
74
|
+
hashie (>= 3.4)
|
|
75
|
+
mime-types (>= 1.16, < 3.0)
|
|
76
|
+
oauth2 (~> 1.0)
|
|
77
|
+
globalid (0.4.2)
|
|
78
|
+
activesupport (>= 4.2.0)
|
|
79
|
+
hashie (4.0.0)
|
|
80
|
+
highline (2.0.3)
|
|
81
|
+
i18n (1.7.0)
|
|
82
|
+
concurrent-ruby (~> 1.0)
|
|
83
|
+
jeweler (2.3.9)
|
|
50
84
|
builder
|
|
51
|
-
bundler
|
|
85
|
+
bundler
|
|
52
86
|
git (>= 1.2.5)
|
|
53
|
-
github_api (
|
|
87
|
+
github_api (~> 0.16.0)
|
|
54
88
|
highline (>= 1.6.15)
|
|
55
|
-
nokogiri (
|
|
89
|
+
nokogiri (>= 1.5.10)
|
|
90
|
+
psych
|
|
56
91
|
rake
|
|
57
92
|
rdoc
|
|
58
|
-
|
|
59
|
-
jwt (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
93
|
+
semver2
|
|
94
|
+
jwt (2.2.1)
|
|
95
|
+
loofah (2.4.0)
|
|
96
|
+
crass (~> 1.0.2)
|
|
97
|
+
nokogiri (>= 1.5.9)
|
|
98
|
+
mail (2.7.1)
|
|
99
|
+
mini_mime (>= 0.1.1)
|
|
100
|
+
marcel (0.3.3)
|
|
101
|
+
mimemagic (~> 0.3.2)
|
|
102
|
+
method_source (0.9.2)
|
|
103
|
+
mime-types (2.99.3)
|
|
104
|
+
mimemagic (0.3.3)
|
|
105
|
+
mini_mime (1.0.2)
|
|
106
|
+
mini_portile2 (2.4.0)
|
|
107
|
+
minitest (5.13.0)
|
|
108
|
+
multi_json (1.14.1)
|
|
109
|
+
multi_xml (0.6.0)
|
|
110
|
+
multipart-post (2.1.1)
|
|
111
|
+
nio4r (2.5.2)
|
|
112
|
+
nokogiri (1.10.7)
|
|
113
|
+
mini_portile2 (~> 2.4.0)
|
|
114
|
+
oauth2 (1.4.2)
|
|
115
|
+
faraday (>= 0.8, < 2.0)
|
|
116
|
+
jwt (>= 1.0, < 3.0)
|
|
117
|
+
multi_json (~> 1.3)
|
|
75
118
|
multi_xml (~> 0.5)
|
|
76
|
-
rack (
|
|
77
|
-
|
|
78
|
-
rack (
|
|
79
|
-
rack-test (
|
|
80
|
-
rack (>= 1.0)
|
|
81
|
-
rails (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
119
|
+
rack (>= 1.2, < 3)
|
|
120
|
+
psych (3.1.0)
|
|
121
|
+
rack (2.0.8)
|
|
122
|
+
rack-test (1.1.0)
|
|
123
|
+
rack (>= 1.0, < 3)
|
|
124
|
+
rails (6.0.2.1)
|
|
125
|
+
actioncable (= 6.0.2.1)
|
|
126
|
+
actionmailbox (= 6.0.2.1)
|
|
127
|
+
actionmailer (= 6.0.2.1)
|
|
128
|
+
actionpack (= 6.0.2.1)
|
|
129
|
+
actiontext (= 6.0.2.1)
|
|
130
|
+
actionview (= 6.0.2.1)
|
|
131
|
+
activejob (= 6.0.2.1)
|
|
132
|
+
activemodel (= 6.0.2.1)
|
|
133
|
+
activerecord (= 6.0.2.1)
|
|
134
|
+
activestorage (= 6.0.2.1)
|
|
135
|
+
activesupport (= 6.0.2.1)
|
|
136
|
+
bundler (>= 1.3.0)
|
|
137
|
+
railties (= 6.0.2.1)
|
|
138
|
+
sprockets-rails (>= 2.0.0)
|
|
139
|
+
rails-dom-testing (2.0.3)
|
|
140
|
+
activesupport (>= 4.2.0)
|
|
141
|
+
nokogiri (>= 1.6)
|
|
142
|
+
rails-html-sanitizer (1.3.0)
|
|
143
|
+
loofah (~> 2.3)
|
|
144
|
+
railties (6.0.2.1)
|
|
145
|
+
actionpack (= 6.0.2.1)
|
|
146
|
+
activesupport (= 6.0.2.1)
|
|
147
|
+
method_source
|
|
92
148
|
rake (>= 0.8.7)
|
|
93
|
-
thor (>= 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
|
-
|
|
149
|
+
thor (>= 0.20.3, < 2.0)
|
|
150
|
+
rake (13.0.1)
|
|
151
|
+
rdoc (6.2.1)
|
|
152
|
+
redcarpet (3.5.0)
|
|
153
|
+
rspec (3.9.0)
|
|
154
|
+
rspec-core (~> 3.9.0)
|
|
155
|
+
rspec-expectations (~> 3.9.0)
|
|
156
|
+
rspec-mocks (~> 3.9.0)
|
|
157
|
+
rspec-core (3.9.0)
|
|
158
|
+
rspec-support (~> 3.9.0)
|
|
159
|
+
rspec-expectations (3.9.0)
|
|
160
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
161
|
+
rspec-support (~> 3.9.0)
|
|
162
|
+
rspec-its (1.3.0)
|
|
163
|
+
rspec-core (>= 3.0.0)
|
|
164
|
+
rspec-expectations (>= 3.0.0)
|
|
165
|
+
rspec-mocks (3.9.0)
|
|
166
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
167
|
+
rspec-support (~> 3.9.0)
|
|
168
|
+
rspec-support (3.9.0)
|
|
169
|
+
semver2 (3.4.2)
|
|
170
|
+
sprockets (4.0.0)
|
|
171
|
+
concurrent-ruby (~> 1.0)
|
|
172
|
+
rack (> 1, < 3)
|
|
173
|
+
sprockets-rails (3.2.1)
|
|
174
|
+
actionpack (>= 4.0)
|
|
175
|
+
activesupport (>= 4.0)
|
|
176
|
+
sprockets (>= 3.0.0)
|
|
177
|
+
thor (1.0.1)
|
|
178
|
+
thread_safe (0.3.6)
|
|
179
|
+
tzinfo (1.2.6)
|
|
180
|
+
thread_safe (~> 0.1)
|
|
181
|
+
websocket-driver (0.7.1)
|
|
182
|
+
websocket-extensions (>= 0.1.0)
|
|
183
|
+
websocket-extensions (0.1.4)
|
|
184
|
+
yard (0.9.20)
|
|
185
|
+
zeitwerk (2.2.2)
|
|
124
186
|
|
|
125
187
|
PLATFORMS
|
|
126
188
|
ruby
|
|
@@ -132,4 +194,8 @@ DEPENDENCIES
|
|
|
132
194
|
rails (>= 4.0)
|
|
133
195
|
redcarpet
|
|
134
196
|
rspec
|
|
197
|
+
rspec-its
|
|
135
198
|
yard
|
|
199
|
+
|
|
200
|
+
BUNDLED WITH
|
|
201
|
+
2.1.2
|
data/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## ⚠️ DEPRECATED
|
|
2
|
+
|
|
3
|
+
**This gem is no longer maintained.** Consider [`anyway_config`](https://github.com/palkan/anyway_config), [`dry-configurable`](https://dry-rb.org/gems/dry-configurable/), or modern Rails credentials (`config/credentials`) for application configuration.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
Configoro
|
|
2
8
|
=========
|
|
3
9
|
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
1
|
require 'rubygems'
|
|
4
2
|
|
|
5
3
|
#################################### BUNDLER ###################################
|
|
@@ -8,8 +6,8 @@ require 'bundler'
|
|
|
8
6
|
begin
|
|
9
7
|
Bundler.setup(:default, :development)
|
|
10
8
|
rescue Bundler::BundlerError => e
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
warn e.message
|
|
10
|
+
warn "Run `bundle install` to install missing gems"
|
|
13
11
|
exit e.status_code
|
|
14
12
|
end
|
|
15
13
|
require 'rake'
|
|
@@ -22,8 +20,8 @@ Jeweler::Tasks.new do |gem|
|
|
|
22
20
|
gem.name = 'configoro'
|
|
23
21
|
gem.homepage = 'http://github.com/RISCfuture/configoro'
|
|
24
22
|
gem.license = 'MIT'
|
|
25
|
-
gem.summary = %
|
|
26
|
-
gem.description = %
|
|
23
|
+
gem.summary = %(Configuration object and YAML-based storage for Rails apps)
|
|
24
|
+
gem.description = %(Creates a YourApp::Configuration object whose methods are generated from environment-specific YAML files.)
|
|
27
25
|
gem.email = 'git@timothymorgan.info'
|
|
28
26
|
gem.authors = ['Tim Morgan']
|
|
29
27
|
# dependencies defined in Gemfile
|
|
@@ -38,7 +36,7 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
|
38
36
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
39
37
|
end
|
|
40
38
|
|
|
41
|
-
task :
|
|
39
|
+
task default: :spec
|
|
42
40
|
|
|
43
41
|
##################################### YARD #####################################
|
|
44
42
|
|
|
@@ -52,8 +50,8 @@ YARD::Rake::YardocTask.new do |doc|
|
|
|
52
50
|
doc.options << '-o' << 'doc'
|
|
53
51
|
doc.options << '--title' << 'Configoro Documentation'
|
|
54
52
|
|
|
55
|
-
doc.files = %w
|
|
53
|
+
doc.files = %w[lib/**/* README.md]
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
desc "Generate API documentation"
|
|
59
|
-
task :
|
|
57
|
+
task doc: :yard
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.4.
|
|
1
|
+
1.4.2
|
data/configoro.gemspec
CHANGED
|
@@ -2,85 +2,97 @@
|
|
|
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
|
-
|
|
5
|
+
|
|
6
|
+
# stub: configoro 1.4.1 ruby lib
|
|
6
7
|
|
|
7
8
|
Gem::Specification.new do |s|
|
|
8
|
-
s.name = "configoro"
|
|
9
|
-
s.version = "1.4.
|
|
9
|
+
s.name = "configoro".freeze
|
|
10
|
+
s.version = "1.4.2"
|
|
10
11
|
|
|
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"
|
|
12
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
13
|
+
s.require_paths = ["lib".freeze]
|
|
14
|
+
s.authors = ["Tim Morgan".freeze]
|
|
15
|
+
s.date = "2018-02-07"
|
|
16
|
+
s.description = "Creates a YourApp::Configuration object whose methods are generated from environment-specific YAML files.".freeze
|
|
17
|
+
s.email = "git@timothymorgan.info".freeze
|
|
17
18
|
s.extra_rdoc_files = [
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
"LICENSE.txt",
|
|
20
|
+
"README.md"
|
|
20
21
|
]
|
|
21
22
|
s.files = [
|
|
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
|
-
|
|
23
|
+
".document",
|
|
24
|
+
".rspec",
|
|
25
|
+
".ruby-gemset",
|
|
26
|
+
".ruby-version",
|
|
27
|
+
"Gemfile",
|
|
28
|
+
"Gemfile.lock",
|
|
29
|
+
"LICENSE.txt",
|
|
30
|
+
"README.md",
|
|
31
|
+
"Rakefile",
|
|
32
|
+
"VERSION",
|
|
33
|
+
"configoro.gemspec",
|
|
34
|
+
"generators/configoro_generator.rb",
|
|
35
|
+
"lib/configoro.rb",
|
|
36
|
+
"lib/configoro/base.rb",
|
|
37
|
+
"lib/configoro/hash.rb",
|
|
38
|
+
"lib/configoro/railtie.rb",
|
|
39
|
+
"lib/configoro/simple.rb",
|
|
40
|
+
"spec/configoro/hash_spec.rb",
|
|
41
|
+
"spec/configoro_spec.rb",
|
|
42
|
+
"spec/data/config/environments/common/basic.yml",
|
|
43
|
+
"spec/data/config/environments/common/erb_test.yml",
|
|
44
|
+
"spec/data/config/environments/common/hash_test.yml",
|
|
45
|
+
"spec/data/config/environments/development/basic.yml",
|
|
46
|
+
"spec/data/config/environments/development/hash_test.yml",
|
|
47
|
+
"spec/data/config/environments/production/basic.yml",
|
|
48
|
+
"spec/data/other/common/basic.yml",
|
|
49
|
+
"spec/data/other/development/basic.yml",
|
|
50
|
+
"spec/spec_helper.rb"
|
|
50
51
|
]
|
|
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"
|
|
52
|
+
s.homepage = "http://github.com/RISCfuture/configoro".freeze
|
|
53
|
+
s.licenses = ["MIT".freeze]
|
|
54
|
+
s.rubygems_version = "2.7.5".freeze
|
|
55
|
+
s.summary = "[DEPRECATED] Configuration object and YAML-based storage for Rails apps".freeze
|
|
56
|
+
s.post_install_message = <<~MSG
|
|
57
|
+
|
|
58
|
+
⚠️ DEPRECATED: configoro is no longer maintained.
|
|
59
|
+
|
|
60
|
+
Consider `anyway_config`, `dry-configurable`, or modern Rails credentials (`config/credentials`) for application configuration.
|
|
55
61
|
|
|
56
|
-
|
|
62
|
+
This is the final release. No further updates are planned.
|
|
63
|
+
|
|
64
|
+
MSG
|
|
65
|
+
|
|
66
|
+
if s.respond_to? :specification_version
|
|
57
67
|
s.specification_version = 4
|
|
58
68
|
|
|
59
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0')
|
|
60
|
-
s.add_runtime_dependency(
|
|
61
|
-
s.add_development_dependency(
|
|
62
|
-
s.add_development_dependency(
|
|
63
|
-
s.add_development_dependency(
|
|
64
|
-
s.add_development_dependency(
|
|
65
|
-
s.add_development_dependency(
|
|
66
|
-
s.add_development_dependency(
|
|
69
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0')
|
|
70
|
+
s.add_runtime_dependency('activesupport'.freeze, [">= 0"])
|
|
71
|
+
s.add_development_dependency('bundler'.freeze, [">= 0"])
|
|
72
|
+
s.add_development_dependency('jeweler'.freeze, [">= 0"])
|
|
73
|
+
s.add_development_dependency('rails'.freeze, [">= 4.0"])
|
|
74
|
+
s.add_development_dependency('redcarpet'.freeze, [">= 0"])
|
|
75
|
+
s.add_development_dependency('rspec'.freeze, [">= 0"])
|
|
76
|
+
s.add_development_dependency('rspec-its'.freeze, [">= 0"])
|
|
77
|
+
s.add_development_dependency('yard'.freeze, [">= 0"])
|
|
67
78
|
else
|
|
68
|
-
s.add_dependency(
|
|
69
|
-
s.add_dependency(
|
|
70
|
-
s.add_dependency(
|
|
71
|
-
s.add_dependency(
|
|
72
|
-
s.add_dependency(
|
|
73
|
-
s.add_dependency(
|
|
74
|
-
s.add_dependency(
|
|
79
|
+
s.add_dependency('activesupport'.freeze, [">= 0"])
|
|
80
|
+
s.add_dependency('bundler'.freeze, [">= 0"])
|
|
81
|
+
s.add_dependency('jeweler'.freeze, [">= 0"])
|
|
82
|
+
s.add_dependency('rails'.freeze, [">= 4.0"])
|
|
83
|
+
s.add_dependency('redcarpet'.freeze, [">= 0"])
|
|
84
|
+
s.add_dependency('rspec'.freeze, [">= 0"])
|
|
85
|
+
s.add_dependency('rspec-its'.freeze, [">= 0"])
|
|
86
|
+
s.add_dependency('yard'.freeze, [">= 0"])
|
|
75
87
|
end
|
|
76
88
|
else
|
|
77
|
-
s.add_dependency(
|
|
78
|
-
s.add_dependency(
|
|
79
|
-
s.add_dependency(
|
|
80
|
-
s.add_dependency(
|
|
81
|
-
s.add_dependency(
|
|
82
|
-
s.add_dependency(
|
|
83
|
-
s.add_dependency(
|
|
89
|
+
s.add_dependency('activesupport'.freeze, [">= 0"])
|
|
90
|
+
s.add_dependency('rails'.freeze, [">= 4.0"])
|
|
91
|
+
s.add_dependency('rspec'.freeze, [">= 0"])
|
|
92
|
+
s.add_dependency('rspec-its'.freeze, [">= 0"])
|
|
93
|
+
s.add_dependency('yard'.freeze, [">= 0"])
|
|
94
|
+
s.add_dependency('yard'.freeze, [">= 0"])
|
|
95
|
+
s.add_dependency('yard'.freeze, [">= 0"])
|
|
96
|
+
s.add_dependency('yard'.freeze, [">= 0"])
|
|
84
97
|
end
|
|
85
98
|
end
|
|
86
|
-
|
|
@@ -6,12 +6,12 @@ class ConfigoroGenerator < Rails::Generators::Base
|
|
|
6
6
|
|
|
7
7
|
def create_yaml_files
|
|
8
8
|
create_file "config/environments/common/example.yml",
|
|
9
|
-
{
|
|
9
|
+
{'common_setting' => true}.to_yaml
|
|
10
10
|
create_file "config/environments/development/example.yml",
|
|
11
|
-
{
|
|
11
|
+
{'environment_name' => 'Development'}.to_yaml
|
|
12
12
|
create_file "config/environments/test/example.yml",
|
|
13
|
-
{
|
|
13
|
+
{'environment_name' => 'Test'}.to_yaml
|
|
14
14
|
create_file "config/environments/production/example.yml",
|
|
15
|
-
{
|
|
15
|
+
{'environment_name' => 'Production'}.to_yaml
|
|
16
16
|
end
|
|
17
17
|
end
|
data/lib/configoro/base.rb
CHANGED
|
@@ -58,11 +58,10 @@ module Configoro
|
|
|
58
58
|
config
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
private
|
|
62
|
-
|
|
63
61
|
def self.namespace
|
|
64
62
|
Object.const_get Rails.application.class.to_s.split('::').first
|
|
65
63
|
end
|
|
64
|
+
private_class_method :namespace
|
|
66
65
|
|
|
67
66
|
def self.load_data(config, env)
|
|
68
67
|
paths.each do |path|
|
|
@@ -70,4 +69,5 @@ module Configoro
|
|
|
70
69
|
Dir.glob("#{path}/#{env}/*.yml").sort.each { |file| config << file }
|
|
71
70
|
end
|
|
72
71
|
end
|
|
72
|
+
private_class_method :load_data
|
|
73
73
|
end
|
data/lib/configoro/hash.rb
CHANGED
|
@@ -3,7 +3,7 @@ module Configoro
|
|
|
3
3
|
|
|
4
4
|
# @private
|
|
5
5
|
def initialize(hsh={})
|
|
6
|
-
if hsh.kind_of?(::Hash)
|
|
6
|
+
if hsh.kind_of?(::Hash)
|
|
7
7
|
super()
|
|
8
8
|
update hsh
|
|
9
9
|
else
|
|
@@ -28,6 +28,7 @@ module Configoro
|
|
|
28
28
|
when String
|
|
29
29
|
raise ArgumentError, "Only files ending in .yml can be added" unless File.extname(hsh_or_path) == '.yml'
|
|
30
30
|
return self unless File.exist?(hsh_or_path)
|
|
31
|
+
|
|
31
32
|
data = load_preprocessed_yaml(hsh_or_path)
|
|
32
33
|
deep_merge! File.basename(hsh_or_path, ".yml") => data
|
|
33
34
|
when ::Hash
|
|
@@ -35,7 +36,7 @@ module Configoro
|
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
alias push <<
|
|
39
40
|
|
|
40
41
|
# @private
|
|
41
42
|
def dup
|
|
@@ -51,8 +52,8 @@ module Configoro
|
|
|
51
52
|
def deep_merge!(other_hash)
|
|
52
53
|
other_hash.each_pair do |k, v|
|
|
53
54
|
tv = self[k]
|
|
54
|
-
self[k] = if v.kind_of?(::Hash)
|
|
55
|
-
if tv.kind_of?(::Hash)
|
|
55
|
+
self[k] = if v.kind_of?(::Hash)
|
|
56
|
+
if tv.kind_of?(::Hash)
|
|
56
57
|
Configoro::Hash.new(tv).deep_merge!(v)
|
|
57
58
|
else
|
|
58
59
|
Configoro::Hash.new(v)
|
|
@@ -71,14 +72,14 @@ module Configoro
|
|
|
71
72
|
# be removed.
|
|
72
73
|
|
|
73
74
|
def method_missing(meth, *args)
|
|
74
|
-
if include?(meth.to_s)
|
|
75
|
-
if args.empty?
|
|
75
|
+
if include?(meth.to_s)
|
|
76
|
+
if args.empty?
|
|
76
77
|
create_getter meth
|
|
77
78
|
else
|
|
78
79
|
raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
|
|
79
80
|
end
|
|
80
|
-
elsif meth.to_s
|
|
81
|
-
if args.empty?
|
|
81
|
+
elsif meth.to_s =~/^(.+)\?$/ && include?((root_meth = Regexp.last_match(1)))
|
|
82
|
+
if args.empty?
|
|
82
83
|
!!create_getter(root_meth) #TODO duplication of logic
|
|
83
84
|
else
|
|
84
85
|
raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
|
|
@@ -88,40 +89,47 @@ module Configoro
|
|
|
88
89
|
end
|
|
89
90
|
end
|
|
90
91
|
|
|
92
|
+
# @private
|
|
93
|
+
def respond_to_missing?(meth, *args)
|
|
94
|
+
include?(meth.to_s) ||
|
|
95
|
+
(meth.to_s =~ /^(.+)\?$/ && include?(Regexp.last_match(1))) ||
|
|
96
|
+
super(meth, *args)
|
|
97
|
+
end
|
|
98
|
+
|
|
91
99
|
# @private
|
|
92
100
|
def inspect
|
|
93
|
-
"#{to_hash.inspect}:#{self.class
|
|
101
|
+
"#{to_hash.inspect}:#{self.class}"
|
|
94
102
|
end
|
|
95
103
|
|
|
96
104
|
def to_symbolized_hash
|
|
97
|
-
|
|
98
|
-
case value
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
hsh
|
|
105
|
+
each_with_object({}) do |(key, value), hsh|
|
|
106
|
+
hsh[key.to_sym] = case value
|
|
107
|
+
when Configoro::Hash
|
|
108
|
+
value.to_symbolized_hash
|
|
109
|
+
else
|
|
110
|
+
value
|
|
111
|
+
end
|
|
105
112
|
end
|
|
106
113
|
end
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
# @private
|
|
110
116
|
def self.new_from_hash_copying_default(hash)
|
|
111
117
|
Configoro::Hash.new(hash).tap do |new_hash|
|
|
112
118
|
new_hash.default = hash.default
|
|
113
119
|
end
|
|
114
120
|
end
|
|
115
121
|
|
|
122
|
+
protected
|
|
123
|
+
|
|
116
124
|
def convert_value(value, options={})
|
|
117
|
-
if value.
|
|
125
|
+
if value.kind_of? ::Hash
|
|
118
126
|
if options[:for] == :to_hash
|
|
119
127
|
value.to_hash
|
|
120
128
|
else
|
|
121
129
|
#value.nested_under_indifferent_access
|
|
122
130
|
self.class.new_from_hash_copying_default(value)
|
|
123
131
|
end
|
|
124
|
-
elsif value.
|
|
132
|
+
elsif value.kind_of?(Array)
|
|
125
133
|
unless options[:for] == :assignment
|
|
126
134
|
value = value.dup
|
|
127
135
|
end
|
|
@@ -135,7 +143,7 @@ module Configoro
|
|
|
135
143
|
|
|
136
144
|
def create_getter(meth)
|
|
137
145
|
singleton_class.send(:define_method, meth) do
|
|
138
|
-
if include?(meth.to_s)
|
|
146
|
+
if include?(meth.to_s)
|
|
139
147
|
self[meth.to_s]
|
|
140
148
|
else
|
|
141
149
|
remove_getter meth
|
|
@@ -143,7 +151,7 @@ module Configoro
|
|
|
143
151
|
end
|
|
144
152
|
|
|
145
153
|
singleton_class.send(:define_method, :"#{meth}?") do
|
|
146
|
-
if include?(meth.to_s)
|
|
154
|
+
if include?(meth.to_s)
|
|
147
155
|
!!self[meth.to_s]
|
|
148
156
|
else
|
|
149
157
|
remove_getter meth
|
|
@@ -154,19 +162,19 @@ module Configoro
|
|
|
154
162
|
end
|
|
155
163
|
|
|
156
164
|
def remove_getter(meth)
|
|
157
|
-
if methods.include?(meth.to_sym)
|
|
158
|
-
instance_eval "undef #{meth.to_sym.inspect}"
|
|
165
|
+
if methods.include?(meth.to_sym)
|
|
166
|
+
instance_eval "undef #{meth.to_sym.inspect}", __FILE__, __LINE__
|
|
159
167
|
end
|
|
160
168
|
|
|
161
|
-
if methods.include?(:"#{meth}?")
|
|
162
|
-
instance_eval "undef #{:"#{meth}?".inspect}"
|
|
169
|
+
if methods.include?(:"#{meth}?")
|
|
170
|
+
instance_eval "undef #{:"#{meth}?".inspect}", __FILE__, __LINE__
|
|
163
171
|
end
|
|
164
172
|
|
|
165
|
-
raise NameError, "undefined local variable or method `#{meth}' for #{
|
|
173
|
+
raise NameError, "undefined local variable or method `#{meth}' for #{inspect}"
|
|
166
174
|
end
|
|
167
175
|
|
|
168
176
|
def load_preprocessed_yaml(path)
|
|
169
|
-
YAML.
|
|
177
|
+
YAML.safe_load(ERB.new(IO.read(path)).result, [Symbol])
|
|
170
178
|
end
|
|
171
179
|
end
|
|
172
180
|
end
|
data/lib/configoro/simple.rb
CHANGED
|
@@ -14,7 +14,7 @@ class Configoro::HashWithIndifferentAccess < ::Hash
|
|
|
14
14
|
def deep_merge!(other_hash)
|
|
15
15
|
other_hash.each_pair do |k, v|
|
|
16
16
|
tv = self[k]
|
|
17
|
-
self[k] = tv.
|
|
17
|
+
self[k] = (tv.kind_of?(Hash) && v.kind_of?(Hash)) ? tv.deep_merge(v) : v
|
|
18
18
|
end
|
|
19
19
|
self
|
|
20
20
|
end
|
data/lib/configoro.rb
CHANGED
data/spec/configoro/hash_spec.rb
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Configoro::Hash do
|
|
4
|
-
subject {
|
|
4
|
+
subject { described_class.new(string: 'value', fixnum: 123, hash: {foo: 'bar'}, array: [1, 2, 3], nilval: nil) }
|
|
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 be(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 be(true)
|
|
22
|
+
expect(subject.string?).to be(true)
|
|
23
|
+
expect(subject.nilval?).to be(false)
|
|
24
|
+
expect(subject.nilval?).to be(false)
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
# We try the above methods twice: Once for creating the method, the other
|
|
28
28
|
# for accessing it
|
|
29
29
|
end
|
|
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
|
|
|
69
69
|
describe "#<<" do
|
|
70
|
-
subject {
|
|
70
|
+
subject { described_class.new }
|
|
71
71
|
|
|
72
72
|
it "should deep-merge entries from a hash" do
|
|
73
|
-
subject << {
|
|
74
|
-
subject << {
|
|
73
|
+
subject << {a: 'b', b: {c: 'd'}}
|
|
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 be(2)
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
describe "#deep_merge!" do
|
|
106
|
-
subject {
|
|
106
|
+
subject { described_class.new }
|
|
107
107
|
|
|
108
108
|
it "should merge in keys and values" do
|
|
109
109
|
subject['a'] = 'old'
|
|
110
|
-
subject.deep_merge! :
|
|
111
|
-
subject.a.
|
|
110
|
+
subject.deep_merge! a: 'new'
|
|
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
|
-
subject['hsh'] = {
|
|
116
|
-
subject.deep_merge! :
|
|
115
|
+
subject['hsh'] = {'key1' => 'val1', 'key2' => 'val2'}
|
|
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
|
|
|
123
123
|
describe "#to_symbolized_hash" do
|
|
124
|
-
subject {
|
|
124
|
+
subject { described_class.new(foo: {bar: 'baz'}) }
|
|
125
125
|
|
|
126
|
-
its(:to_symbolized_hash) {
|
|
126
|
+
its(:to_symbolized_hash) { is_expected.to eql(foo: {bar: 'baz'}) }
|
|
127
127
|
end
|
|
128
128
|
end
|
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.
|
|
36
|
-
|
|
37
|
-
MyApp::Configuration.
|
|
35
|
+
allow(Rails).to receive(:env).and_return('unknown')
|
|
36
|
+
described_class.initialize
|
|
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
|
-
before(:each) {
|
|
41
|
+
before(:each) { described_class.instance_variable_set :@paths, nil }
|
|
42
42
|
|
|
43
43
|
it "should use common configuration under a custom search path" do
|
|
44
|
-
Rails.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
MyApp::Configuration.basic.env_name.
|
|
44
|
+
allow(Rails).to receive(:env).and_return('unknown')
|
|
45
|
+
described_class.paths << File.join(File.dirname(__FILE__), 'data', 'other')
|
|
46
|
+
described_class.initialize
|
|
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.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
MyApp::Configuration.basic.env_name.
|
|
51
|
+
allow(Rails).to receive(:env).and_return('development')
|
|
52
|
+
described_class.paths << File.join(File.dirname(__FILE__), 'data', 'other')
|
|
53
|
+
described_class.initialize
|
|
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
|
@@ -11,12 +11,13 @@ require 'configoro'
|
|
|
11
11
|
|
|
12
12
|
# Requires supporting files with custom matchers and macros, etc,
|
|
13
13
|
# in ./support/ and its subdirectories.
|
|
14
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
|
15
15
|
|
|
16
16
|
RSpec.configure do |config|
|
|
17
17
|
config.before :each do
|
|
18
|
-
application =
|
|
19
|
-
|
|
18
|
+
application = instance_double('Rails::Application', class: 'MyApp::Application')
|
|
19
|
+
Object.send :remove_const, :Rails
|
|
20
|
+
::Rails = class_double('Rails', application: application, env: 'development', root: File.join(File.dirname(__FILE__), 'data'))
|
|
20
21
|
Configoro.initialize
|
|
21
22
|
end
|
|
22
23
|
end
|
metadata
CHANGED
|
@@ -1,111 +1,124 @@
|
|
|
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.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Morgan
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- -
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
18
|
version: '0'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
|
-
- -
|
|
23
|
+
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: bundler
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- -
|
|
30
|
+
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
32
|
+
version: '0'
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- -
|
|
37
|
+
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
39
|
+
version: '0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
41
|
+
name: jeweler
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
|
-
- -
|
|
44
|
+
- - ">="
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
46
|
version: '0'
|
|
48
47
|
type: :development
|
|
49
48
|
prerelease: false
|
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
|
-
- -
|
|
51
|
+
- - ">="
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
53
|
version: '0'
|
|
55
54
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
55
|
+
name: rails
|
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
|
58
57
|
requirements:
|
|
59
|
-
- -
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '4.0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '4.0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: redcarpet
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
60
73
|
- !ruby/object:Gem::Version
|
|
61
74
|
version: '0'
|
|
62
75
|
type: :development
|
|
63
76
|
prerelease: false
|
|
64
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
78
|
requirements:
|
|
66
|
-
- -
|
|
79
|
+
- - ">="
|
|
67
80
|
- !ruby/object:Gem::Version
|
|
68
81
|
version: '0'
|
|
69
82
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
83
|
+
name: rspec
|
|
71
84
|
requirement: !ruby/object:Gem::Requirement
|
|
72
85
|
requirements:
|
|
73
|
-
- -
|
|
86
|
+
- - ">="
|
|
74
87
|
- !ruby/object:Gem::Version
|
|
75
88
|
version: '0'
|
|
76
89
|
type: :development
|
|
77
90
|
prerelease: false
|
|
78
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
92
|
requirements:
|
|
80
|
-
- -
|
|
93
|
+
- - ">="
|
|
81
94
|
- !ruby/object:Gem::Version
|
|
82
95
|
version: '0'
|
|
83
96
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
97
|
+
name: rspec-its
|
|
85
98
|
requirement: !ruby/object:Gem::Requirement
|
|
86
99
|
requirements:
|
|
87
|
-
- -
|
|
100
|
+
- - ">="
|
|
88
101
|
- !ruby/object:Gem::Version
|
|
89
102
|
version: '0'
|
|
90
103
|
type: :development
|
|
91
104
|
prerelease: false
|
|
92
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
106
|
requirements:
|
|
94
|
-
- -
|
|
107
|
+
- - ">="
|
|
95
108
|
- !ruby/object:Gem::Version
|
|
96
109
|
version: '0'
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
111
|
+
name: yard
|
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
|
100
113
|
requirements:
|
|
101
|
-
- -
|
|
114
|
+
- - ">="
|
|
102
115
|
- !ruby/object:Gem::Version
|
|
103
116
|
version: '0'
|
|
104
117
|
type: :development
|
|
105
118
|
prerelease: false
|
|
106
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
120
|
requirements:
|
|
108
|
-
- -
|
|
121
|
+
- - ">="
|
|
109
122
|
- !ruby/object:Gem::Version
|
|
110
123
|
version: '0'
|
|
111
124
|
description: Creates a YourApp::Configuration object whose methods are generated from
|
|
@@ -117,10 +130,10 @@ extra_rdoc_files:
|
|
|
117
130
|
- LICENSE.txt
|
|
118
131
|
- README.md
|
|
119
132
|
files:
|
|
120
|
-
- .document
|
|
121
|
-
- .rspec
|
|
122
|
-
- .ruby-gemset
|
|
123
|
-
- .ruby-version
|
|
133
|
+
- ".document"
|
|
134
|
+
- ".rspec"
|
|
135
|
+
- ".ruby-gemset"
|
|
136
|
+
- ".ruby-version"
|
|
124
137
|
- Gemfile
|
|
125
138
|
- Gemfile.lock
|
|
126
139
|
- LICENSE.txt
|
|
@@ -149,24 +162,30 @@ homepage: http://github.com/RISCfuture/configoro
|
|
|
149
162
|
licenses:
|
|
150
163
|
- MIT
|
|
151
164
|
metadata: {}
|
|
152
|
-
post_install_message:
|
|
165
|
+
post_install_message: |2+
|
|
166
|
+
|
|
167
|
+
⚠️ DEPRECATED: configoro is no longer maintained.
|
|
168
|
+
|
|
169
|
+
Consider `anyway_config`, `dry-configurable`, or modern Rails credentials (`config/credentials`) for application configuration.
|
|
170
|
+
|
|
171
|
+
This is the final release. No further updates are planned.
|
|
172
|
+
|
|
153
173
|
rdoc_options: []
|
|
154
174
|
require_paths:
|
|
155
175
|
- lib
|
|
156
176
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
177
|
requirements:
|
|
158
|
-
- -
|
|
178
|
+
- - ">="
|
|
159
179
|
- !ruby/object:Gem::Version
|
|
160
180
|
version: '0'
|
|
161
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
182
|
requirements:
|
|
163
|
-
- -
|
|
183
|
+
- - ">="
|
|
164
184
|
- !ruby/object:Gem::Version
|
|
165
185
|
version: '0'
|
|
166
186
|
requirements: []
|
|
167
|
-
|
|
168
|
-
rubygems_version: 2.2.2
|
|
169
|
-
signing_key:
|
|
187
|
+
rubygems_version: 4.0.11
|
|
170
188
|
specification_version: 4
|
|
171
|
-
summary: Configuration object and YAML-based storage for Rails apps
|
|
189
|
+
summary: "[DEPRECATED] Configuration object and YAML-based storage for Rails apps"
|
|
172
190
|
test_files: []
|
|
191
|
+
...
|