config_reader 2.0.0 → 2.0.2

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
- SHA1:
3
- metadata.gz: c70acd1692b08bdedb8f5f0ed7647cdbecda42d7
4
- data.tar.gz: 852b2bddd711ab21984d0049701e38e83295d3f8
2
+ SHA256:
3
+ metadata.gz: d62b191e4d30a81325a11a994d3d663eb2f528bc02307731baae267f2fa08948
4
+ data.tar.gz: ad668aaecbf1670c81f11d277caa7567630d241b0ee6f94cef5d76c2121001b0
5
5
  SHA512:
6
- metadata.gz: 81654334867c8598084c0b66bdbd27abf9af5c4970c049b5b898da732509e1badb07fbebb53721422ce04caacecaa61ebb478b834327390138ab691d6a1c7f1a
7
- data.tar.gz: 1cdb20047b97d4162bc966f2afa7e1235fe80198671bf0509da480ad33da712e50fc1db8a3c5d4f2d20924cbe15af53ba22335d01360a1091c8f6a46e3b2f844
6
+ metadata.gz: 06e2530d3e104ecc1251283aa2e85b9d0a26b4f42eaf8478c8ec34d6d85e2c9a65ba1f0c3da7dec5b75e276591f7dde37fd19ee1aae0a9c8e866fe0852066c71
7
+ data.tar.gz: 63cbd8684f90f35a78c42b91ddb6f88872704b8c5468d5f0d485672c601d73105b2fb11c9083458112030101d5a854cda1f4d2d43723f785ca6d119bd7051560
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - '1.9.3'
4
- - '2.0.0'
5
- - '2.1.1'
3
+ - "2.3.8"
4
+ - "2.4.5"
5
+ - "2.5.3"
6
+ - "2.6.1"
data/CHANGELOG.md ADDED
@@ -0,0 +1,63 @@
1
+ ### 2.0.2 2023-03-11
2
+
3
+ - remove deep-merge dependency
4
+
5
+ ### 2.0.1 2010-03-19
6
+
7
+ - update dependencies
8
+
9
+ ### 1.0.5 2018-02-01
10
+
11
+ - pass ignore_missing_keys to nested hashes during conversion
12
+
13
+ ### 1.0.4 2018-02-01
14
+
15
+ - add a config option for Key Error behavior
16
+
17
+ ### 1.0.3 2017-06-20
18
+
19
+ - add the deep_merge gem so all keys don't need to be duplicated across env sections
20
+
21
+ ### 0.0.9 2012-02-03
22
+
23
+ - Stop abusing Hash, it's not nice
24
+ - convert all keys to symbols internally
25
+ - move to a bundler style gem
26
+
27
+ ### 0.0.8 2011-05-12
28
+
29
+ - Silence RAILS_ENV deprecation, thanks jeanmartin
30
+
31
+ ### 0.0.7 2010-02-14
32
+
33
+ - moved to jeweler
34
+ - removed the annoying post install message
35
+ - updated specs
36
+
37
+ ### 0.0.6 2009-04-02
38
+
39
+ - handle keys as ['foo'], [:foo] and .foo for real this time
40
+ - return nil on non-existent key instead of error
41
+
42
+ ### 0.0.5 2009-01-29
43
+
44
+ - handle keys as ['foo'], [:foo] and .foo
45
+ - return nil on non-existent key instead of error
46
+
47
+ ### 0.0.4 2008-12-08
48
+
49
+ - fix the environment merging issue, for real this time
50
+
51
+ ### 0.0.3 2008-12-02
52
+
53
+ - fix the environment merging issue
54
+
55
+ ### 0.0.2 2008-09-10
56
+
57
+ - have find_config return the file if it exists instead of looking in . and
58
+ ./config
59
+
60
+ ### 0.0.1 2008-08-06
61
+
62
+ - 1 major enhancement:
63
+ - Initial release
data/Gemfile.lock CHANGED
@@ -1,40 +1,49 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- config_reader (2.0.0)
5
- deep_merge
4
+ config_reader (2.0.2)
6
5
 
7
6
  GEM
8
7
  remote: http://rubygems.org/
9
8
  specs:
10
9
  arrayfields (4.9.2)
11
10
  chronic (0.10.2)
12
- coderay (1.1.0)
11
+ coderay (1.1.3)
13
12
  coerce (0.0.8)
14
13
  chronic (>= 0.6.2)
15
- deep_merge (1.1.1)
16
- fattr (2.3.0)
14
+ diff-lcs (1.5.0)
15
+ fattr (2.4.0)
17
16
  highline (1.7.10)
