config_reader 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/config_reader.gemspec +1 -1
- data/lib/config_reader.rb +8 -4
- data/lib/config_reader/magic_hash.rb +1 -1
- data/lib/config_reader/version.rb +1 -1
- data/spec/config_reader_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f627d3cd5d6271964448e0d68b12604103e1dc4b
|
4
|
+
data.tar.gz: 3190d9dbb17ec7b53f6ea0dfa87614e777579ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d184f3bc4f6e5f937af4386f10ab37411d0c3757ceae31b0cc9ac3545b1dc0ce6c9b958caf3a123896d506d494940fe43986185054efebc630fa795b6b50b68
|
7
|
+
data.tar.gz: ff6236376dea77f27dd52ac27a9accde4ebf09e36f968800dcbcf595f280054076873990ea3087ef47934bc1fd35dba51a91518b976b3b52dbe454acfad46376
|
data/Gemfile.lock
CHANGED
data/config_reader.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = ConfigReader::VERSION
|
8
8
|
s.authors = ['Michael Moen']
|
9
9
|
s.email = ['michael@underpantsgnome.com']
|
10
|
-
s.homepage = ''
|
10
|
+
s.homepage = 'https://github.com/UnderpantsGnome/config_reader-gem'
|
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
|
|
data/lib/config_reader.rb
CHANGED
@@ -22,8 +22,6 @@ class ConfigReader
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def reload
|
25
|
-
# require 'pry'
|
26
|
-
# binding.pry
|
27
25
|
merge_configs(find_env, load_config, load_sekrets)
|
28
26
|
end
|
29
27
|
|
@@ -42,7 +40,11 @@ class ConfigReader
|
|
42
40
|
''
|
43
41
|
end
|
44
42
|
|
45
|
-
def method_missing(key)
|
43
|
+
def method_missing(key, *args, &block)
|
44
|
+
if key.to_s.end_with?('=')
|
45
|
+
raise ArgumentError.new('ConfigReader is immutable')
|
46
|
+
end
|
47
|
+
|
46
48
|
config[key] || nil
|
47
49
|
end
|
48
50
|
|
@@ -51,7 +53,9 @@ class ConfigReader
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def find_env
|
54
|
-
if defined?(Rails) && Rails.
|
56
|
+
if defined?(Rails) && Rails.stage
|
57
|
+
Rails.stage
|
58
|
+
elsif defined?(Rails) && Rails.env
|
55
59
|
Rails.env
|
56
60
|
elsif defined?(RAILS_ENV)
|
57
61
|
RAILS_ENV
|
data/spec/config_reader_spec.rb
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "ConfigReader" do
|
4
|
+
describe "setting values" do
|
5
|
+
|
6
|
+
it "should fail with []=" do
|
7
|
+
expect {
|
8
|
+
TestConfig[:app_name] = 'test_app'
|
9
|
+
}.to raise_error
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should fail with #key =" do
|
13
|
+
expect {
|
14
|
+
TestConfig.app_name = 'test_app'
|
15
|
+
}.to raise_error
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
4
19
|
describe "parsing a YAML file" do
|
5
20
|
it "should find values with method_missing" do
|
6
21
|
TestConfig.app_name.should == 'test_app'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Moen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -91,7 +91,7 @@ files:
|
|
91
91
|
- spec/spec_helper.rb
|
92
92
|
- spec/test_config.rb
|
93
93
|
- spec/test_config.yml
|
94
|
-
homepage:
|
94
|
+
homepage: https://github.com/UnderpantsGnome/config_reader-gem
|
95
95
|
licenses: []
|
96
96
|
metadata: {}
|
97
97
|
post_install_message:
|