a9n 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/a9n.rb +2 -1
- data/lib/a9n/version.rb +1 -1
- data/spec/a9n_spec.rb +8 -1
- data/spec/fixtures/configuration.yml +2 -0
- 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: 8f5b7d977cad5181d1070ecc6a5240c2f80ed3a3
|
4
|
+
data.tar.gz: 50a227050f8c9e156bad316f84895d5d0934a89a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6760f53728213060159ff65fde0270293ea12eb7fe1a726d22a5ca9c593b4102ad9ac2b04f4528d80625b08a827c52a181957a29b306332443f2b5e327ace0cb
|
7
|
+
data.tar.gz: 75c80917c3058b11edbed561351ca9ff62fe26e3771de0120301d01e0979a1efeae872bcec96cf8252365acc2d4be497cdac075c9eed2b378b31e6fa9f2f46d3
|
data/lib/a9n.rb
CHANGED
@@ -2,6 +2,7 @@ require 'a9n/version'
|
|
2
2
|
require 'a9n/struct'
|
3
3
|
require 'a9n/core_ext/hash'
|
4
4
|
require 'yaml'
|
5
|
+
require 'erb'
|
5
6
|
|
6
7
|
module A9n
|
7
8
|
class ConfigurationNotLoaded < StandardError; end
|
@@ -59,7 +60,7 @@ module A9n
|
|
59
60
|
def load_yml(file)
|
60
61
|
path = File.join(self.root, file)
|
61
62
|
return unless File.exists?(path)
|
62
|
-
yml = YAML.
|
63
|
+
yml = YAML.load(ERB.new(File.read(path)).result)
|
63
64
|
|
64
65
|
if yml[self.env].is_a?(Hash)
|
65
66
|
return yml[self.env].deep_symbolize_keys
|
data/lib/a9n/version.rb
CHANGED
data/spec/a9n_spec.rb
CHANGED
@@ -143,7 +143,10 @@ describe A9n do
|
|
143
143
|
|
144
144
|
context 'when file exists' do
|
145
145
|
let(:file_path) { 'fixtures/configuration.yml'}
|
146
|
-
before {
|
146
|
+
before {
|
147
|
+
ENV['DWARF'] = 'erbized dwarf'
|
148
|
+
described_class.should_receive(:env).twice.and_return(env)
|
149
|
+
}
|
147
150
|
|
148
151
|
context 'and has data' do
|
149
152
|
let(:env) { 'test' }
|
@@ -158,6 +161,10 @@ describe A9n do
|
|
158
161
|
subject[:hash_dwarf].should be_kind_of(Hash)
|
159
162
|
subject[:hash_dwarf].keys.first.should be_kind_of(Symbol)
|
160
163
|
end
|
164
|
+
|
165
|
+
it 'parses erb' do
|
166
|
+
subject[:erb_dwarf].should == 'erbized dwarf'
|
167
|
+
end
|
161
168
|
end
|
162
169
|
|
163
170
|
context 'and has no data' do
|
@@ -3,6 +3,7 @@ development:
|
|
3
3
|
false_dwarf: false
|
4
4
|
true_dwarf: true
|
5
5
|
string_dwarf: "dwarf"
|
6
|
+
erb_dwarf: "<%= ENV['DWARF'] %>"
|
6
7
|
hash_dwarf:
|
7
8
|
dwarf_1: "hello 1"
|
8
9
|
dwarf_2: "hello 2"
|
@@ -11,6 +12,7 @@ test:
|
|
11
12
|
false_dwarf: false
|
12
13
|
true_dwarf: true
|
13
14
|
string_dwarf: "dwarf"
|
15
|
+
erb_dwarf: "<%= ENV['DWARF'] %>"
|
14
16
|
hash_dwarf:
|
15
17
|
dwarf_1: "hello 1"
|
16
18
|
dwarf_2: "hello 2"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: a9n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Knapik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simple tool for managing app configuration
|
14
14
|
email:
|