a9n 0.0.9 → 0.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: b01b4015b7d9a3157c912da8f054f929ce060aab
4
- data.tar.gz: cbc3a39746c6ffd37bc49f730a0498ca97fcdbc3
3
+ metadata.gz: 8f5b7d977cad5181d1070ecc6a5240c2f80ed3a3
4
+ data.tar.gz: 50a227050f8c9e156bad316f84895d5d0934a89a
5
5
  SHA512:
6
- metadata.gz: 750f4617aee328ec0c82c02c49f1f0d48712f348de21f1b466097d64dd0299684d35452d12f75b1f23c74ee44e8195f052b41b21551dac1b3ed221ca0eaf3f6f
7
- data.tar.gz: e9eda5c59a356523a20a03a141bf6a20f2f1d29c4c8907d7e153f87c0f9198f0a87561d0355531f1f88c8d93fcaaa82e7e30576ef860faa2161225aa96491cf5
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.load_file(path)
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
@@ -1,3 +1,3 @@
1
1
  module A9n
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -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 { described_class.should_receive(:env).twice.and_return(env) }
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.9
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-05 00:00:00.000000000 Z
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: