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 +4 -4
- data/.travis.yml +1 -1
- data/README.md +11 -0
- data/lib/armoire/setting.rb +1 -1
- data/lib/armoire/version.rb +1 -1
- data/spec/lib/armoire_spec.rb +6 -0
- data/spec/spec_helper.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c4786f90e54eb7785eac1dc783ca4d1511bdd8
|
4
|
+
data.tar.gz: 78f7ecb51b60b45461aaf28bffbb20ac20c7d485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 334335be1f98a456ab2e5cea6197dddba01c0e6660cd49726374afb9f235f72385e1dd9df8f21d6bd888100e647c47c43d34d9b531678a8ab99d3d0039aa4ecc
|
7
|
+
data.tar.gz: a4cf8d744be65d36c0695ef747229415a9a831fa484b3d73cbdec4696f38e41b44d48f330b3b4277198a0724c9a1e5932a3f99741ccc07385cf4cf65bad3338a
|
data/.travis.yml
CHANGED
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
|
|
data/lib/armoire/setting.rb
CHANGED
data/lib/armoire/version.rb
CHANGED
data/spec/lib/armoire_spec.rb
CHANGED
@@ -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
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
|
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-
|
11
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|