a9n 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -4
- data/lib/a9n.rb +4 -0
- data/lib/a9n/struct.rb +4 -0
- data/lib/a9n/version.rb +1 -1
- data/spec/a9n_spec.rb +3 -0
- data/spec/struct_spec.rb +10 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -14,13 +14,31 @@ And then execute:
|
|
14
14
|
|
15
15
|
$ bundle
|
16
16
|
|
17
|
-
Add `configuration.yml.example` and/or `configuration.yml` file into the config
|
18
|
-
When none fo these files exists, `A9n::MissingConfigurationFile`
|
19
|
-
|
17
|
+
Add `configuration.yml.example` and/or `configuration.yml` file into the config
|
18
|
+
directory. When none fo these files exists, `A9n::MissingConfigurationFile`
|
19
|
+
exception is thrown.
|
20
|
+
If both file exist, content of `configuration.yml` is validated. It means that
|
21
|
+
all keys existing in example file must exist in base file - in case of missing
|
22
|
+
keys`A9n::MissingConfigurationVariables` is thrown with information about
|
23
|
+
missing keys.
|
24
|
+
|
25
|
+
Load configuration by adding to your `application.rb` or `environment.rb` right
|
26
|
+
after budler requires:
|
27
|
+
|
28
|
+
A9n.load
|
29
|
+
|
30
|
+
This step is not required, but recommended, as it configuration is loaded and
|
31
|
+
verified on evironment load.
|
32
|
+
|
33
|
+
It works with `Rails` by default. If you want to use `A9n` with non-rails app
|
34
|
+
you need to tell it A9n:
|
35
|
+
|
36
|
+
A9n.local_app = MyApp
|
20
37
|
|
21
38
|
## Usage
|
22
39
|
|
23
|
-
You can access any variable defined in configuration files but delegating it to
|
40
|
+
You can access any variable defined in configuration files but delegating it to
|
41
|
+
`A9n`. E.g:
|
24
42
|
|
25
43
|
production:
|
26
44
|
app_host: 'http://knapo.net'
|
data/lib/a9n.rb
CHANGED
data/lib/a9n/struct.rb
CHANGED
data/lib/a9n/version.rb
CHANGED
data/spec/a9n_spec.rb
CHANGED
data/spec/struct_spec.rb
CHANGED
@@ -36,4 +36,14 @@ describe A9n::Struct do
|
|
36
36
|
subject.non_existing_dwarf
|
37
37
|
}.to raise_error(A9n::NoSuchConfigurationVariable)
|
38
38
|
end
|
39
|
+
|
40
|
+
describe '#fetch' do
|
41
|
+
it 'return non empty value' do
|
42
|
+
subject.fetch(:non_empty_dwarf).should == 'dwarf'
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'not returns nil for non existing value' do
|
46
|
+
subject.fetch(:non_existing_dwarf).should == nil
|
47
|
+
end
|
48
|
+
end
|
39
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: a9n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Simple tool for managing app configuration
|
15
15
|
email:
|