super_stack 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/super_stack/layer_wrapper.rb +17 -0
- data/lib/super_stack/manager.rb +1 -1
- data/lib/super_stack/version.rb +1 -1
- data/lib/super_stack.rb +0 -3
- data/spec/layer_spec.rb +11 -0
- data/spec/manager_spec.rb +30 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e2441947866b3cc2e7ce1d13f746665c83f6b9
|
4
|
+
data.tar.gz: 16b9b982a5e67896382f1636e6b96308ca94d01b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3df0dccbe956b827bbce831ae5c588f793158a6295681bcf2bd340cf60779c3b7b09d9313449811c5bc50606e80227a584de4080d4bb2481923a9b19300f11a8
|
7
|
+
data.tar.gz: 3762cbd98d5cf9c850ac005d448801b5958a1405f2c0bbc4d89cbe96360973c46b219a9156fcd64eea4e52b63ac50a0601b3000be49f9521f79de8ef7f034af5
|
@@ -9,6 +9,7 @@ module SuperStack
|
|
9
9
|
DEFAULT_LAYER_NAME = 'Unknown layer'
|
10
10
|
|
11
11
|
attr_reader :file_name, :priority, :manager, :disabled
|
12
|
+
attr_writer :source_auto_reload
|
12
13
|
alias_method :disabled?, :disabled
|
13
14
|
|
14
15
|
def priority=(priority)
|
@@ -16,6 +17,22 @@ module SuperStack
|
|
16
17
|
@priority = priority
|
17
18
|
end
|
18
19
|
|
20
|
+
def source_auto_reload
|
21
|
+
@source_auto_reload || false
|
22
|
+
end
|
23
|
+
|
24
|
+
def source_auto_reload?
|
25
|
+
self.source_auto_reload
|
26
|
+
end
|
27
|
+
|
28
|
+
def enable_source_auto_reload
|
29
|
+
self.source_auto_reload = true
|
30
|
+
end
|
31
|
+
|
32
|
+
def disable_source_auto_reload
|
33
|
+
self.source_auto_reload = false
|
34
|
+
end
|
35
|
+
|
19
36
|
def name=(name)
|
20
37
|
@name = name.to_s
|
21
38
|
end
|
data/lib/super_stack/manager.rb
CHANGED
@@ -30,7 +30,7 @@ module SuperStack
|
|
30
30
|
def [](filter=nil)
|
31
31
|
layers = to_a
|
32
32
|
return [] if layers.empty?
|
33
|
-
|
33
|
+
layers.each { |layer| layer.reload if layer.source_auto_reload?}
|
34
34
|
first_layer = layers.shift
|
35
35
|
first_layer = first_layer.disabled? ? SuperStack::Layer.new : first_layer
|
36
36
|
res = layers.inject(first_layer) do |stack, layer|
|
data/lib/super_stack/version.rb
CHANGED
data/lib/super_stack.rb
CHANGED
data/spec/layer_spec.rb
CHANGED
@@ -13,6 +13,17 @@ describe SuperStack::Layer do
|
|
13
13
|
expect(subject.name == subject.class.const_get('DEFAULT_LAYER_NAME')).to be_truthy
|
14
14
|
end
|
15
15
|
|
16
|
+
it 'should have an auto-reload flag' do
|
17
|
+
expect(subject.source_auto_reload).not_to be_nil
|
18
|
+
expect(subject).to respond_to :enable_source_auto_reload
|
19
|
+
expect(subject).to respond_to :disable_source_auto_reload
|
20
|
+
expect(subject).to respond_to :source_auto_reload?
|
21
|
+
subject.enable_source_auto_reload
|
22
|
+
expect(subject.source_auto_reload?).to be_truthy
|
23
|
+
subject.disable_source_auto_reload
|
24
|
+
expect(subject.source_auto_reload?).to be_falsey
|
25
|
+
end
|
26
|
+
|
16
27
|
it 'could have its own merge policy' do
|
17
28
|
expect( subject.respond_to? :merge_policy).to be_truthy
|
18
29
|
expect( subject.respond_to? :'merge_policy=').to be_truthy
|
data/spec/manager_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
2
|
+
require 'tempfile'
|
3
3
|
|
4
4
|
describe SuperStack::Manager do
|
5
|
-
subject {
|
5
|
+
subject {described_class.new}
|
6
6
|
|
7
7
|
(1..4).each do |layer_number|
|
8
8
|
let("layer#{layer_number}".to_sym) {
|
@@ -277,4 +277,32 @@ describe SuperStack::Manager do
|
|
277
277
|
|
278
278
|
end
|
279
279
|
|
280
|
+
context 'when #enable_source_auto_reload is set on a layer' do
|
281
|
+
let(:source_file) do
|
282
|
+
f = Tempfile.new 'synced_test_config_file'
|
283
|
+
f.puts 'in_synced_config_file: foo'
|
284
|
+
f.close
|
285
|
+
f.path
|
286
|
+
end
|
287
|
+
|
288
|
+
let(:synced_layer) do
|
289
|
+
layer = SuperStack::Layer.new
|
290
|
+
layer.load source_file
|
291
|
+
layer.name = 'Synchronized layer'
|
292
|
+
layer.enable_source_auto_reload
|
293
|
+
layer
|
294
|
+
end
|
295
|
+
|
296
|
+
|
297
|
+
it 'should reflect any change applied to the source' do
|
298
|
+
subject << synced_layer
|
299
|
+
File.open(source_file, 'a') do |f|
|
300
|
+
f.puts 'extra_foo: extra_bar'
|
301
|
+
end
|
302
|
+
expect(subject[:extra_foo]).to eq 'extra_bar'
|
303
|
+
end
|
304
|
+
|
305
|
+
|
306
|
+
end
|
307
|
+
|
280
308
|
end
|
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: 0.
|
4
|
+
version: 0.5.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: 2015-
|
11
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|