stacked_config 1.2.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +52 -0
- data/lib/stacked_config/version.rb +1 -1
- data/spec/global_layer_spec.rb +2 -2
- data/spec/system_layer_spec.rb +2 -2
- data/spec/user_layer_spec.rb +2 -2
- data/stacked_config.gemspec +1 -1
- data/test/specific.yml +2 -2
- data/test/tstgem/config/rspec.yml +2 -2
- data/test/tstgem/config/tstgem.yml +2 -2
- data/test/unix/etc/rspec/rspec.yml +2 -2
- data/test/unix/etc/stacked_config.yml +2 -2
- data/test/user/.config/rspec.yml +2 -2
- data/test/user/.config/weird_name.yml +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74648d28f29b32a2a3fcdd704abeafc0219c94c4
|
4
|
+
data.tar.gz: f0946ee3a28f3e74ddbb84a0cac5790a1e52ae40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0ed84faad7ef2cd9de6e93b1afa0989a8241ad49978d95734005056bb499d80bf9d8a34fee1c423d624f615ac9ba8bbb82dd6e9d8c4a95b238fa5760c0b8272
|
7
|
+
data.tar.gz: 3f2893a1d9ebcf9b4863edd1b27882022c17ecf8b5bf9c3f2cc8e6d0574626d4425b77ba3b7b78ad3a98c8edbb3a26ca14488fc23114e9b802c68609fc5c9e02
|
data/README.md
CHANGED
@@ -32,6 +32,9 @@ All the config files are following the [YAML] syntax.
|
|
32
32
|
__If you're looking for a complete solution for your command line scripts, including some logging features, then you
|
33
33
|
are probably looking for the [easy_app_helper Gem][EAH], which is itself internally relying on [stacked_config][SC].__
|
34
34
|
|
35
|
+
Version 2.x introduces non compatibilities with previous versions. Check [below]
|
36
|
+
(#between-version-1x-and-2x) for more info.
|
37
|
+
|
35
38
|
Version 1.x introduces some minor non compatibilities with previous versions. Check [below]
|
36
39
|
(#between-version-0x-and-1x) for more info.
|
37
40
|
|
@@ -494,6 +497,55 @@ This layer contains the following data:
|
|
494
497
|
|
495
498
|
## Non backward compatible changes
|
496
499
|
|
500
|
+
### Between version 1.x and 2.x
|
501
|
+
|
502
|
+
Versions 1.x of this gem were relying on the [super_stack][SS] 0.x, whereas versions 2.x are actually
|
503
|
+
relying on the [super_stack][SS] 1.x. The reason why this gem bumps to 2.x is because of non-backward
|
504
|
+
compatible features it introduces.
|
505
|
+
|
506
|
+
Basically it is about clarifying some inconsistencies on how to access the merged tree. Previously for
|
507
|
+
the first level (roots) you could access a value using indifferently a symbol or a string as a key,
|
508
|
+
ie `manager[:an_entry]` was giving the same result as `manager['an_entry']`.
|
509
|
+
|
510
|
+
This was clearly wrong and not consistent everywhere.
|
511
|
+
__Starting with version `2.0.0` this is no more the case__. Nevertheless a compatibility mode is provided for
|
512
|
+
applications relying on the legacy mechanism, you just need to do __just after requiring this gem__:
|
513
|
+
|
514
|
+
```ruby
|
515
|
+
require 'stacked_config'
|
516
|
+
SuperStack.set_compatibility_mode
|
517
|
+
```
|
518
|
+
|
519
|
+
Of course, if you don't want to use this compatibility mode, this may have an impact on you. As if in
|
520
|
+
your code you where using this feature, you either need to change your code or your config files. (to
|
521
|
+
access a yaml property as symbol you need to declare it with a leading colon).
|
522
|
+
|
523
|
+
For example, the following config file:
|
524
|
+
|
525
|
+
```yaml
|
526
|
+
my_property: a value
|
527
|
+
an_array:
|
528
|
+
- value 1
|
529
|
+
- value 2
|
530
|
+
```
|
531
|
+
Could be rewritten as
|
532
|
+
|
533
|
+
```yaml
|
534
|
+
:my_property: a value
|
535
|
+
:an_array:
|
536
|
+
- value 1
|
537
|
+
- value 2
|
538
|
+
```
|
539
|
+
and then if you were accessing my_property in your code using `config[:my_property]`, you won't need
|
540
|
+
to change your code without even activating the compatibility mode.
|
541
|
+
|
542
|
+
Actually depending on your case, you may want to:
|
543
|
+
|
544
|
+
* Adapt your code to the new version without compatibility mode
|
545
|
+
* Adapt your config files to the new version without compatibility mode
|
546
|
+
* Use the new version in compatibility mode
|
547
|
+
* Keep the old version
|
548
|
+
|
497
549
|
### Between version 0.x and 1.x
|
498
550
|
|
499
551
|
The Gem layer has not really the same meaning as in version 0.x. In the v1.x it corresponds to the
|
data/spec/global_layer_spec.rb
CHANGED
@@ -29,9 +29,9 @@ describe StackedConfig::Layers::GlobalLayer do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should enable to load the file' do
|
32
|
-
expect(subject[
|
32
|
+
expect(subject[:an_array]).to be_nil
|
33
33
|
subject.load
|
34
|
-
expect(subject[
|
34
|
+
expect(subject[:an_array]).to be_an Array
|
35
35
|
end
|
36
36
|
|
37
37
|
|
data/spec/system_layer_spec.rb
CHANGED
@@ -30,9 +30,9 @@ describe StackedConfig::Layers::SystemLayer do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should enable to load the file' do
|
33
|
-
expect(subject[
|
33
|
+
expect(subject[:stacked_config_copyright]).to be_nil
|
34
34
|
subject.load
|
35
|
-
expect(subject[
|
35
|
+
expect(subject[:stacked_config_copyright]).not_to be_nil
|
36
36
|
end
|
37
37
|
|
38
38
|
|
data/spec/user_layer_spec.rb
CHANGED
@@ -28,9 +28,9 @@ describe StackedConfig::Layers::UserLayer do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should enable to load the file' do
|
31
|
-
expect(subject[
|
31
|
+
expect(subject[:an_array]).to be_nil
|
32
32
|
subject.load
|
33
|
-
expect(subject[
|
33
|
+
expect(subject[:an_array]).to be_an Array
|
34
34
|
end
|
35
35
|
|
36
36
|
|
data/stacked_config.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'pry'
|
24
24
|
spec.add_development_dependency 'rspec'
|
25
25
|
|
26
|
-
spec.add_dependency 'super_stack', '~> 0
|
26
|
+
spec.add_dependency 'super_stack', '~> 1.0'
|
27
27
|
spec.add_dependency 'slop', '~> 3.0'
|
28
28
|
|
29
29
|
end
|
data/test/specific.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This is supposed to be a file loaded using the config-file command line option.
|
2
2
|
# It is dedicated to configuration for this particular user running the program.
|
3
3
|
|
4
|
-
specific_property: foo
|
5
|
-
an_array:
|
4
|
+
:specific_property: foo
|
5
|
+
:an_array:
|
6
6
|
- something very specific
|
@@ -2,5 +2,5 @@
|
|
2
2
|
# It is dedicated to configuration for all gems that would use the stacked_config gem.
|
3
3
|
# To be used at administrator level only
|
4
4
|
|
5
|
-
stacked_config_copyright: (c)2014 L.Briais under MIT license
|
6
|
-
system_property: foo
|
5
|
+
:stacked_config_copyright: (c)2014 L.Briais under MIT license
|
6
|
+
:system_property: foo
|
data/test/user/.config/rspec.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stacked_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent B.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
75
|
+
version: '1.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
82
|
+
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: slop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|