18
- main (6.2.2)
19
- arrayfields (~> 4.7, >= 4.7.4)
20
- chronic (~> 0.6, >= 0.6.2)
21
- fattr (~> 2.2, >= 2.2.0)
22
- map (~> 6.1, >= 6.1.0)
17
+ main (6.3.0)
18
+ arrayfields (~> 4.9, >= 4.9.2)
19
+ chronic (~> 0.10, >= 0.10.2)
20
+ fattr (~> 2.4, >= 2.4.0)
21
+ map (~> 6.6, >= 6.6.0)
23
22
  map (6.6.0)
24
- method_source (0.8.2)
25
- pry (0.9.12.6)
26
- coderay (~> 1.0)
27
- method_source (~> 0.8)
28
- slop (~> 3.4)
29
- rake (0.9.2.2)
30
- rspec (1.3.2)
31
- sekrets (1.10.0)
23
+ method_source (1.0.0)
24
+ pry (0.14.2)
25
+ coderay (~> 1.1)
26
+ method_source (~> 1.0)
27
+ rake (13.0.6)
28
+ rspec (3.12.0)
29
+ rspec-core (~> 3.12.0)
30
+ rspec-expectations (~> 3.12.0)
31
+ rspec-mocks (~> 3.12.0)
32
+ rspec-core (3.12.1)
33
+ rspec-support (~> 3.12.0)
34
+ rspec-expectations (3.12.2)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.12.0)
37
+ rspec-mocks (3.12.3)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.12.0)
40
+ rspec-support (3.12.0)
41
+ sekrets (1.13.0)
32
42
  coerce (~> 0.0.3)
33
43
  fattr (~> 2.2)
34
44
  highline (~> 1.6)
35
45
  main (~> 6.1)
36
46
  map (~> 6.3)
37
- slop (3.5.0)
38
47
 
39
48
  PLATFORMS
40
49
  ruby
@@ -43,8 +52,8 @@ DEPENDENCIES
43
52
  config_reader!
44
53
  pry
45
54
  rake
46
- rspec (= 1.3.2)
55
+ rspec (~> 3.9)
47
56
  sekrets (~> 1)
48
57
 
49
58
  BUNDLED WITH
50
- 1.16.1
59
+ 2.3.13
data/Rakefile CHANGED
@@ -1,9 +1,3 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
- require 'spec/rake/spectask'
4
- Spec::Rake::SpecTask.new(:spec) do |spec|
5
- spec.libs << 'lib' << 'spec'
6
- spec.spec_files = FileList['spec/**/*_spec.rb']
7
- end
8
-
9
3
  task :default => :spec
@@ -0,0 +1 @@
1
+ ecd65abf0eef2de025cf028a84de56bddeb3f6fae18c78565e8f647a3bc79eec777b542c5de26bb74c1c5f7b5cf2ad6eaf71e8061f3729141ac6d38e48367aa7
@@ -11,18 +11,13 @@ Gem::Specification.new do |s|
11
11
  s.summary = %q{Provides a way to manage environment specific configuration settings.}
12
12
  s.description = %q{Provides a way to manage environment specific configuration settings.}
13
13
 
14
- s.rubyforge_project = 'config_reader'
15
-
16
14
  s.files = `git ls-files`.split("\n")
17
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
17
  s.require_paths = ['lib']
20
18
 
21
- # specify any dependencies here; for example:
22
- s.add_dependency 'deep_merge'
23
-
24
19
  s.add_development_dependency 'rake'
25
- s.add_development_dependency 'rspec', '1.3.2'
20
+ s.add_development_dependency 'rspec', '~> 3.9'
26
21
  s.add_development_dependency 'sekrets', '~> 1'
27
22
  s.add_development_dependency 'pry'
28
23
 
@@ -1,3 +1,3 @@
1
1
  class ConfigReader
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.2"
3
3
  end
data/lib/config_reader.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'config_reader/version'
2
2
  require 'config_reader/magic_hash'
3
3
  require 'yaml'
4
- require 'deep_merge'
5
4
 
6
5
  begin
7
6
  require 'erb'
@@ -83,9 +82,9 @@ class ConfigReader
83
82
  env = configuration.environment
84
83
 
85
84
  _conf = conf['defaults']
86
- _conf.deep_merge!(sekrets['defaults']) if sekrets && sekrets['defaults']
87
- _conf.deep_merge!(conf[env]) if conf[env]
88
- _conf.deep_merge!(sekrets[env]) if sekrets && sekrets[env]
85
+ deep_merge!(_conf, sekrets['defaults']) if sekrets && sekrets['defaults']
86
+ deep_merge!(_conf, conf[env]) if conf[env]
87
+ deep_merge!(_conf, sekrets[env]) if sekrets && sekrets[env]
89
88
 
