armoire 1.0.2 → 1.1.0

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: 12e1b6217a6f9e0ced2ead6581ee0f2b83dd360e
4
- data.tar.gz: 77f8b1ea146546d84ceac5a3c70a86bbacdd4fc4
3
+ metadata.gz: 52c4786f90e54eb7785eac1dc783ca4d1511bdd8
4
+ data.tar.gz: 78f7ecb51b60b45461aaf28bffbb20ac20c7d485
5
5
  SHA512:
6
- metadata.gz: ade220baa8a90c7efb5cc6c640fdb51e4a744a50c39531f9ea0443665c8b23b450e8525e25986db66cd4bbb6d35b9890112acf8f0684551a2bbf1f7ccd65ad40
7
- data.tar.gz: 430de152917fdc5237941117aa0834b910763eb586f1d918da7e5c7d20baa01b7884890197d5c7c861cfd2c83b3e0a41a7e54e0b094cd07de56f1ce1f11d6765
6
+ metadata.gz: 334335be1f98a456ab2e5cea6197dddba01c0e6660cd49726374afb9f235f72385e1dd9df8f21d6bd888100e647c47c43d34d9b531678a8ab99d3d0039aa4ecc
7
+ data.tar.gz: a4cf8d744be65d36c0695ef747229415a9a831fa484b3d73cbdec4696f38e41b44d48f330b3b4277198a0724c9a1e5932a3f99741ccc07385cf4cf65bad3338a
data/.travis.yml CHANGED
@@ -4,4 +4,4 @@ rvm:
4
4
  - "1.9.3"
5
5
  - "2.0.0"
6
6
  - jruby-19mode # JRuby in 1.9 mode
7
- - rbx-19mode
7
+ - rbx-2.1.1
data/README.md CHANGED
@@ -40,8 +40,19 @@ Armoire should be simple. Simply create a yaml file in `config/application.yml`
40
40
 
41
41
  Simply call `Armoire["foo"]` to get `"bar"` or `Armoire["nested_options"]["nested_foo"]` to get `"nested_bar"`. Any ERB will be parsed when the config file is loaded. If a configuration option is missing, it will throw an `Armoire::ConfigSettingMissing` exception.
42
42
 
43
+ You may also call keys with any object that responds to `#to_s` and armoire will work correctly, e.g. `Armoire[:foo]`.
44
+
43
45
  The configuration environment will initially be taken from `ENV['RAILS_ENV']`, then `ENV['RACK_ENV']` and if neither exist then it will fall back to `development`
44
46
 
47
+ ### Usage in Rails
48
+
49
+ This gem has a Railtie that automatically loads Armoire as early as it can in the load process, this means that Armoire will be available everywhere in your Rails application.
50
+
51
+ ### Usage in other frameworks
52
+
53
+ You need to tell Armoire to load your settings as early in the initialisation process as possible by doing:
54
+
55
+ Armoire.load! File.expand_path('config/application.yml', File.dirname(__FILE__))
45
56
 
46
57
  ## Contributing
47
58
 
@@ -5,7 +5,7 @@ class Armoire
5
5
  end
6
6
 
7
7
  def [](key)
8
- value = setting.fetch(key) do
8
+ value = setting.fetch(key.to_s) do
9
9
  raise ConfigSettingMissing, %Q{"#{key}" is not set}
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  class Armoire
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -63,6 +63,12 @@ describe Armoire do
63
63
  it { expect(subject).to eql("simple_config_option_value") }
64
64
  end
65
65
 
66
+ context "referencing key via symbol instead of string" do
67
+ subject { Armoire[:simple_config_option] }
68
+
69
+ it { expect(subject).to eql("simple_config_option_value") }
70
+ end
71
+
66
72
  context "erb config option" do
67
73
  subject { Armoire["erb_config_option"] }
68
74
 
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  ENV['RACK_ENV'] = 'test'
2
2
 
3
- require 'simplecov'
4
- SimpleCov.start
3
+ unless defined?(Rubinius)
4
+ require 'simplecov'
5
+ SimpleCov.start
6
+ end
5
7
 
6
8
  require 'armoire'
7
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: armoire
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-20 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler