settingslogic 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/README.rdoc +4 -1
- data/Rakefile +2 -2
- data/lib/settingslogic/settings.rb +2 -2
- data/lib/settingslogic/version.rb +1 -1
- data/test/test_setting.rb +11 -0
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
= Settingslogic
|
2
2
|
|
3
|
-
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.
|
3
|
+
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 using a singleton design pattern. It has been great for my apps, maybe you will enjoy it too.
|
4
4
|
|
5
5
|
So here is my question to you.....is Settingslogic a great settings solution or the greatest?
|
6
6
|
|
7
7
|
== Helpful links
|
8
8
|
|
9
9
|
* <b>Documentation:</b> http://settingslogic.rubyforge.org
|
10
|
+
* <b>Repository:</b> http://github.com/binarylogic/settingslogic/tree/master
|
10
11
|
* <b>Bugs / feature suggestions:</b> http://binarylogic.lighthouseapp.com/projects/19028-settingslogic
|
11
12
|
|
12
13
|
== Install and use
|
@@ -43,6 +44,8 @@ By default Settingslogic tries to load config/application.yml. This is just a ty
|
|
43
44
|
production:
|
44
45
|
<<: *defaults
|
45
46
|
|
47
|
+
Take note of the environment namespacing. If your framework supports environments this is a good way to support environment specific settings. If you are using this in an area where there are no environment disregard the namespacing. It will work just fine without it.
|
48
|
+
|
46
49
|
== Access your settings
|
47
50
|
|
48
51
|
>> RAILS_ENV
|
data/Rakefile
CHANGED
@@ -8,8 +8,8 @@ Hoe.new("Settingslogic", Settingslogic::Version::STRING) do |p|
|
|
8
8
|
p.name = "settingslogic"
|
9
9
|
p.author = "Ben Johnson of Binary Logic"
|
10
10
|
p.email = 'bjohnson@binarylogic.com'
|
11
|
-
p.summary = "
|
12
|
-
p.description = "
|
11
|
+
p.summary = "A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern."
|
12
|
+
p.description = "A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern."
|
13
13
|
p.url = "http://github.com/binarylogic/settingslogic"
|
14
14
|
p.history_file = "CHANGELOG.rdoc"
|
15
15
|
p.readme_file = "README.rdoc"
|
@@ -58,13 +58,13 @@ module Settingslogic
|
|
58
58
|
when Hash
|
59
59
|
instance_eval <<-"end_eval", __FILE__, __LINE__
|
60
60
|
def #{key}
|
61
|
-
@#{key} ||= self.class.new(self[
|
61
|
+
@#{key} ||= self.class.new(self[#{key.inspect}])
|
62
62
|
end
|
63
63
|
end_eval
|
64
64
|
else
|
65
65
|
instance_eval <<-"end_eval", __FILE__, __LINE__
|
66
66
|
def #{key}
|
67
|
-
@#{key} ||= self[
|
67
|
+
@#{key} ||= self[#{key.inspect}]
|
68
68
|
end
|
69
69
|
end_eval
|
70
70
|
end
|
data/test/test_setting.rb
CHANGED
@@ -29,4 +29,15 @@ class TestSetting < Test::Unit::TestCase
|
|
29
29
|
settings1 = Settings.new(File.dirname(__FILE__) + '/application.yml')
|
30
30
|
assert_raise(NoMethodError) { settings1.doesnt_exist }
|
31
31
|
end
|
32
|
+
|
33
|
+
def test_initialized_with_hash
|
34
|
+
settings1 = Settings.new(
|
35
|
+
:silly => 5,
|
36
|
+
'fun' => 25,
|
37
|
+
:neat => { 'cool' => { :awesome => "BenJohnson" } }
|
38
|
+
)
|
39
|
+
assert_equal "BenJohnson", settings1.neat.cool.awesome
|
40
|
+
assert_equal 5, settings1.silly
|
41
|
+
assert_equal 25, settings1.fun
|
42
|
+
end
|
32
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: settingslogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Johnson of Binary Logic
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-23 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.12.1
|
34
34
|
version:
|
35
|
-
description:
|
35
|
+
description: A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern.
|
36
36
|
email: bjohnson@binarylogic.com
|
37
37
|
executables: []
|
38
38
|
|
@@ -84,6 +84,6 @@ rubyforge_project: settingslogic
|
|
84
84
|
rubygems_version: 1.3.1
|
85
85
|
signing_key:
|
86
86
|
specification_version: 2
|
87
|
-
summary:
|
87
|
+
summary: A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern.
|
88
88
|
test_files: []
|
89
89
|
|