CARVIEW |
Every repository with this icon (

Every repository with this icon (

Description: | A simple and straightforward object based settings solution that uses an ERB enabled YAML file and a singleton design pattern. |
Homepage: | https://settingslogic.rubyforge.org |
Clone URL: |
git://github.com/binarylogic/settingslogic.git
Give this clone URL to anyone.
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 | Thu Oct 30 20:50:35 -0700 2008 | Change Setting to Settings [binarylogic] |
![]() |
MIT-LICENSE | Thu Oct 30 20:30:38 -0700 2008 | Initial commit [binarylogic] |
![]() |
Manifest | Sun Nov 02 20:48:48 -0800 2008 | Renamed library from settingasm to settingslogic [binarylogic] |
![]() |
README.rdoc | Sun Nov 02 23:42:21 -0800 2008 | Added installation into readme [binarylogic] |
![]() |
Rakefile | Sun Nov 02 20:49:16 -0800 2008 | Renamed library from settingasm to settingslogic [binarylogic] |
![]() |
init.rb | Sun Nov 02 20:48:48 -0800 2008 | Renamed library from settingasm to settingslogic [binarylogic] |
![]() |
lib/ | Sun Nov 02 21:03:46 -0800 2008 | updated readme [binarylogic] |
![]() |
test/ | Sun Nov 02 20:49:16 -0800 2008 | Renamed library from settingasm to settingslogic [binarylogic] |
Settingslogic
Settingslogic is an old library of mine that I decided to go ahead and share with the world. It’s nothing crazy or new. Just a simple solution to a simple problem. Settingslogic provides globally accessible settings via 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: https://settingslogic.rubyforge.org
- Bugs / feature suggestions: https://binarylogic.lighthouseapp.com/projects/19028-settingslogic
Install and use
sudo gem install settingslogic
For rails
$ cd vendor/plugins $ sudo gem unpack settingslogic
Or as a plugin
script/plugin install git://github.com/binarylogic/settingslogic.git
Create your settings
By default Settingslogic tries to load config/application.yml. This is just a typical YAML file, notice ERB is allowed.
# 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" >> Settings.cool => "#<Settingslogic::Settings ... >" >> Settings.cool.saweet => "nested settings" >> Settings.neat_setting => 800 >> Settings.awesome_setting => "Did you know 5 + 5 = 10?"
Multiple settings
settings1 = Settings.new(:settings1) # looks for config/settings1.yml settings2 = Settings.new("settings2.yaml") # looks for settings2.yml settings2 = Settings.new("/abs/path/settings2.yaml") # looks for /abs/path/settings2.yml settings3 = Settings.new(:some_setting => "some value")
Configure
Configuration is optional. See Settingslogic::Config for more details.
# config/initializers/settingslogic.rb Settingslogic::Config.configure do |config| config.file_name = :config # will look for config/config.yml config.file_name = "config" # will look for config config.file_name = "config.yaml" # will look for confg.yaml config.file_name = "/absolute/path/config.yml" # will look for /absolute/path/config.yaml end
Copyright © 2008 {Ben Johnson}[https://github.com/binarylogic] of {Binary Logic}[https://www.binarylogic.com], released under the MIT license