<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/environments.yml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -5,4 +5,10 @@
 * Packaged as a gem (but still works as a Rails plugin).
 * The app config object is now an instance of ApplicationConfiguration.
 * NoMethodError raised if you try to access a config element that doesn't exist.
-* ApplicationConfiguration#reload! to reread the config files and rebuild the app config object.
\ No newline at end of file
+* ApplicationConfiguration#reload! to reread the config files and rebuild the app config object.
+
+08/27/2009
+* Updated the ClosedStruct class.
+
+08/28/2009
+* Added support for &quot;environments&quot; in the YAML files.
\ No newline at end of file</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -55,5 +55,35 @@ You just need to create an initializer that looks something like this.
 If you installed this as a Rails plugin instead of a gem, that code is already run for you in
 the plugin's init.rb.
 
+=== Environments
+
+Alternatively to splitting out your environments into separate files, you can just have a single file which defines
+the application configuration for all environments (much like how databases.yml works).  Note if you do this, nested
+configurations will not be recursively merged.  See example below.
+
+&lt;em&gt;app_config.yml&lt;/em&gt;
+  defaults: &amp;defaults
+    one: won
+    two: too
+    nested:
+      foo: foo
+      bar: bar
+  
+  development:
+    &lt;&lt;: *defaults
+    two: new
+    nested:
+      foo: bar
+
+_code_
+  RAILS_ENV # =&gt; &quot;development&quot;
+  ::AppConfig = ApplicationConfiguration.new(&quot;app_config.yml&quot;)
+  AppConfig.use_environment!(RAILS_ENV)
+  AppConfig.one # =&gt; &quot;won&quot;
+  AppConfig.two # =&gt; &quot;new&quot;
+  AppConfig.nested.foo # =&gt; &quot;bar&quot;
+  AppConfig.nested.bar # raises NoMethodError because nested configurations are not recursively merged
+
+
 == Author
 Christopher J. Bottaro
\ No newline at end of file</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -25,6 +25,14 @@ class ApplicationConfiguration
     @config = ClosedStruct.r_new(conf)
   end
   
+  def use_environment!(environment)
+    if @config.respond_to?(environment)
+      @config = @config.send(environment)
+    else
+      raise ArgumentError, &quot;environment doesn't exist in app config: #{environment}&quot;
+    end
+  end
+  
 private
   
   def method_missing(name, *args)</diff>
      <filename>lib/app_config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -61,4 +61,18 @@ class AppConfigTest &lt; Test::Unit::TestCase
     assert_equal 1, config.size
   end
   
+  def test_environments
+    config = ApplicationConfiguration.new('test/environments.yml')
+    config.use_environment!(&quot;development&quot;)
+    assert_equal 2, config.size
+    assert_equal &quot;google.com&quot;, config.server
+    assert_equal 6, config.computed
+    assert_equal 3, config.section.size
+    assert_equal &quot;yahoo.com&quot;, config.section.servers[0].name
+    assert_equal &quot;amazon.com&quot;, config.section.servers[1].name
+    assert_equal &quot;webmaster@domain.com&quot;, config.emails.webmaster
+    assert_equal &quot;feedback@domain.com&quot;, config.emails.feedback
+    assert_raise(NoMethodError){ config.emails.support }
+  end
+  
 end</diff>
      <filename>test/app_config_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ae36e089bef0c0f5cb23907107c203d8d9761894</id>
    </parent>
  </parents>
  <author>
    <name>cjbottaro</name>
    <email>cjbottaro@alumni.cs.utexas.edu</email>
  </author>
  <url>http://github.com/cjbottaro/app_config/commit/3259abe97f924cd8f89b3d7aa3cfc546ae4bf0cb</url>
  <id>3259abe97f924cd8f89b3d7aa3cfc546ae4bf0cb</id>
  <committed-date>2009-08-28T09:57:44-07:00</committed-date>
  <authored-date>2009-08-28T09:57:44-07:00</authored-date>
  <message>Support for environments in yaml files.</message>
  <tree>a17c7e8b308b92aa9672c101482f0b88e0a90b94</tree>
  <committer>
    <name>cjbottaro</name>
    <email>cjbottaro@alumni.cs.utexas.edu</email>
  </committer>
</commit>
