<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/settings.rb</filename>
    </added>
    <added>
      <filename>spec/settings.yml</filename>
    </added>
    <added>
      <filename>spec/settings2.rb</filename>
    </added>
    <added>
      <filename>spec/settingslogic_spec.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helper.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,7 @@
+== 2.0.0 released 2009-08-22
+
+* Less magic, instead of automatically defining a Settings constant, you should define your own constant. See the readme for an example.
+
 == 1.0.3 released 2009-04-23
 
 * Fix Settings initialized with a Hash to work with both symbol and string hash keys.</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 = 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 using a singleton design pattern. It has been great for my apps, maybe you will enjoy it too.
+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?
 
@@ -24,9 +24,22 @@ Or as a plugin
 
   script/plugin install git://github.com/binarylogic/settingslogic.git
 
-== Create your settings
+== 1. Define your constant
 
-By default Settingslogic tries to load config/application.yml. This is just a typical YAML file, notice ERB is allowed.
+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 &lt; Settingslogic
+    source &quot;#{Rails.root}/config/application.yml&quot;
+    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 &quot;application.yml&quot;. 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: &amp;defaults
@@ -45,12 +58,10 @@ By default Settingslogic tries to load config/application.yml. This is just a ty
   production:
     &lt;&lt;: *defaults
 
-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.
-
 == Access your settings
 
-  &gt;&gt; RAILS_ENV
-  =&gt; &quot;development&quot;
+  &gt;&gt; Rails.env.development?
+  =&gt; true
   
   &gt;&gt; Settings.cool
   =&gt; &quot;#&lt;Settingslogic::Settings ... &gt;&quot;
@@ -64,24 +75,5 @@ Take note of the environment namespacing. If your framework supports environment
   &gt;&gt; Settings.awesome_setting
   =&gt; &quot;Did you know 5 + 5 = 10?&quot;
 