90
89
  MagicHash.convert_hash(_conf, configuration.ignore_missing_keys)
91
90
  end
@@ -99,6 +98,15 @@ class ConfigReader
99
98
  @configuration ||= Configuration.new
100
99
  end
101
100
 
101
+ def deep_merge!(hash, other_hash)
102
+ hash.merge!(other_hash) do |key, this_val, other_val|
103
+ if this_val.is_a?(Hash) && other_val.is_a?(Hash)
104
+ deep_merge!(this_val, other_val)
105
+ else
106
+ other_val
107
+ end
108
+ end
109
+ end
102
110
  end
103
111
 
104
112
  class Configuration
@@ -6,13 +6,13 @@ describe "ConfigReader" do
6
6
  it "should fail with []=" do
7
7
  expect {
8
8
  TestConfig[:app_name] = 'test_app'
9
- }.to raise_error
9
+ }.to raise_error(ArgumentError)
10
10
  end
11
11
 
12
12
  it "should fail with #key =" do
13
13
  expect {
14
14
  TestConfig.app_name = 'test_app'
15
- }.to raise_error
15
+ }.to raise_error(ArgumentError)
16
16
  end
17
17
  end
18
18
 
@@ -70,39 +70,39 @@ describe "ConfigReader" do
70
70
 
71
71
  describe "parsing a YAML file" do
72
72
  it "should find values with method_missing" do
73
- TestConfig.app_name.should == 'test_app'
73
+ expect(TestConfig.app_name).to eq('test_app')
74
74
  end
75
75
 
76
76
  it "should find values using [] and a string" do
77
- TestConfig['app_name'].should == 'test_app'
77
+ expect(TestConfig['app_name']).to eq('test_app')
78
78
  end
79
79
 
80
80
  it "should find values using [] and a symbol" do
81
- TestConfig[:app_name].should == 'test_app'
81
+ expect(TestConfig[:app_name]).to eq('test_app')
82
82
  end
83
83
 
84
84
  it "should find nested values using method_missing" do
85
- TestConfig.nested_key.value.should == 'test'
85
+ expect(TestConfig.nested_key.value).to eq('test')
86
86
  end
87
87
 
88
88
  it "should find nested values using [] and a symbol" do
89
- TestConfig[:nested_key][:value].should == 'test'
89
+ expect(TestConfig[:nested_key][:value]).to eq('test')
90
90
  end
91
91
 
92
92
  it "should find nested values using [] and a string" do
93
- TestConfig['nested_key']['value'].should == 'test'
93
+ expect(TestConfig['nested_key']['value']).to eq('test')
94
94
  end
95
95
 
96
96
  it "should not find sekrets only nested values using method_missing" do
97
- lambda { TestConfig.sekrets_only }.should raise_error
97
+ expect { TestConfig.sekrets_only }.to raise_error(KeyError)
98
98
  end
99
99
 
100
100
  it "should not find sekrets only nested values using [] and a symbol" do
101
- lambda { TestConfig[:sekrets_only][:value] }.should raise_error
101
+ expect { TestConfig[:sekrets_only][:value] }.to raise_error(KeyError)
102
102
  end
103
103
 
104
104
  it "should not find sekrets only nested values using [] and a string" do
105
- lambda { TestConfig['sekrets_only']['value'] }.should raise_error
105
+ expect { TestConfig['sekrets_only']['value'] }.to raise_error(KeyError)
106
106
  end
107
107
 
108
108
  end
@@ -110,43 +110,43 @@ describe "ConfigReader" do
110
110
  context 'using sekrets' do
111
111
  describe "parsing a YAML file" do
112
112
  it "should find values with method_missing" do
113
- SekretsConfig.app_name.should == 'test_app_sekret'
113
+ expect(SekretsConfig.app_name).to eq('test_app_sekret')
114
114
  end
115
115
 
116
116
  it "should find values using [] and a string" do
117
- SekretsConfig['app_name'].should == 'test_app_sekret'
117
+ expect(SekretsConfig['app_name']).to eq('test_app_sekret')
118
118
  end
119
119
 
120
120
  it "should find values using [] and a symbol" do
121
- SekretsConfig[:app_name].should == 'test_app_sekret'
121
+ expect(SekretsConfig[:app_name]).to eq('test_app_sekret')
122
122
  end
123
123
 
124
124
  it "should find nested values using method_missing" do
125
- SekretsConfig.nested_key.value.should == 'test_sekret'
125
+ expect(SekretsConfig.nested_key.value).to eq('test_sekret')
126
126
  end
127
127
 
128
128
  it "should find nested values using [] and a symbol" do
