CARVIEW |
Every repository with this icon (

Every repository with this icon (

Run the following if you haven't already:
gem sources -a https://gems.github.com
Install the gem(s):
sudo gem install binarylogic-settingslogic
Description: | A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern. edit |
Homepage: | https://rdoc.info/projects/binarylogic/settingslogic edit |
Public Clone URL: |
git://github.com/binarylogic/settingslogic.git
Give this clone URL to anyone.
git clone git://github.com/binarylogic/settingslogic.git
|
Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:binarylogic/settingslogic.git
|
name | age | message | |
---|---|---|---|
![]() |
.gitignore | Thu Oct 30 20:30:38 -0700 2008 | Initial commit [binarylogic] |
![]() |
CHANGELOG.rdoc | Sat Aug 22 01:02:59 -0700 2009 | * Define methods during method_missing instead ... [binarylogic] |
![]() |
LICENSE | Sun Jun 28 00:27:20 -0700 2009 | Switch to jewler from hoe [binarylogic] |
![]() |
README.rdoc | Sat Aug 22 00:26:08 -0700 2009 | Complete rewrite, see changelog / readme [binarylogic] |
![]() |
Rakefile | Sat Aug 22 00:26:08 -0700 2009 | Complete rewrite, see changelog / readme [binarylogic] |
![]() |
VERSION.yml | Tue Sep 01 21:54:59 -0700 2009 | Version bump to 2.0.3 [binarylogic] |
![]() |
init.rb | Sun Jun 28 00:27:20 -0700 2009 | Switch to jewler from hoe [binarylogic] |
![]() |
lib/ | Tue Sep 01 21:54:50 -0700 2009 | Add nodoc [binarylogic] |
![]() |
rails/ | Sun Jun 28 00:27:20 -0700 2009 | Switch to jewler from hoe [binarylogic] |
![]() |
settingslogic.gemspec | Tue Sep 01 21:55:04 -0700 2009 | Regenerated gemspec for version 2.0.3 [binarylogic] |
![]() |
spec/ | Tue Sep 01 21:51:03 -0700 2009 | Settings data was changed to clarify specs. Si... [MitinPavel] |
Settingslogic
Settingslogic is a simple configuration / settings solution that uses an ERB enabled YAML file. It has been great for my apps, maybe you will enjoy it too.
So here is my question to you.….is Settingslogic a great settings solution or the greatest?
Helpful links
- Documentation: rdoc.info/projects/binarylogic/settingslogic
- Repository: github.com/binarylogic/settingslogic/tree/master
- Issues: github.com/binarylogic/settingslogic/issues
Install and use
Install from rubyforge:
sudo gem install settingslogic
Install from github:
sudo gem install binarylogic-settingslogic
Or as a plugin
script/plugin install git://github.com/binarylogic/settingslogic.git
1. Define your constant
Instead of defining a Settings constant for you, that task is left to you. Simply create a class in your application that looks like:
class Settings < Settingslogic source "#{Rails.root}/config/application.yml" namespace Rails.env end
Name it Settings, name it Config, name it whatever you want. Add as many or as few as you like. A good place to put this file in a rails app is models/settings.rb
I felt adding a settings file in your app was more straightforward, less tricky, and more flexible.
2. Create your settings
Notice above we specified an absolute path to our settings file called "application.yml". This is just a typical YAML file. Also notice above that we specified a namespace for our environment. This allows us to namespace our configuration depending on our environment:
# app/config/application.yml defaults: &defaults cool: saweet: nested settings neat_setting: 24 awesome_setting: <%= "Did you know 5 + 5 = " + (5 + 5) + "?" %> development: <<: *defaults neat_setting: 800 test: <<: *defaults production: <<: *defaults
Access your settings
>> Rails.env.development? => true >> Settings.cool => "#<Settingslogic::Settings ... >" >> Settings.cool.saweet => "nested settings" >> Settings.neat_setting => 800 >> Settings.awesome_setting => "Did you know 5 + 5 = 10?"
Copyright © 2008 Ben Johnson of Binary Logic, released under the MIT license