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 +4 -4
- data/.gem_release.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/anyway_config.gemspec +2 -2
- data/lib/anyway/env.rb +5 -0
- data/lib/anyway/version.rb +1 -1
- data/spec/env_spec.rb +14 -0
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db098e908ecf04ec8523fd1199f23462df7eefea
|
4
|
+
data.tar.gz: fd8770bdf03bdd16a3fe3a515e40edcfe3b5eab5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4993cf6d2038dc2c0c756871a03ede8ae4eec98bac081dfb660a8293d300cecfffcf10dce5025cf1c155a170d1b6e141b939390a1a30871ba21b685febf9d72
|
7
|
+
data.tar.gz: 40a5bf95d4736a3d5ffbe74cce3104d10e939a00e598ab77c4b47817c96f243571c66a7f21144719057bdcdcb51b8ac1b6bb878ec2c09300ef94ce29200a7e35
|
data/.gem_release.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/anyway_config.gemspec
CHANGED
@@ -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 "
|
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
|
data/lib/anyway/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
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:
|
26
|
+
version: '3.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
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:
|
40
|
+
version: '0.49'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
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:
|
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"
|