eac_config 0.5.2 → 0.5.3
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/lib/eac_config/paths_hash.rb +7 -0
- data/lib/eac_config/rspec/setup.rb +15 -3
- data/lib/eac_config/version.rb +1 -1
- data/lib/eac_config/yaml_file_node/entry.rb +2 -3
- data/lib/eac_config/yaml_file_node.rb +10 -11
- metadata +4 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7f130e01595ad39a2e0b0f6fb1ece9f21f8d61eaaa434746837478d60e825dc5
         | 
| 4 | 
            +
              data.tar.gz: 660bed3f2ed1991fba8be9818e05f0263df90190c6c857695ba02b2283630e60
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f0cdc6364af4f758d3cb3c94b10bdadbc2124cfc1a0c2990e119be4df95b90c70ffd1d09fb17bc5ee4f5726b09499361b3f8f82d4f6b6544f7d8f58e8e38ff45
         | 
| 7 | 
            +
              data.tar.gz: 58c59eecee35069c78de153071a281f6e04914a12b3948b67b35e57b861cb101f8f419126c5c3c27432ef4ca055a8b509ec7d96bc9c030cfc08cf80bd8cd9a54
         | 
| @@ -7,11 +7,23 @@ module EacConfig | |
| 7 7 | 
             
              module Rspec
         | 
| 8 8 | 
             
                module Setup
         | 
| 9 9 | 
             
                  def self.extended(obj)
         | 
| 10 | 
            -
                    obj. | 
| 10 | 
            +
                    obj.rspec_config.around do |example|
         | 
| 11 | 
            +
                      obj.on_envvars_load_path_clean(example)
         | 
| 12 | 
            +
                    end
         | 
| 11 13 | 
             
                  end
         | 
| 12 14 |  | 
| 13 | 
            -
                  def  | 
| 14 | 
            -
                     | 
| 15 | 
            +
                  def on_envvars_load_path_clean(example)
         | 
| 16 | 
            +
                    old_value = envvars_load_path_entry.value
         | 
| 17 | 
            +
                    begin
         | 
| 18 | 
            +
                      envvars_load_path_entry.value = old_value = []
         | 
| 19 | 
            +
                      example.run
         | 
| 20 | 
            +
                    ensure
         | 
| 21 | 
            +
                      envvars_load_path_entry.value = old_value
         | 
| 22 | 
            +
                    end
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  def envvars_load_path_entry
         | 
| 26 | 
            +
                    ::EacConfig::EnvvarsNode.new.load_path.entry
         | 
| 15 27 | 
             
                  end
         | 
| 16 28 | 
             
                end
         | 
| 17 29 | 
             
              end
         | 
    
        data/lib/eac_config/version.rb
    CHANGED
    
    
| @@ -18,14 +18,13 @@ module EacConfig | |
| 18 18 | 
             
                  end
         | 
| 19 19 |  | 
| 20 20 | 
             
                  def value=(a_value)
         | 
| 21 | 
            -
                    paths_hash | 
| 22 | 
            -
                    node.persist_data(paths_hash.root.to_h)
         | 
| 21 | 
            +
                    node.persist_data(paths_hash.write(to_paths_hash_key, a_value).root.to_h)
         | 
| 23 22 | 
             
                  end
         | 
| 24 23 |  | 
| 25 24 | 
             
                  private
         | 
| 26 25 |  | 
| 27 26 | 
             
                  # @return [EacConfig::PathsHash]
         | 
| 28 | 
            -
                  def  | 
| 27 | 
            +
                  def paths_hash
         | 
| 29 28 | 
             
                    ::EacConfig::PathsHash.new(node.data)
         | 
| 30 29 | 
             
                  end
         | 
| 31 30 |  | 
| @@ -9,6 +9,7 @@ module EacConfig | |
| 9 9 | 
             
              class YamlFileNode
         | 
| 10 10 | 
             
                require_sub __FILE__
         | 
| 11 11 | 
             
                include ::EacConfig::Node
         | 
| 12 | 
            +
                enable_simple_cache
         | 
| 12 13 |  | 
| 13 14 | 
             
                class << self
         | 
| 14 15 | 
             
                  def from_uri(uri)
         | 
| @@ -20,14 +21,10 @@ module EacConfig | |
| 20 21 | 
             
                  self.path = path.to_pathname
         | 
| 21 22 | 
             
                end
         | 
| 22 23 |  | 
| 23 | 
            -
                def data
         | 
| 24 | 
            -
                  @data ||= ::EacRubyUtils::Yaml.load_file(assert_path) || {}
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 24 | 
             
                def persist_data(new_data)
         | 
| 28 25 | 
             
                  path.parent.mkpath
         | 
| 29 26 | 
             
                  ::EacRubyUtils::Yaml.dump_file(path, new_data)
         | 
| 30 | 
            -
                   | 
| 27 | 
            +
                  reset_cache(:data)
         | 
| 31 28 | 
             
                end
         | 
| 32 29 |  | 
| 33 30 | 
             
                def url
         | 
| @@ -36,13 +33,15 @@ module EacConfig | |
| 36 33 |  | 
| 37 34 | 
             
                private
         | 
| 38 35 |  | 
| 39 | 
            -
                def  | 
| 40 | 
            -
                   | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 36 | 
            +
                def data_uncached
         | 
| 37 | 
            +
                  r = nil
         | 
| 38 | 
            +
                  if path.file?
         | 
| 39 | 
            +
                    r = ::EacRubyUtils::Yaml.load_file(path)
         | 
| 40 | 
            +
                  elsif path.exist?
         | 
| 41 | 
            +
                    raise("\"#{path}\" is a not a file")
         | 
| 44 42 | 
             
                  end
         | 
| 45 | 
            -
             | 
| 43 | 
            +
             | 
| 44 | 
            +
                  r.is_a?(::Hash) ? r : {}
         | 
| 46 45 | 
             
                end
         | 
| 47 46 | 
             
              end
         | 
| 48 47 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: eac_config
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.5. | 
| 4 | 
            +
              version: 0.5.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Put here the authors
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021-12- | 
| 11 | 
            +
            date: 2021-12-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: addressable
         | 
| @@ -30,14 +30,14 @@ dependencies: | |
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - "~>"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: '0. | 
| 33 | 
            +
                    version: '0.81'
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: '0. | 
| 40 | 
            +
                    version: '0.81'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: eac_ruby_gem_support
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         |