super_stack 0.5.3 → 1.0.0
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 +20 -1
 - data/lib/super_stack/compatibility/layer_wrapper.rb +23 -0
 - data/lib/super_stack/compatibility/manager.rb +46 -0
 - data/lib/super_stack/layer_wrapper.rb +13 -6
 - data/lib/super_stack/manager.rb +4 -12
 - data/lib/super_stack/old.rb +3 -0
 - data/lib/super_stack/version.rb +1 -1
 - data/lib/super_stack.rb +16 -0
 - data/spec/manager_spec.rb +13 -13
 - data/spec/spec_helper.rb +1 -0
 - data/test/layer_content_type_containing_an_array.yml +2 -1
 - data/test/stacked_layer_1.yml +3 -3
 - data/test/stacked_layer_2.yml +3 -3
 - data/test/stacked_layer_3.yml +3 -3
 - data/test/stacked_layer_4.yml +3 -3
 - metadata +5 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2ee62f30bb0b8ce359573f8d0c8de39392a866c3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 186733047be8988e51c76c09801d6ac93844b634
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 43db4607abd8d83241a3fb2645ec2969d3ba2e067016e31046d0ef339081fc564d99df14354d6fba6191f294d91dc45f5b4b9e2388b426086ea53dc1fe80728f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 67c73bd1935eccaa33ff4dbe0c634ae2339eeb0cfc9a7798330bfd541974f71419be0dd1b518d9e9dc59bfd31549bbd26f83b96c0eeea9806dca2fadb1b80040
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -54,6 +54,26 @@ puts manager[].class # =>  Hash 
     | 
|
| 
       54 
54 
     | 
    
         
             
            puts manager.layers.class # =>  Hash
         
     | 
| 
       55 
55 
     | 
    
         
             
            ```
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
      
 57 
     | 
    
         
            +
            :warning: Versions prior to `1.0.0` were trying to give an indifferent access to the merged hash for strings
         
     | 
| 
      
 58 
     | 
    
         
            +
            and symbols, ie `manager[:an_entry]` was giving the same result as `manager['an_entry']`.
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            This is clearly wrong and not consistent everywhere.
         
     | 
| 
      
 61 
     | 
    
         
            +
            __Starting with version `1.0.0` this is no more the case__. Nevertheless a compatibility mode is provided for 
         
     | 
| 
      
 62 
     | 
    
         
            +
            applications relying on the legacy mechanism, you just need to do:
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 65 
     | 
    
         
            +
            require 'super_stack'
         
     | 
| 
      
 66 
     | 
    
         
            +
            SuperStack.set_compatibility_mode
         
     | 
| 
      
 67 
     | 
    
         
            +
            ```
         
     | 
| 
      
 68 
     | 
    
         
            +
            or alternatively, you can do:
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 71 
     | 
    
         
            +
            require 'super_stack/old'
         
     | 