-== Multiple settings
-
-  settings1 = Settings.new(:settings1) # looks for config/settings1.yml
-  settings2 = Settings.new(&quot;settings2.yaml&quot;) # looks for settings2.yml
-  settings2 = Settings.new(&quot;/abs/path/settings2.yaml&quot;) # looks for /abs/path/settings2.yml
-  settings3 = Settings.new(:some_setting =&gt; &quot;some value&quot;)
-
-== 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 = &quot;config&quot; # will look for config
-    config.file_name = &quot;config.yaml&quot; # will look for confg.yaml
-    config.file_name = &quot;/absolute/path/config.yml&quot; # will look for /absolute/path/config.yml
-  end
-
 
 Copyright (c) 2008 {Ben Johnson}[http://github.com/binarylogic] of {Binary Logic}[http://www.binarylogic.com], released under the MIT license 
\ No newline at end of file</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -10,40 +10,24 @@ begin
     gem.homepage = &quot;http://github.com/binarylogic/settingslogic&quot;
     gem.authors = [&quot;Ben Johnson of Binary Logic&quot;]
     gem.rubyforge_project = &quot;settingslogic&quot;
-    gem.add_dependency &quot;activesupport&quot;
   end
+  Jeweler::RubyforgeTasks.new
 rescue LoadError
   puts &quot;Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler&quot;
 end
 
-require 'rake/testtask'
-Rake::TestTask.new(:test) do |test|
-  test.libs &lt;&lt; 'lib' &lt;&lt; 'test'
-  test.pattern = 'test/**/*_test.rb'
-  test.verbose = true
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new(:spec) do |spec|
+  spec.libs &lt;&lt; 'lib' &lt;&lt; 'spec'
+  spec.spec_files = FileList['spec/**/*_spec.rb']
 end
 
-begin
-  require 'rcov/rcovtask'
-  Rcov::RcovTask.new do |test|
-    test.libs &lt;&lt; 'test'
-    test.pattern = 'test/**/*_test.rb'
-    test.verbose = true
-  end
-rescue LoadError
-  task :rcov do
-    abort &quot;RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov&quot;
-  end
+Spec::Rake::SpecTask.new(:rcov) do |spec|
+  spec.libs &lt;&lt; 'lib' &lt;&lt; 'spec'
+  spec.pattern = 'spec/**/*_spec.rb'
+  spec.rcov = true
 end
 
-task :default =&gt; :test
+task :spec =&gt; :check_dependencies
 
-begin
-  require 'rake/contrib/sshpublisher'
-  namespace :rubyforge do
-    desc &quot;Release gem to RubyForge&quot;
-    task :release =&gt; [&quot;rubyforge:release:gem&quot;]
-  end
-rescue LoadError
-  puts &quot;Rake SshDirPublisher is unavailable or your rubyforge environment is not configured.&quot;
-end
+task :default =&gt; :spec</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,86 @@
 require &quot;yaml&quot;
 require &quot;erb&quot;
-require File.dirname(__FILE__) + &quot;/settingslogic/config&quot;
-require File.dirname(__FILE__) + &quot;/settingslogic/settings&quot;
 
-# Try to load conflicting Settings classes
-begin
-  Settings
-rescue(NameError)
-end
-
-# Since we don't have a Settings constant, lets go ahead and use it
-::Settings = Settingslogic::Settings unless defined?(Settings)
\ No newline at end of file
+# A simple settings solution using a YAML file. See README for more information.
+class Settingslogic &lt; Hash
+  class UndefinedSetting &lt; StandardError; end
+  
+  class &lt;&lt; self
+    def name # :nodoc:
+      instance.key?(&quot;name&quot;) ? instance.name : super
+    end
+    
+    def source(value = nil)
+      if value.nil?
+        @source
+      else
+        @source = value
+      end
+    end
+    
+    def namespace(value = nil)
+      if value.nil?
+        @namespace
+      else
+        @namespace = value
+      end
+    end
+    
+    private
+      def instance
+        @instance ||= new
+      end
+      
+      def method_missing(name, *args, &amp;block)
+        instance.send(name, *args, &amp;block)
+      end
+  end
+  
+  # Initializes a new settings object. You can initialize an object in any of the following ways:
+  #
+  #   Settings.new(:application) # will look for config/application.yml
+  #   Settings.new(&quot;application.yaml&quot;) # will look for application.yaml
+  #   Settings.new(&quot;/var/configs/application.yml&quot;) # will look for /var/configs/application.yml
+  #   Settings.new(:config1 =&gt; 1, :config2 =&gt; 2)
+  #
+  # Basically if you pass a symbol it will look for that file in the configs directory of your rails app, if you are using this in rails. If you pass a string it should be an absolute path to your settings file.
+  # Then you can pass a hash, and it just allows you to access the hash via methods.
+  def initialize(hash_or_file = self.class.source)
+    case hash_or_file
+    when Hash
+      self.update hash_or_file
+    else
+      self.update YAML.load(ERB.new(File.read(hash_or_file)).result).to_hash
+      self.update self[self.class.namespace] if self.class.namespace
+    end
+    
+    define_settings!
+  end
+  
+  private
+    def method_missing(name, *args, &amp;block)
+      raise UndefinedSetting.new(&quot;The '#{name}' was not found in your configuration file: #{self.class.source}&quot;)
+    end
+    
+    def define_settings!
+      self.each do |key, value|
+        case value
+        when Hash
+          instance_eval &lt;&lt;-&quot;end_eval&quot;, __FILE__, __LINE__
+            def #{key}
+              @#{key} ||= self.class.new(self[#{key.inspect}])
+            end
+          end_eval
+        else
+          instance_eval &lt;&lt;-&quot;end_eval&quot;, __FILE__, __LINE__
+            def #{key}
+              @#{key} ||= self[#{key.inspect}]
+            end
+            def #{key}=(value)
+              @#{key} = value
+            end
+          end_eval
+        end
+      end
+    end
+end
\ No newline at end of file</diff>
      <filename>lib/settingslogic.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/settingslogic/config.rb</filename>
    </removed>
    <removed>
      <filename>lib/settingslogic/settings.rb</filename>
    </removed>
    <removed>
      <filename>test/application.yml</filename>
    </removed>
    <removed>
      <filename>test/application2.yml</filename>
    </removed>
    <removed>
      <filename>test/application3.yml</filename>
    </removed>
    <removed>
      <filename>test/config_test.rb</filename>
    </removed>
    <removed>
      <filename>test/setting_test.rb</filename>
    </removed>
    <removed>
      <filename>test/test_helper.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>14e93364b5bcb9f53424b0b7d2cf2586fc530f03</id>
    </parent>
  </parents>
  <author>
    <name>binarylogic</name>
    <email>bjohnson@binarylogic.com</email>
  </author>
  <url>http://github.com/binarylogic/settingslogic/commit/471adcb09c8ff303a2f024489480ba3573b20024</url>
  <id>471adcb09c8ff303a2f024489480ba3573b20024</id>
  <committed-date>2009-08-22T00:26:08-07:00</committed-date>
  <authored-date>2009-08-22T00:26:08-07:00</authored-date>
  <message>Complete rewrite, see changelog / readme</message>
  <tree>b52721e62a5d704c18d9771f75bec3d62818242f</tree>
  <committer>
    <name>binarylogic</name>
    <email>bjohnson@binarylogic.com</email>
  </committer>
</commit>
