simple-conf 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -2
- data/lib/simple-conf/loader.rb +3 -1
- data/lib/simple-conf/version.rb +1 -1
- data/spec/simple_conf_spec.rb +6 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SimpleConf
|
2
2
|
|
3
|
-
|
3
|
+
Simple configuration library for the loading yml files from the config folder.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,31 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Define in your project class like:
|
22
|
+
|
23
|
+
```
|
24
|
+
class Configuration
|
25
|
+
include SimpleConf
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
Create in the config folder configuration.yml file with content like:
|
30
|
+
|
31
|
+
```
|
32
|
+
staging:
|
33
|
+
domain: "staging.example.com"
|
34
|
+
links:
|
35
|
+
- test1.example.com
|
36
|
+
- test2.example.com
|
37
|
+
production:
|
38
|
+
domain: "production.example.com"
|
39
|
+
|
40
|
+
Now you can use your file in the project:
|
41
|
+
|
42
|
+
```
|
43
|
+
puts Configuration.staging.domain
|
44
|
+
puts Configuration.production.domain
|
45
|
+
```
|
22
46
|
|
23
47
|
## Contributing
|
24
48
|
|
data/lib/simple-conf/loader.rb
CHANGED
data/lib/simple-conf/version.rb
CHANGED
data/spec/simple_conf_spec.rb
CHANGED
@@ -8,6 +8,12 @@ class Options
|
|
8
8
|
include SimpleConf
|
9
9
|
end
|
10
10
|
|
11
|
+
module ConfigModule
|
12
|
+
class Options
|
13
|
+
include SimpleConf
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
11
17
|
describe SimpleConf do
|
12
18
|
context "on include to config class generate properties" do
|
13
19
|
it { Configuration.staging.domain.should == "staging.example.com" }
|