| 
      
 72 
     | 
    
         
            +
            ```
         
     | 
| 
      
 73 
     | 
    
         
            +
            which is equivalent.
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       57 
77 
     | 
    
         
             
            ### Layers
         
     | 
| 
       58 
78 
     | 
    
         | 
| 
       59 
79 
     | 
    
         
             
            Layers are actually simple hashes that include the `SuperStack::LayerWrapper` module. Therefore you can create a layer by
         
     | 
| 
         @@ -142,4 +162,3 @@ The alternative is to set the policy at the layer level using `merge_policy=` 
     | 
|
| 
       142 
162 
     | 
    
         | 
| 
       143 
163 
     | 
    
         
             
            [DMG]:      https://rubygems.org/gems/deep_merge        "Deep Merge gem"
         
     | 
| 
       144 
164 
     | 
    
         
             
            [DMGithub]: https://github.com/danielsdeleo/deep_merge  "Deep Merge Github project"
         
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module SuperStack
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Compatibility
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                module LayerWrapper
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  private
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  def load_from_yaml(file_name)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 10 
     | 
    
         
            +
                      self.replace Hash[YAML::load(File.open(file_name)).map { |k, v| [k.to_s, v] }]
         
     | 
| 
      
 11 
     | 
    
         
            +
                    rescue  NoMethodError => e
         
     | 
| 
      
 12 
     | 
    
         
            +
                      # Empty file...
         
     | 
| 
      
 13 
     | 
    
         
            +
                      raise "Invalid file '#{file_name}'" unless e.message =~ /false:FalseClass/
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @file_name = file_name
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module SuperStack
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Compatibility
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                module Manager
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def []=(key,value)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    raise 'No write layer specified' if write_layer.nil?
         
     | 
| 
      
 8 
     | 
    
         
            +
                    write_layer[key.to_s] = value
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def [](filter=nil)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    layers = to_a
         
     | 
| 
      
 13 
     | 
    
         
            +
                    return [] if layers.empty?
         
     | 
| 
      
 14 
     | 
    
         
            +
                    layers.each { |layer| layer.reload if layer.source_auto_reload?}
         
     | 
| 
      
 15 
     | 
    
         
            +
                    first_layer = layers.shift
         
     | 
| 
      
 16 
     | 
    
         
            +
                    first_layer = first_layer.disabled? ? SuperStack::Layer.new : first_layer
         
     | 
| 
      
 17 
     | 
    
         
            +
                    res = layers.inject(first_layer) do |stack, layer|
         
     | 
| 
      
 18 
     | 
    
         
            +
                      if layer.disabled?
         
     | 
| 
      
 19 
     | 
    
         
            +
                        stack
         
     | 
| 
      
 20 
     | 
    
         
            +
                      else
         
     | 
| 
      
 21 
     | 
    
         
            +
                        policy_to_apply = layer.merge_policy.nil? ? default_merge_policy : layer.merge_policy
         
     | 
| 
      
 22 
     | 
    
         
            +
                        policy_to_apply.merge stack, stringify_keys(layer)
         
     | 
| 
      
 23 
     | 
    
         
            +
                      end
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                    if filter.nil?
         
     | 
| 
      
 26 
     | 
    
         
            +
                      res.to_hash
         
     | 
| 
      
 27 
     | 
    
         
            +
                    else
         
     | 
| 
      
 28 
     | 
    
         
            +
                      res[filter]
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  private
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  def stringify_keys(hash)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    hash.inject({}){|stringified_hash, (key, value)|
         
     | 
| 
      
 38 
     | 
    
         
            +
                      stringified_hash[key.to_s] = value
         
     | 
| 
      
 39 
     | 
    
         
            +
                      stringified_hash
         
     | 
| 
      
 40 
     | 
    
         
            +
                    }
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -74,15 +74,22 @@ module SuperStack 
     | 
|
| 
       74 
74 
     | 
    
         
             
                  hash.extend self
         
     | 
| 
       75 
75 
     | 
    
         
             
                end
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
      
 77 
     | 
    
         
            +
                def to_hash
         
     | 
| 
      
 78 
     | 
    
         
            +
                  # Trick to return a bare hash
         
     | 
| 
      
 79 
     | 
    
         
            +
                  {}.merge self
         
     | 
| 
      
 80 
     | 
    
         
            +
                end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
       77 
82 
     | 
    
         
             
                private
         
     | 
| 
       78 
83 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                def load_from_yaml(file_name)
         
     | 
| 
       80 
     | 
    
         
            -
                  begin
         
     | 
| 
       81 
     | 
    
         
            -
                    self.replace Hash[YAML::load(File.open(file_name)).map { |k, v| [k.to_s, v] }]
         
     | 
| 
       82 
84 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
      
 85 
     | 
    
         
            +
                def load_from_yaml(file_name)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  raw_content = File.read file_name
         
     | 
| 
      
 87 
     | 
    
         
            +
                  res = YAML.load raw_content
         
     | 
| 
      
 88 
     | 
    
         
            +
                  if res
         
     | 
| 
      
 89 
     | 
    
         
            +
                    self.replace Hash[res.map { |k, v| [k, v] }]
         
     | 
| 
      
 90 
     | 
    
         
            +
                  else
         
     | 
| 
      
 91 
     | 
    
         
            +
                    raise "Invalid file content for '#{file_name}'" unless raw_content.empty?
         
     | 
| 
      
 92 
     | 
    
         
            +
                    clear
         
     | 
| 
       86 
93 
     | 
    
         
             
                  end
         
     | 
| 
       87 
94 
     | 
    
         
             
                  @file_name = file_name
         
     | 
| 
       88 
95 
     | 
    
         
             
                end
         
     | 
    
        data/lib/super_stack/manager.rb
    CHANGED
    
    | 
         @@ -24,7 +24,7 @@ module SuperStack 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                def []=(key,value)
         
     | 
| 
       26 
26 
     | 
    
         
             
                  raise 'No write layer specified' if write_layer.nil?
         
     | 
| 
       27 
     | 
    
         
            -
                  write_layer[key 
     | 
| 
      
 27 
     | 
    
         
            +
                  write_layer[key] = value
         
     | 
| 
       28 
28 
     | 
    
         
             
                end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                def [](filter=nil)
         
     | 
| 
         @@ -38,14 +38,13 @@ module SuperStack 
     | 
|
| 
       38 
38 
     | 
    
         
             
                      stack
         
     | 
| 
       39 
39 
     | 
    
         
             
                    else
         
     | 
| 
       40 
40 
     | 
    
         
             
                      policy_to_apply = layer.merge_policy.nil? ? default_merge_policy : layer.merge_policy
         
     | 
| 
       41 
     | 
    
         
            -
                      policy_to_apply.merge stack,  
     | 
| 
      
 41 
     | 
    
         
            +
                      policy_to_apply.merge stack, layer
         
     | 
| 
       42 
42 
     | 
    
         
             
                    end
         
     | 
| 
       43 
43 
     | 
    
         
             
                  end
         
     | 
| 
       44 
44 
     | 
    
         
             
                  if filter.nil?
         
     | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
       46 
     | 
    
         
            -
                    {}.merge res
         
     | 
| 
      
 45 
     | 
    
         
            +
                    res.to_hash
         
     | 
| 
       47 
46 
     | 
    
         
             
                  else
         
     | 
| 
       48 
     | 
    
         
            -
                    res[filter 
     | 
| 
      
 47 
     | 
    
         
            +
                    res[filter]
         
     | 
| 
       49 
48 
     | 
    
         
             
                  end
         
     | 
| 
       50 
49 
     | 
    
         
             
                end
         
     | 
| 
       51 
50 
     | 
    
         | 
| 
         @@ -102,13 +101,6 @@ module SuperStack 
     | 
|
| 
       102 
101 
     | 
    
         | 
| 
       103 
102 
     | 
    
         
             
                private
         
     | 
| 
       104 
103 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
                def stringify_keys(hash)
         
     | 
| 
       106 
     | 
    
         
            -
                  hash.inject({}){|stringified_hash, (key, value)|
         
     | 
| 
       107 
     | 
    
         
            -
                    stringified_hash[key.to_s] = value
         
     | 
| 
       108 
     | 
    
         
            -
                    stringified_hash
         
     | 
| 
       109 
     | 
    
         
            -
                  }
         
     | 
| 
       110 
     | 
    
         
            -
                end
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
104 
     | 
    
         | 
| 
       113 
105 
     | 
    
         
             
                def get_existing_layer(layer_or_layer_name, error_message)
         
     | 
| 
       114 
106 
     | 
    
         
             
                  layer_name = layer_or_layer_name.to_s if layer_or_layer_name.is_a? Symbol
         
     | 
    
        data/lib/super_stack/version.rb
    CHANGED
    
    
    
        data/lib/super_stack.rb
    CHANGED
    
    | 
         @@ -4,3 +4,19 @@ require 'super_stack/layer_wrapper' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'super_stack/layer'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'super_stack/manager'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 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/manager_spec.rb
    CHANGED
    
    | 
         @@ -5,19 +5,20 @@ describe SuperStack::Manager do 
     | 
|
| 
       5 
5 
     | 
    
         
             
              subject {described_class.new}
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              (1..4).each do |layer_number|
         
     | 
| 
       8 
     | 
    
         
            -
                let("layer#{layer_number}".to_sym)  
     | 
| 
      
 8 
     | 
    
         
            +
                let("layer#{layer_number}".to_sym) do
         
     | 
| 
       9 
9 
     | 
    
         
             
                  file_name = file_from_layer layer_number
         
     | 
| 
       10 
10 
     | 
    
         
             
                  layer = SuperStack::Layer.new
         
     | 
| 
       11 
11 
     | 
    
         
             
                  layer.load file_name
         
     | 
| 
       12 
12 
     | 
    
         
             
                  layer.name = "layer#{layer_number}"
         
     | 
| 
       13 
13 
     | 
    
         
             
                  layer
         
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              let(:override) do
         
     | 
| 
       17 
18 
     | 
    
         
             
                override = SuperStack::Layer.new
         
     | 
| 
       18 
19 
     | 
    
         
             
                override.name = :override
         
     | 
| 
       19 
20 
     | 
    
         
             
                override
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
       21 
22 
     | 
    
         | 
| 
       22 
23 
     | 
    
         | 
| 
       23 
24 
     | 
    
         
             
              it 'should contain layers' do
         
     | 
| 
         @@ -76,13 +77,13 @@ describe SuperStack::Manager do 
     | 
|
| 
       76 
77 
     | 
    
         
             
                expect(subject.layers.keys[1] == "#{SuperStack::Layer::DEFAULT_LAYER_NAME} #2").to be_truthy
         
     | 
| 
       77 
78 
     | 
    
         
             
              end
         
     | 
| 
       78 
79 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
              it 'should  
     | 
| 
      
 80 
     | 
    
         
            +
              it 'should provide a dynamic merge' do
         
     | 
| 
       80 
81 
     | 
    
         
             
                subject.add_layer layer1
         
     | 
| 
       81 
82 
     | 
    
         
             
                subject << {bar: :foo}
         
     | 
| 
       82 
83 
     | 
    
         
             
                subject.add_layer layer3
         
     | 
| 
       83 
84 
     | 
    
         
             
                subject.add_layer layer4
         
     | 
| 
       84 
85 
     | 
    
         
             
                expect(subject[:foo]).not_to eq :bar
         
     | 
| 
       85 
     | 
    
         
            -
                subject.layers['layer3'][ 
     | 
| 
      
 86 
     | 
    
         
            +
                subject.layers['layer3'][:foo] = :bar
         
     | 
| 
       86 
87 
     | 
    
         
             
                expect(subject[:foo]).to eq :bar
         
     | 
| 
       87 
88 
     | 
    
         
             
                expect(subject[:bar]).to eq :foo
         
     | 
| 
       88 
89 
     | 
    
         
             
                expect {subject.reload_layers}.not_to raise_error
         
     | 
| 
         @@ -111,9 +112,9 @@ describe SuperStack::Manager do 
     | 
|
| 
       111 
112 
     | 
    
         
             
                  subject << layer1
         
     | 
| 
       112 
113 
     | 
    
         
             
                  subject.write_layer = override
         
     | 
| 
       113 
114 
     | 
    
         
             
                  expect {subject[:foo] = :bar}.not_to raise_error
         
     | 
| 
       114 
     | 
    
         
            -
                  expect(subject.layers['override'][ 
     | 
| 
      
 115 
     | 
    
         
            +
                  expect(subject.layers['override'][:foo]).to eq :bar
         
     | 
| 
       115 
116 
     | 
    
         
             
                  expect(subject[:foo]).to eq :bar
         
     | 
| 
       116 
     | 
    
         
            -
                  expect(subject['foo']). 
     | 
| 
      
 117 
     | 
    
         
            +
                  expect(subject['foo']).not_to eq :bar
         
     | 
| 
       117 
118 
     | 
    
         
             
                end
         
     | 
| 
       118 
119 
     | 
    
         | 
| 
       119 
120 
     | 
    
         | 
| 
         @@ -147,7 +148,7 @@ describe SuperStack::Manager do 
     | 
|
| 
       147 
148 
     | 
    
         
             
                  subject.default_merge_policy = policy
         
     | 
| 
       148 
149 
     | 
    
         
             
                  expect(subject[].is_a? Hash).to be_truthy
         
     | 
| 
       149 
150 
     | 
    
         
             
                  policy == SuperStack::MergePolicies::KeepPolicy ?
         
     | 
| 
       150 
     | 
    
         
            -
                      expect(subject[:layer]  
     | 
| 
      
 151 
     | 
    
         
            +
                      expect(subject[:layer]).to(eq 'one') : expect(subject[:layer]).to(eq 'four')
         
     | 
| 
       151 
152 
     | 
    
         
             
                end
         
     | 
| 
       152 
153 
     | 
    
         
             
              end
         
     | 
| 
       153 
154 
     | 
    
         | 
| 
         @@ -209,10 +210,9 @@ describe SuperStack::Manager do 
     | 
|
| 
       209 
210 
     | 
    
         
             
                  subject.write_layer = :layer3
         
     | 
| 
       210 
211 
     | 
    
         
             
                  expect(subject.write_layer).to eq layer3
         
     | 
| 
       211 
212 
     | 
    
         
             
                  subject[:foo] = :bar
         
     | 
| 
       212 
     | 
    
         
            -
                  expect(layer3[ 
     | 
| 
      
 213 
     | 
    
         
            +
                  expect(layer3[:foo]).to eq :bar
         
     | 
| 
       213 
214 
     | 
    
         
             
                  subject.remove_layer :layer3
         
     | 
| 
       214 
215 
     | 
    
         
             
                  expect(subject[:foo]).not_to eq :bar
         
     | 
| 
       215 
     | 
    
         
            -
                  expect(subject['foo']).not_to eq :bar
         
     | 
| 
       216 
216 
     | 
    
         
             
                  expect(subject.write_layer).to be_nil
         
     | 
| 
       217 
217 
     | 
    
         
             
                end
         
     | 
| 
       218 
218 
     | 
    
         | 
| 
         @@ -229,7 +229,7 @@ describe SuperStack::Manager do 
     | 
|
| 
       229 
229 
     | 
    
         
             
                  s
         
     | 
| 
       230 
230 
     | 
    
         
             
                }
         
     | 
| 
       231 
231 
     | 
    
         | 
| 
       232 
     | 
    
         
            -
                it 'should not  
     | 
| 
      
 232 
     | 
    
         
            +
                it 'should not be taken in account in the merge' do
         
     | 
| 
       233 
233 
     | 
    
         
             
                  subject.disable_layer :layer3
         
     | 
| 
       234 
234 
     | 
    
         
             
                  expect(subject[:from_layer_3]).to be_nil
         
     | 
| 
       235 
235 
     | 
    
         
             
                  expect(subject[:from_layer_1]).not_to be_nil
         
     | 
| 
         @@ -297,7 +297,7 @@ describe SuperStack::Manager do 
     | 
|
| 
       297 
297 
     | 
    
         
             
                it 'should reflect any change applied to the source' do
         
     | 
| 
       298 
298 
     | 
    
         
             
                  subject << synced_layer
         
     | 
| 
       299 
299 
     | 
    
         
             
                  File.open(source_file, 'a') do |f|
         
     | 
| 
       300 
     | 
    
         
            -
                    f.puts 'extra_foo: extra_bar'
         
     | 
| 
      
 300 
     | 
    
         
            +
                    f.puts ':extra_foo: extra_bar'
         
     | 
| 
       301 
301 
     | 
    
         
             
                  end
         
     | 
| 
       302 
302 
     | 
    
         
             
                  expect(subject[:extra_foo]).to eq 'extra_bar'
         
     | 
| 
       303 
303 
     | 
    
         
             
                end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        data/test/stacked_layer_1.yml
    CHANGED
    
    
    
        data/test/stacked_layer_2.yml
    CHANGED
    
    
    
        data/test/stacked_layer_3.yml
    CHANGED
    
    
    
        data/test/stacked_layer_4.yml
    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: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-07-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -110,6 +110,8 @@ files: 
     | 
|
| 
       110 
110 
     | 
    
         
             
            - README.md
         
     | 
| 
       111 
111 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       112 
112 
     | 
    
         
             
            - lib/super_stack.rb
         
     | 
| 
      
 113 
     | 
    
         
            +
            - lib/super_stack/compatibility/layer_wrapper.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - lib/super_stack/compatibility/manager.rb
         
     | 
| 
       113 
115 
     | 
    
         
             
            - lib/super_stack/layer.rb
         
     | 
| 
       114 
116 
     | 
    
         
             
            - lib/super_stack/layer_wrapper.rb
         
     | 
| 
       115 
117 
     | 
    
         
             
            - lib/super_stack/manager.rb
         
     | 
| 
         @@ -118,6 +120,7 @@ files: 
     | 
|
| 
       118 
120 
     | 
    
         
             
            - lib/super_stack/merge_policies/keep_policy.rb
         
     | 
| 
       119 
121 
     | 
    
         
             
            - lib/super_stack/merge_policies/override_policy.rb
         
     | 
| 
       120 
122 
     | 
    
         
             
            - lib/super_stack/merge_policies/standard_merge_policy.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/super_stack/old.rb
         
     | 
| 
       121 
124 
     | 
    
         
             
            - lib/super_stack/version.rb
         
     | 
| 
       122 
125 
     | 
    
         
             
            - spec/layer_spec.rb
         
     | 
| 
       123 
126 
     | 
    
         
             
            - spec/manager_spec.rb
         
     |