This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Oct 25 21:16:16 -0700 2009 | |
| |
README | Sun Oct 25 21:11:13 -0700 2009 | |
| |
Rakefile | Sat Mar 14 22:43:59 -0700 2009 | |
| |
app_config.gemspec | Sun Oct 25 21:57:52 -0700 2009 | |
| |
doc/ | Wed Mar 11 14:03:49 -0700 2009 | |
| |
lib/ | Sun Oct 25 21:11:23 -0700 2009 | |
| |
spec/ | Sun Oct 25 21:11:13 -0700 2009 | |
| |
tasks/ | Sun Sep 27 22:24:40 -0700 2009 |
README
= AppConfig An easy to use, customizable library to easily store and retrieve application (or library) configuration, API keys or basically anything in 'key/value' pairs. == Usage Usage is simple. Just pass either a hash of options, or a block, to AppConfig.setup. See AppConfig::Base for a list of valid storage methods. As of version 0.4.1, if the <tt>:storage_method</tt> is not set, AppConfig will act pretty much just like a normal Hash: AppConfig.setup(:email => 'admin@example.com') AppConfig[:email] # => 'admin@example.com' == AppConfig::Storage::YAML Given this YAML file: --- admin_email: 'admin@example.com' api_name: 'Supr Webz 2.0' api_key: 'SUPERAWESOMESERVICE' Use it like so: require 'app_config' AppConfig.setup do |config| config[:storage_method] = :yaml config[:path] = '/path/to/app_config.yml' # ..or.. config[:uri] = 'yaml://path/to/app_config.yml' end # Later on... # Strings or symbols as keys. AppConfig['admin_email'] # => 'admin@example.com' AppConfig[:api_name] # => 'Supr Webz 2.0' AppConfig[:api_key] # => 'SUPERAWESOMESERVICE' == AppConfig::Storage::Sqlite AppConfig.setup do |config| config[:storage_method] = :sqlite config[:table] = 'app_config' # defaults to 'app_config' config[:database] = '/path/to/database.sqlite3' # ..or.. config[:uri] = 'sqlite://path/to/database.sqlite3' end AppConfig[:column] # => 'value' == Environment Mode As of version 0.4.0, there's an 'environment mode' where you can organize the config file sort of like Rails' database config. # config/app_config.yml development: title: 'Development Mode' production: title: 'Production Mode' Then set the <tt>:env</tt> option to your desired environment. AppConfig.setup do |config| config[:env] = Rails.env # or any string. config[:uri] = 'yaml://path/to/app_config.yml' end # Uses the given environment section of the config. AppConfig[:title] = 'Production Mode'