129
- SekretsConfig[:nested_key][:value].should == 'test_sekret'
129
+ expect(SekretsConfig[:nested_key][:value]).to eq('test_sekret')
130
130
  end
131
131
 
132
132
  it "should find nested values using [] and a string" do
133
- SekretsConfig['nested_key']['value'].should == 'test_sekret'
133
+ expect(SekretsConfig['nested_key']['value']).to eq('test_sekret')
134
134
  end
135
135
 
136
136
  it "should find sekrets only nested values using method_missing" do
137
- SekretsConfig.nested_key.value.should == 'test_sekret'
137
+ expect(SekretsConfig.nested_key.value).to eq('test_sekret')
138
138
  end
139
139
 
140
140
  it "should find sekrets only nested values using [] and a symbol" do
141
- SekretsConfig[:nested_key][:value].should == 'test_sekret'
141
+ expect(SekretsConfig[:nested_key][:value]).to eq('test_sekret')
142
142
  end
143
143
 
144
144
  it "should find sekrets only nested values using [] and a string" do
145
- SekretsConfig['nested_key']['value'].should == 'test_sekret'
145
+ expect(SekretsConfig['nested_key']['value']).to eq('test_sekret')
146
146
  end
147
147
 
148
148
  it "shouldn't need to have all keys duplicated in the environment section" do
149
- SekretsConfig.nested_key.only_in_test_env.should == true
149
+ expect(SekretsConfig.nested_key.only_in_test_env).to be true
150
150
  end
151
151
  end
152
152
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
- require 'spec'
3
+
4
4
  require 'config_reader'
5
5
  require 'test_config'
6
6
  require 'sekrets_config'
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Moen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-03 00:00:00.000000000 Z
11
+ date: 2023-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: deep_merge
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +28,16 @@ dependencies:
42
28
  name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '='
31
+ - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 1.3.2
33
+ version: '3.9'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - '='
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: 1.3.2
40
+ version: '3.9'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: sekrets
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -89,12 +75,13 @@ extra_rdoc_files: []
89
75
  files:
90
76
  - ".gitignore"
91
77
  - ".travis.yml"
78
+ - CHANGELOG.md
92
79
  - Gemfile
93
80
  - Gemfile.lock
94
- - History.rdoc
95
81
  - License.txt
96
82
  - README.rdoc
97
83
  - Rakefile
84
+ - checksums/config_reader-2.0.2.gem.sha512
98
85
  - config_reader.gemspec
99
86
  - lib/config_reader.rb
100
87
  - lib/config_reader/magic_hash.rb
@@ -125,9 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
112
  - !ruby/object:Gem::Version
126
113
  version: '0'
127
114
  requirements: []
128
- rubyforge_project: config_reader
129
- rubygems_version: 2.6.13
130
- signing_key:
115
+ rubygems_version: 3.2.33
116
+ signing_key:
131
117
  specification_version: 4
132
118
  summary: Provides a way to manage environment specific configuration settings.
133
119
  test_files:
data/History.rdoc DELETED
@@ -1,44 +0,0 @@
1
- == 1.0.5 2018-02-01
2
- * pass ignore_missing_keys to nested hashes during conversion
3
-
4
- == 1.0.4 2018-02-01
5
- * add a config option for Key Error behavior
6
-
7
- == 1.0.3 2017-06-20
8
- * add the deep_merge gem so all keys don't need to be duplicated across env sections
9
-
10
- == 0.0.9 2012-02-03
11
- * Stop abusing Hash, it's not nice
12
- * convert all keys to symbols internally
13
- * move to a bundler style gem
14
-
15
- == 0.0.8 2011-05-12
16
- * Silence RAILS_ENV deprecation, thanks jeanmartin
17
-
18
- == 0.0.7 2010-02-14
19
- * moved to jeweler
20
- * removed the annoying post install message
21
- * updated specs
22
-
23
- == 0.0.6 2009-04-02
24
- * handle keys as ['foo'], [:foo] and .foo for real this time
25
- * return nil on non-existent key instead of error
26
-
27
- == 0.0.5 2009-01-29
28
- * handle keys as ['foo'], [:foo] and .foo
29
- * return nil on non-existent key instead of error
30
-
31
- == 0.0.4 2008-12-08
32
- * fix the environment merging issue, for real this time
33
-
34
- == 0.0.3 2008-12-02
35
- * fix the environment merging issue
36
-
37
- == 0.0.2 2008-09-10
38
- * have find_config return the file if it exists instead of looking in . and
39
- ./config
40
-
41
- == 0.0.1 2008-08-06
42
-
43
- * 1 major enhancement:
44
- * Initial release