easyconf-rails
easyconf-rails makes customizing your Rails application easy. (Surprise!) To use it, follow these simple steps:
1.
Add the following line to your project's Gemfile
:
gem 'easyconf-rails'
2.
Run bundle update
.
3.
Create a YAML file called defaults.yml
in your project's config
directory. This file will contain your project's default configuration values.
Individual installations SHOULD NOT change this file. For example:
---
should_donate: 10
awesomeness:
ruby: true
rspec: true
4.
Create a YAML file called config.yml
in your project's root directory. These
settings will take precedence over the settings in defaults.yml
, so you should
instruct your users to change their settings here. For example:
---
should_support_easyconf: true
should_donate: 5
donate_to: 1A9hGUYswsMLNdaeH9qMrjoJKQGnYKgmT2
awesomeness:
easyconf: true
rails: true
perl: false
rspec: false
why_easyconf_is_awesome:
- its_easiness
- YAML
-
recursive_processing: true
5.
Now you're ready to use config
in your application.
$config.should_support_easyconf # true
$config.should_donate # 5
$config.awesomeness.easyconf # true
$config.awesomeness.ruby # true
$config.awesomeness.rspec # false
$config.why_easyconf_is_awesome[0] # 'its_easiness'
$config.why_easyconf_is_awesome[2].recursive_processing # true
$config.variable_that_was_never_defined # raises NameError
# You can reload your configuration file by with .reload!.
$config.reload!