config 1.1.0 → 1.1.1
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 +4 -4
- data/CHANGELOG.md +16 -8
- data/LICENSE.md +0 -1
- data/README.md +40 -25
- data/config.gemspec +4 -1
- data/lib/config/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d41f995d1fd8d3aee4387a3cb11760b1441bebaa
|
4
|
+
data.tar.gz: cfcf41a24aad2faf1f0dfd624084bfcc7a27e173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ebe8a4086d0f1b2ab535bb580ef8abd256806bab29108cb1caff44750364b3c4cadbb36502eb1b418411970a1496da37cf1dd16329b9237cc2c9578c820a3c3
|
7
|
+
data.tar.gz: ec664ab9191b81f8d44f59f4e60a79e3bf2505b556be7cfaf4209ccbb9ba8574ff02c6afa14ecf3c140ee14a5a336547ba42e753cc2a49eec1d167dc0809e670
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 1.1.1
|
4
|
+
|
5
|
+
* Downgrade minimum ruby version to 2.0.0 ([#136](https://github.com/railsconfig/config/issues/136))
|
6
|
+
|
7
|
+
## 1.1.0
|
2
8
|
|
3
9
|
* Add ability to specify knockout_prefix option for deep_merge
|
4
10
|
* Minor code and documentation refactoring and cleanup
|
5
11
|
|
6
|
-
|
12
|
+
## 1.0.0
|
7
13
|
|
8
14
|
* `RailsConfig` is now officially renamed to `Config`
|
9
15
|
* Fixed array descent when converting to hash ([#89](https://github.com/railsconfig/config/pull/89))
|
@@ -12,10 +18,11 @@
|
|
12
18
|
* `deep_merge` is now properly managed via gemspec ([#110](https://github.com/railsconfig/config/pull/110))
|
13
19
|
* Added `prepend_source!` ([#102](https://github.com/railsconfig/config/pull/102))
|
14
20
|
|
15
|
-
|
21
|
+
## 0.99
|
22
|
+
|
16
23
|
* Released deprecated gem migrating to the new name
|
17
24
|
|
18
|
-
|
25
|
+
## 0.5.0.beta1
|
19
26
|
|
20
27
|
* Ability to use in Settings file keywords reserved for OpenStruct: select, collect ([#95](https://github.com/railsjedi/config/issues/95))
|
21
28
|
* Made config work without Rails as a hard dependency ([#86](https://github.com/railsjedi/config/issues/86), [#88](https://github.com/railsjedi/config/issues/88))
|
@@ -24,19 +31,20 @@
|
|
24
31
|
* Add a shortcut method for setting files ([#67](https://github.com/railsjedi/config/issues/67))
|
25
32
|
* Improve YAMLSource load error message by outputting offending file path ([#88](https://github.com/railsjedi/config/issues/88))
|
26
33
|
|
27
|
-
|
34
|
+
## 0.4.2
|
35
|
+
|
28
36
|
* Ability to specify the app name when calling the Heroku rake task ([#75](https://github.com/railsjedi/config/issues/75))
|
29
37
|
|
30
|
-
|
38
|
+
## 0.4.1
|
31
39
|
|
32
40
|
* Fixed compatibility with Rails 4.1 ([#72](https://github.com/railsjedi/config/issues/72))
|
33
41
|
* Testing suite verifies compatibility with Rails 3.2, 4.0 and 4.1
|
34
42
|
|
35
|
-
|
43
|
+
## 0.4.0
|
36
44
|
|
37
45
|
* Compatibility with Heroku ([#64](https://github.com/railsjedi/config/issues/64))
|
38
46
|
|
39
|
-
|
47
|
+
## 0.3.4
|
40
48
|
|
41
49
|
* Expose Settings in application.rb, so you don't have to duplicate configuration for each environment file ([#59](https://github.com/railsjedi/config/issues/59))
|
42
50
|
* Adding support for Rails 4.1.0.rc ([#70](https://github.com/railsjedi/config/issues/70))
|
data/LICENSE.md
CHANGED
@@ -20,7 +20,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
THE SOFTWARE.
|
22
22
|
|
23
|
-
|
24
23
|
Third-party materials and licenses:
|
25
24
|
|
26
25
|
* Config contains Deep Merge (deep_merge.rb) which is governed by the MIT license
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
[](http://badge.fury.io/rb/config)
|
3
3
|
[](https://gemnasium.com/railsconfig/config)
|
4
4
|
[](https://codeclimate.com/github/railsconfig/config)
|
5
|
+
[](https://codeclimate.com/github/railsconfig/config)
|
5
6
|
[](https://codeclimate.com/github/railsconfig/config/coverage)
|
6
7
|
|
7
8
|
# Config
|
@@ -12,23 +13,22 @@ Config helps you easily manage environment specific settings in an easy and usab
|
|
12
13
|
|
13
14
|
## Features
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
* simple YAML config files
|
17
|
+
* config files support ERB
|
18
|
+
* config files support inheritance and multiple environments
|
19
|
+
* access config information via convenient object member notation
|
20
|
+
* support for multi-level settings (`Settings.group.subgroup.setting`)
|
21
|
+
* local developer settings ignored when committing the code
|
21
22
|
|
22
23
|
## Compatibility
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
* Ruby `2.x`
|
26
|
+
* Rails `>= 3.1` and `4`
|
27
|
+
* Padrino
|
28
|
+
* Sinatra
|
28
29
|
|
29
30
|
For older versions of Rails or Ruby use [AppConfig](http://github.com/fredwu/app_config).
|
30
31
|
|
31
|
-
|
32
32
|
## Installing
|
33
33
|
|
34
34
|
### Installing on Rails 3 or 4
|
@@ -75,14 +75,16 @@ register Config
|
|
75
75
|
|
76
76
|
### Installing on Sinatra
|
77
77
|
|
78
|
-
Add the gem to your `Gemfile` and run `bundle install` to install it. Afterwards in need to register `Config` in your
|
78
|
+
Add the gem to your `Gemfile` and run `bundle install` to install it. Afterwards in need to register `Config` in your
|
79
|
+
app and give it a root so it can find the config files.
|
79
80
|
|
80
81
|
```ruby
|
81
82
|
set :root, File.dirname(__FILE__)
|
82
83
|
register Config
|
83
84
|
```
|
84
85
|
|
85
|
-
It's also possible to initialize `Config` manually within your configure block if you want to just give it some yml
|
86
|
+
It's also possible to initialize `Config` manually within your configure block if you want to just give it some yml
|
87
|
+
paths to load from.
|
86
88
|
|
87
89
|
```ruby
|
88
90
|
Config.load_and_set_settings("/path/to/yaml1", "/path/to/yaml2", ...)
|
@@ -90,7 +92,8 @@ Config.load_and_set_settings("/path/to/yaml1", "/path/to/yaml2", ...)
|
|
90
92
|
|
91
93
|
## Accessing the Settings object
|
92
94
|
|
93
|
-
After installing the gem, `Settings` object will become available globally and by default will be compiled from the
|
95
|
+
After installing the gem, `Settings` object will become available globally and by default will be compiled from the
|
96
|
+
files listed below. Settings defined in files that are lower in the list override settings higher.
|
94
97
|
|
95
98
|
config/settings.yml
|
96
99
|
config/settings/#{environment}.yml
|
@@ -142,7 +145,8 @@ Settings.reload_from_files(
|
|
142
145
|
|
143
146
|
### Environment specific config files
|
144
147
|
|
145
|
-
You can have environment specific config files. Environment specific config entries take precedence over common config
|
148
|
+
You can have environment specific config files. Environment specific config entries take precedence over common config
|
149
|
+
entries.
|
146
150
|
|
147
151
|
Example development environment config file:
|
148
152
|
|
@@ -185,29 +189,33 @@ Settings.prepend_source!("/path/to/source.yml")
|
|
185
189
|
Settings.reload!
|
186
190
|
```
|
187
191
|
|
188
|
-
This will do the same as `add_source`, but the given YML file will be loaded first (instead of last) and its settings
|
189
|
-
This is especially useful if you want to define defaults.
|
192
|
+
This will do the same as `add_source`, but the given YML file will be loaded first (instead of last) and its settings
|
193
|
+
will be overwritten by any other configuration file. This is especially useful if you want to define defaults.
|
190
194
|
|
191
|
-
One thing I like to do for my Rails projects is provide a local.yml config file that is .gitignored (so its independent
|
195
|
+
One thing I like to do for my Rails projects is provide a local.yml config file that is .gitignored (so its independent
|
196
|
+
per developer). Then I create a new initializer in `config/initializers/add_local_config.rb` with the contents
|
192
197
|
|
193
198
|
```ruby
|
194
199
|
Settings.add_source!("#{Rails.root}/config/settings/local.yml")
|
195
200
|
Settings.reload!
|
196
201
|
```
|
197
202
|
|
198
|
-
> Note: this is an example usage, it is easier to just use the default local files `settings.local.yml,
|
203
|
+
> Note: this is an example usage, it is easier to just use the default local files `settings.local.yml,
|
204
|
+
settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
|
199
205
|
|
200
206
|
## Embedded Ruby (ERB)
|
201
207
|
|
202
208
|
Embedded Ruby is allowed in the configuration files. Consider the two following config files.
|
203
209
|
|
204
210
|
* ```#{Rails.root}/config/settings.yml```
|
211
|
+
|
205
212
|
```yaml
|
206
213
|
size: 1
|
207
214
|
server: google.com
|
208
215
|
```
|
209
216
|
|
210
217
|
* ```#{Rails.root}/config/environments/development.yml```
|
218
|
+
|
211
219
|
```yaml
|
212
220
|
size: 2
|
213
221
|
computed: <%= 1 + 2 + 3 %>
|
@@ -263,10 +271,10 @@ Inheritance customization (check [Deep Merge](https://github.com/danielsdeleo/de
|
|
263
271
|
|
264
272
|
* `knockout_prefix` - ability to remove elements of the array set in earlier loaded settings file. Default: `nil`
|
265
273
|
|
266
|
-
|
267
274
|
## Working with Heroku
|
268
275
|
|
269
|
-
Heroku uses ENV object to store sensitive settings which are like the local files described above. You cannot upload
|
276
|
+
Heroku uses ENV object to store sensitive settings which are like the local files described above. You cannot upload
|
277
|
+
such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh.
|
270
278
|
|
271
279
|
To use config with Heroku just set the `use_env` var to `true` in your `config/initializers/config.rb` file. Eg:
|
272
280
|
|
@@ -277,7 +285,8 @@ Config.setup do |config|
|
|
277
285
|
end
|
278
286
|
```
|
279
287
|
|
280
|
-
Now config would read values from the ENV object to the settings. For the example above it would look for keys starting
|
288
|
+
Now config would read values from the ENV object to the settings. For the example above it would look for keys starting
|
289
|
+
with 'AppSettings'. Eg:
|
281
290
|
|
282
291
|
```ruby
|
283
292
|
ENV['AppSettings.section.size'] = 1
|
@@ -293,13 +302,19 @@ To upload your local values to Heroku you could ran `bundle exec rake config:her
|
|
293
302
|
Bootstrap
|
294
303
|
|
295
304
|
```bash
|
296
|
-
|
305
|
+
appraisal install
|
306
|
+
```
|
307
|
+
|
308
|
+
Run the test suite:
|
309
|
+
|
310
|
+
```bash
|
311
|
+
appraisal rspec
|
297
312
|
```
|
298
313
|
|
299
|
-
|
314
|
+
If you modified any of the documentation files verify their format:
|
300
315
|
|
301
316
|
```bash
|
302
|
-
|
317
|
+
mdl --style .mdlstyle.rb *.md
|
303
318
|
```
|
304
319
|
|
305
320
|
## Authors
|
data/config.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.files += Dir.glob("doc/**/*")
|
23
23
|
|
24
24
|
s.require_paths = ["lib"]
|
25
|
-
s.required_ruby_version = ">= 2.
|
25
|
+
s.required_ruby_version = ">= 2.0.0"
|
26
26
|
|
27
27
|
s.add_dependency "activesupport", ">= 3.0"
|
28
28
|
s.add_dependency "deep_merge", "~> 1.0.1"
|
@@ -39,6 +39,9 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.add_development_dependency "rspec-rails", "~> 3.4.2"
|
40
40
|
s.add_development_dependency "test-unit", "~> 3.1.7"
|
41
41
|
s.add_development_dependency "sqlite3"
|
42
|
+
|
43
|
+
# Static code analysis
|
44
|
+
s.add_development_dependency "mdl"
|
42
45
|
s.add_development_dependency "rubocop"
|
43
46
|
|
44
47
|
if ENV['TRAVIS']
|
data/lib/config/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacques Crocker
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -180,6 +180,20 @@ dependencies:
|
|
180
180
|
- - ">="
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
name: mdl
|
185
|
+
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
type: :development
|
191
|
+
prerelease: false
|
192
|
+
version_requirements: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
183
197
|
- !ruby/object:Gem::Dependency
|
184
198
|
name: rubocop
|
185
199
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,7 +256,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
256
|
requirements:
|
243
257
|
- - ">="
|
244
258
|
- !ruby/object:Gem::Version
|
245
|
-
version: 2.
|
259
|
+
version: 2.0.0
|
246
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
261
|
requirements:
|
248
262
|
- - ">="
|