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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae749330c14b4055e3f45286b3c30036f5e8eeee
4
- data.tar.gz: 87e0b4ec76ad3f9a923bd0124732f8de3909c499
3
+ metadata.gz: f627d3cd5d6271964448e0d68b12604103e1dc4b
4
+ data.tar.gz: 3190d9dbb17ec7b53f6ea0dfa87614e777579ebb
5
5
  SHA512:
6
- metadata.gz: ce883b8f16a952fb8f9e459c43d2702e32f8f5c98fe2066b0363b3d676370926ef96b09380e97b5f65639a64e7699d49327e980840dc68d6e50e4e968bea9862
7
- data.tar.gz: ddf297e0d4e4eb77f8e2d9b7af228c22b067034af11cd36ceaf3ed579ee8799b473ebf9598d10b213f21ce2bfb1f2cd7a4207f57cd36a7a767df97bd866703f8
6
+ metadata.gz: 8d184f3bc4f6e5f937af4386f10ab37411d0c3757ceae31b0cc9ac3545b1dc0ce6c9b958caf3a123896d506d494940fe43986185054efebc630fa795b6b50b68
7
+ data.tar.gz: ff6236376dea77f27dd52ac27a9accde4ebf09e36f968800dcbcf595f280054076873990ea3087ef47934bc1fd35dba51a91518b976b3b52dbe454acfad46376
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- config_reader (1.0.0)
4
+ config_reader (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -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.env
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
@@ -19,7 +19,7 @@ class ConfigReader
19
19
  fetch(key.to_sym)
20
20
  end
21
21
 
22
- def method_missing(key)
22
+ def method_missing(key, *args, &block)
23
23
  has_key?(key) ?
24
24
  fetch(key) :
25
25
  super
@@ -1,3 +1,3 @@
1
1
  class ConfigReader
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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.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-04-14 00:00:00.000000000 Z
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: