super_stack 1.0.0 → 1.0.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/README.md +2 -2
- data/lib/super_stack/compatibility/layer_wrapper.rb +0 -1
- data/lib/super_stack/compatibility/manager.rb +1 -1
- data/lib/super_stack/compatibility/switch.rb +11 -0
- data/lib/super_stack/layer.rb +5 -1
- data/lib/super_stack/layer_wrapper.rb +4 -1
- data/lib/super_stack/manager.rb +1 -0
- data/lib/super_stack/old.rb +1 -1
- data/lib/super_stack/version.rb +1 -1
- data/lib/super_stack.rb +3 -16
- data/spec/layer_spec.rb +1 -1
- data/spec/manager_spec.rb +36 -2
- data/spec/spec_helper.rb +0 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 091053766ee781aa79aec23344855617d62b8f15
|
4
|
+
data.tar.gz: 6150e5f5a8ba4610d60c7e800de1e8e58a76c97b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6304ed0df60f35bd30d1f3dbb62a509245a1a3387d6ae83dd60f0e47a8012f5b80e8a7e8af089c81c4b88a558ba961b0faceb1749d4508750e7a16c2dcbd029
|
7
|
+
data.tar.gz: df871c2bd0b6165fff4bb242df69852bdba761b52a2628726671764cc3acc51084afc6b70367fa5d6dd4ce153e05e2bc231e326839c5161412ea9fdeec269d0a
|
data/README.md
CHANGED
@@ -57,13 +57,13 @@ puts manager.layers.class # => Hash
|
|
57
57
|
:warning: Versions prior to `1.0.0` were trying to give an indifferent access to the merged hash for strings
|
58
58
|
and symbols, ie `manager[:an_entry]` was giving the same result as `manager['an_entry']`.
|
59
59
|
|
60
|
-
This is clearly wrong and not consistent everywhere.
|
60
|
+
This is clearly wrong and not consistent everywhere (only valid for the 'root' nodes).
|
61
61
|
__Starting with version `1.0.0` this is no more the case__. Nevertheless a compatibility mode is provided for
|
62
62
|
applications relying on the legacy mechanism, you just need to do:
|
63
63
|
|
64
64
|
```ruby
|
65
65
|
require 'super_stack'
|
66
|
-
SuperStack.
|
66
|
+
SuperStack.compatibility_mode = true
|
67
67
|
```
|
68
68
|
or alternatively, you can do:
|
69
69
|
|
data/lib/super_stack/layer.rb
CHANGED
@@ -71,7 +71,10 @@ module SuperStack
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def self.from_hash(hash)
|
74
|
-
hash
|
74
|
+
class << hash; include SuperStack::LayerWrapper; end
|
75
|
+
if SuperStack.compatibility_mode
|
76
|
+
class << hash; include SuperStack::Compatibility::LayerWrapper; end
|
77
|
+
end
|
75
78
|
end
|
76
79
|
|
77
80
|
def to_hash
|
data/lib/super_stack/manager.rb
CHANGED
data/lib/super_stack/old.rb
CHANGED
data/lib/super_stack/version.rb
CHANGED
data/lib/super_stack.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
require 'super_stack/version'
|
2
|
+
require 'super_stack/compatibility/switch'
|
2
3
|
require 'super_stack/merge_policies'
|
3
4
|
require 'super_stack/layer_wrapper'
|
4
5
|
require 'super_stack/layer'
|
5
6
|
require 'super_stack/manager'
|
7
|
+
require 'super_stack/compatibility/layer_wrapper'
|
8
|
+
require 'super_stack/compatibility/manager'
|
6
9
|
|
7
|
-
module SuperStack
|
8
|
-
|
9
|
-
def self.set_compatibility_mode
|
10
|
-
require 'super_stack/compatibility/layer_wrapper'
|
11
|
-
require 'super_stack/compatibility/manager'
|
12
|
-
|
13
|
-
SuperStack::Manager.class_eval do
|
14
|
-
include SuperStack::Compatibility::Manager
|
15
|
-
end
|
16
|
-
|
17
|
-
SuperStack::LayerWrapper.module_eval do
|
18
|
-
include SuperStack::Compatibility::LayerWrapper
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
data/spec/layer_spec.rb
CHANGED
data/spec/manager_spec.rb
CHANGED
@@ -73,8 +73,8 @@ describe SuperStack::Manager do
|
|
73
73
|
expect {subject.add_layer({}) }.not_to raise_error
|
74
74
|
expect {subject.add_layer({}) }.not_to raise_error
|
75
75
|
expect(subject.layers.keys.count == 2).to be_truthy
|
76
|
-
expect(subject.layers.keys[0] == SuperStack::
|
77
|
-
expect(subject.layers.keys[1] == "#{SuperStack::
|
76
|
+
expect(subject.layers.keys[0] == SuperStack::LayerWrapper::DEFAULT_LAYER_NAME).to be_truthy
|
77
|
+
expect(subject.layers.keys[1] == "#{SuperStack::LayerWrapper::DEFAULT_LAYER_NAME} #2").to be_truthy
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'should provide a dynamic merge' do
|
@@ -97,6 +97,13 @@ describe SuperStack::Manager do
|
|
97
97
|
expect {subject[:foo] = :bar}.to raise_error
|
98
98
|
end
|
99
99
|
|
100
|
+
|
101
|
+
it 'should differentiate symbols from strings' do
|
102
|
+
subject << layer1
|
103
|
+
expect(subject[:layer]).not_to eq subject['layer']
|
104
|
+
end
|
105
|
+
|
106
|
+
|
100
107
|
context 'when specifying a write layer' do
|
101
108
|
|
102
109
|
it 'should be possible using its name or itself' do
|
@@ -305,4 +312,31 @@ describe SuperStack::Manager do
|
|
305
312
|
|
306
313
|
end
|
307
314
|
|
315
|
+
|
316
|
+
context 'when using compatibility mode' do
|
317
|
+
|
318
|
+
before(:all) do
|
319
|
+
SuperStack.compatibility_mode = true
|
320
|
+
end
|
321
|
+
|
322
|
+
after(:all) do
|
323
|
+
SuperStack.compatibility_mode = false
|
324
|
+
end
|
325
|
+
|
326
|
+
subject {
|
327
|
+
s = SuperStack::Manager.new
|
328
|
+
s.add_layer layer1
|
329
|
+
s
|
330
|
+
}
|
331
|
+
|
332
|
+
it 'should not differentiate symbols from strings (for root nodes)' do
|
333
|
+
expect(subject[:layer]).to eq subject['layer']
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'should differentiate symbols from strings (for non root nodes)' do
|
337
|
+
expect(subject['to-be-merged'][:name]).not_to eq subject['to-be-merged']['name']
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
341
|
+
|
308
342
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_stack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/super_stack.rb
|
113
113
|
- lib/super_stack/compatibility/layer_wrapper.rb
|
114
114
|
- lib/super_stack/compatibility/manager.rb
|
115
|
+
- lib/super_stack/compatibility/switch.rb
|
115
116
|
- lib/super_stack/layer.rb
|
116
117
|
- lib/super_stack/layer_wrapper.rb
|
117
118
|
- lib/super_stack/manager.rb
|