figleaf 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +18 -3
- data/lib/figleaf/load_settings.rb +0 -1
- data/lib/figleaf/version.rb +1 -1
- metadata +3 -3
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
# Figleaf
|
2
2
|
[![Build Status](https://secure.travis-ci.org/challengepost/figleaf.png?branch=master)](http://travis-ci.org/challengepost/figleaf)
|
3
3
|
|
4
|
-
|
5
4
|
YAML based DRY settings manager.
|
6
5
|
|
7
6
|
The YAML expansion functionality came about by our getting tired of having to
|
8
7
|
create a YAML file and then create an initializer that would expand such file
|
9
8
|
and include in our applications.
|
10
9
|
|
10
|
+
`Figleaf::Settings` can be used to override settings depending on what
|
11
|
+
environment your application is running. If it's a Rails app, it will know it
|
12
|
+
from `Rails.env`, otherwise it will check for `ENV['ENVIRONMENT']`.
|
13
|
+
|
11
14
|
## Installation
|
12
15
|
|
13
16
|
Add this line to your application's Gemfile:
|
@@ -51,20 +54,32 @@ files should be:
|
|
51
54
|
```
|
52
55
|
development:
|
53
56
|
foo: bar
|
57
|
+
some_bool_property: true
|
54
58
|
|
55
59
|
test:
|
56
60
|
foo: flob
|
61
|
+
some_bool_property: false
|
57
62
|
|
58
63
|
production:
|
59
64
|
foo: foo
|
65
|
+
some_bool_property: false
|
60
66
|
```
|
61
67
|
|
62
68
|
The Figleaf::Settings parser will create a namespace for your YAML file after the file
|
63
69
|
name.
|
64
70
|
|
65
71
|
Then, assuming that you named your YAML file `mysetting.yml`. you can just
|
66
|
-
access `foo` as `Figleaf::Settings.mysetting["foo"]
|
67
|
-
|
72
|
+
access `foo` as `Figleaf::Settings.mysetting["foo"]`,
|
73
|
+
`Figleaf::Settings.mysetting[:foo]` or even `Figleaf::Settings.mysetting.foo`
|
74
|
+
(the one caveat of the method expansion is that you can't access attributes that
|
75
|
+
collide with Hash methods that way, like `key`). (Inspired by Rails'
|
76
|
+
`database.yml`, of course.) In the case of boolean values, the property is
|
77
|
+
available as a predicate (eg: `Figleaf::Settings.mysetting.some_bool_property?`)
|
78
|
+
|
79
|
+
You can also use `Figleaf::Settings.override_with_local!` to load particular
|
80
|
+
file settings in runtime.
|
81
|
+
|
82
|
+
Properties can also be lambdas.
|
68
83
|
|
69
84
|
## Contributing
|
70
85
|
|
data/lib/figleaf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: figleaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
segments:
|
131
131
|
- 0
|
132
|
-
hash:
|
132
|
+
hash: 4046133761030384592
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
none: false
|
135
135
|
requirements:
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
segments:
|
140
140
|
- 0
|
141
|
-
hash:
|
141
|
+
hash: 4046133761030384592
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
144
|
rubygems_version: 1.8.24
|