anyway_config 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f61c3efab21364fb9d6f502183bcf2a15edd5207
4
- data.tar.gz: '08ca86bbc7687a451f035051d9584a7d8b76c955'
3
+ metadata.gz: db098e908ecf04ec8523fd1199f23462df7eefea
4
+ data.tar.gz: fd8770bdf03bdd16a3fe3a515e40edcfe3b5eab5
5
5
  SHA512:
6
- metadata.gz: e665ffd00ff4b055cfc4eaece0f9aec66e69638fd7a18b4151d740c6e434678764c8bbbbaf2852238ad2c2f6551826e9d619cf8d592ec7f2d974763c44507b1a
7
- data.tar.gz: f259801f4db6626cc0356c07439dda350718c08073db6e4a40c891e8c45820dde4eb3f87812478936902eee2cca7def1859e0d13a10740912fb9ca7af2f65c21
6
+ metadata.gz: b4993cf6d2038dc2c0c756871a03ede8ae4eec98bac081dfb660a8293d300cecfffcf10dce5025cf1c155a170d1b6e141b939390a1a30871ba21b685febf9d72
7
+ data.tar.gz: 40a5bf95d4736a3d5ffbe74cce3104d10e939a00e598ab77c4b47817c96f243571c66a7f21144719057bdcdcb51b8ac1b6bb878ec2c09300ef94ce29200a7e35
data/.gem_release.yml ADDED
@@ -0,0 +1,3 @@
1
+ bump:
2
+ file: lib/anyway/version.rb
3
+ skip_ci: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ ## 1.1.1 (2017-10-21)
4
+
5
+ - Return deep duplicate of a Hash in `Env#fetch`. ([@palkan][])
6
+
3
7
  ## 1.1.0 (2017-10-06)
4
8
 
5
9
  - Add `#to_h` method. ([@palkan][])
data/README.md CHANGED
@@ -22,7 +22,7 @@ Libraries using Anyway Config:
22
22
  # my-cool-gem.gemspec
23
23
  Gem::Specification.new do |spec|
24
24
  ...
25
- spec.add_dependancy "anyway_config", "~> 1.0"
25
+ spec.add_dependency "anyway_config", "~> 1.0"
26
26
  ...
27
27
  end
28
28
  ```
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.require_paths = ["lib"]
24
24
  s.required_ruby_version = '>= 2.2'
25
25
 
26
- s.add_development_dependency "simplecov", ">= 0.3.8"
27
- s.add_development_dependency "rspec", "~> 3.5.0"
26
+ s.add_development_dependency "rspec", "~> 3.5"
28
27
  s.add_development_dependency "rubocop", "~> 0.49"
28
+ s.add_development_dependency "simplecov", ">= 0.3.8"
29
29
  end
data/lib/anyway/env.rb CHANGED
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'anyway/ext/deep_dup'
4
+
3
5
  module Anyway
4
6
  # Parses environment variables and provides
5
7
  # method-like access
6
8
  class Env
9
+ using Anyway::Ext::DeepDup
10
+
7
11
  # Regexp to detect array values
8
12
  # Array value is a values that contains at least one comma
9
13
  # and doesn't start/end with quote
@@ -19,6 +23,7 @@ module Anyway
19
23
 
20
24
  def fetch(config_name)
21
25
  @data[config_name] ||= parse_env(config_name)
26
+ @data[config_name].deep_dup
22
27
  end
23
28
 
24
29
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyway # :nodoc:
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
data/spec/env_spec.rb CHANGED
@@ -33,4 +33,18 @@ describe Anyway::Env do
33
33
  expect(testo_config['data']['meta']['size']).to eq 2
34
34
  expect(testo_config['data']['text']).to eq "C'mon, everybody"
35
35
  end
36
+
37
+ it "returns deep duped hash" do
38
+ ENV['TESTO_CONF'] = 'path/to/conf.yml'
39
+ ENV['TESTO_DATA__ID'] = '1'
40
+ ENV['TESTO_DATA__META__NAME'] = 'meta'
41
+ ENV['TESTO_DATA__META__VAL'] = 'true'
42
+ testo_config = env.fetch('testo')
43
+ testo_config.delete('conf')
44
+ testo_config['data']['meta'].delete('name')
45
+
46
+ new_config = env.fetch('testo')
47
+ expect(new_config['data']['meta']['name']).to eq 'meta'
48
+ expect(new_config['conf']).to eq 'path/to/conf.yml'
49
+ end
36
50
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyway_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-06 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: simplecov
14
+ name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.8
19
+ version: '3.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.8
26
+ version: '3.5'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: rubocop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.5.0
33
+ version: '0.49'
34
34
  type: :development
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: 3.5.0
40
+ version: '0.49'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rubocop
42
+ name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.49'
47
+ version: 0.3.8
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.49'
54
+ version: 0.3.8
55
55
  description: "\n Configuration DSL for Ruby libraries and applications.\n\n Allows
56
56
  you to easily follow the twelve-factor application principles (https://12factor.net/config).\n
57
57
  \ "
@@ -61,6 +61,7 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - ".gem_release.yml"
64
65
  - ".gitignore"
65
66
  - ".rubocop.yml"
66
67
  - ".travis.yml"