No commit activity in last 3 years
No release in over 3 years
Use yml and erb and specify environments and scopes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

simple app config¶ ↑

Generates a configuration object:

  • Pass in a YAML file

  • Pass in an environment as a filter

  • Use YAML defaults

  • Use ERB

  • Returns an OpenStruct so top level attributes can be accessed via method

Here is how a configuration file could look like:

application: RailsConfig
version: <%= 'version'.upcase %>

defaults: &defaults
  payment:
    key: payment_key

development:
  <<: *defaults
  payment:
    key: development_payment_key

production:
  <<: *defaults

Installation¶ ↑

Via github¶ ↑

gem install phuesler-simple_app_config

Via gem cutter (www.gemcutter.org)¶ ↑

gem install gemcutter
gem tumble
gem install simple_app_config

Usage¶ ↑

require 'simple_app_config'
Config = AppConfig.create("config/application.yml", :environment => 'development')

puts Config.application
puts Config.payment['key']

Or if you prefer the hash syntax do

require 'simple_app_config'
Config = AppConfig.create("config/application.yml", :environment => 'development', :format => :hash)

puts Config.application
puts Config['payment']['key']

When used in a Rails project, create an initializer and add something like this:

require 'simple_app_config'
Config = AppConfig.create("#{Rails.root}/config/application.yml", :environment => Rails.env)

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but

    bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright © 2009 Patrick Huesler. See LICENSE for details.