<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/fixtures/app.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/app/authenticate.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/app/authenticate/basic/config.yml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,15 @@
+=== 0.2.0 / 2009-04-17
+
+* 2 major enhancements
+
+  * Option to modular configuration files (from &quot;config/app/**/*.yml&quot;).
+  * App.name is now App.to_s (overriding the name is cool, but dangerous).
+
+* 1 minor enhancement
+
+  * Removed superfluous &quot;init&quot; and &quot;uninstall&quot; files (handle load errors more
+    gracefully in &quot;app&quot;, and let &quot;script/destroy&quot; do its thing).
+
 === 0.1.2 / 2009-04-02
 
 * 1 minor enhancement</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -4,8 +4,9 @@ README.rdoc
 Rakefile
 generators/app_config/app_config_generator.rb
 generators/app_config/templates/app.yml
-init.rb
 install.rb
 lib/app.rb
 test/app_test.rb
-uninstall.rb
+test/fixtures/app/authenticate/basic/config.yml
+test/fixtures/app/authenticate.yml
+test/fixtures/app.yml</diff>
      <filename>Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -47,6 +47,18 @@ Sugar, sugar, sugar.
 
 Let's not overdo it, though. &lt;tt&gt;App.apis.flickr&lt;/tt&gt; just doesn't look right.
 
+If your &quot;app.yml&quot; gets out of hand, modularize:
+
+  # config/app/authenticate.yml
+  ---
+  username: password
+
+  # (elsewhere)
+  App::Authenticate[&quot;username&quot;] # =&gt; &quot;password&quot;
+
+
+Namespaces avoid collisions.
+
 
 == REQUIREMENTS
 </diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -2,32 +2,32 @@
 
 Gem::Specification.new do |s|
   s.name = %q{app}
-  s.version = &quot;0.1.2&quot;
+  s.version = &quot;0.2.0&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Stephen Celis&quot;]
-  s.date = %q{2009-04-02}
+  s.date = %q{2009-04-17}
   s.description = %q{Move the config out of your app, and into App. Sure, it's been done before, and others will do it again, but this is my way, and I like it.}
   s.email = [&quot;stephen@stephencelis.com&quot;]
   s.extra_rdoc_files = [&quot;History.txt&quot;, &quot;Manifest.txt&quot;]
-  s.files = [&quot;History.txt&quot;, &quot;Manifest.txt&quot;, &quot;README.rdoc&quot;, &quot;Rakefile&quot;, &quot;generators/app_config/app_config_generator.rb&quot;, &quot;generators/app_config/templates/app.yml&quot;, &quot;init.rb&quot;, &quot;install.rb&quot;, &quot;lib/app.rb&quot;, &quot;test/app_test.rb&quot;, &quot;uninstall.rb&quot;]
+  s.files = [&quot;History.txt&quot;, &quot;Manifest.txt&quot;, &quot;README.rdoc&quot;, &quot;Rakefile&quot;, &quot;generators/app_config/app_config_generator.rb&quot;, &quot;generators/app_config/templates/app.yml&quot;, &quot;install.rb&quot;, &quot;lib/app.rb&quot;, &quot;test/app_test.rb&quot;, &quot;test/fixtures/app/authenticate/basic/config.yml&quot;, &quot;test/fixtures/app/authenticate.yml&quot;, &quot;test/fixtures/app.yml&quot;]
   s.has_rdoc = true
   s.rdoc_options = [&quot;--main&quot;, &quot;README.rdoc&quot;]
   s.require_paths = [&quot;lib&quot;]
   s.rubyforge_project = %q{app}
-  s.rubygems_version = %q{1.3.1}
+  s.rubygems_version = %q{1.3.2}
   s.summary = %q{Move the config out of your app, and into App}
 
   if s.respond_to? :specification_version then
     current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
-    s.specification_version = 2
+    s.specification_version = 3
 
     if Gem::Version.new(Gem::RubyGemsVersion) &gt;= Gem::Version.new('1.2.0') then
-      s.add_development_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.11.0&quot;])
+      s.add_development_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.12.0&quot;])
     else
-      s.add_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.11.0&quot;])
+      s.add_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.12.0&quot;])
     end
   else
-    s.add_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.11.0&quot;])
+    s.add_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.12.0&quot;])
   end
 end</diff>
      <filename>app.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,32 @@
 class AppConfigGenerator &lt; Rails::Generator::Base
   def manifest
     record do |m|
-      m.file &quot;app.yml&quot;, &quot;config/app.yml&quot;
+      if ARGV.empty?
+        if File.exist? Rails.root.join(&quot;config&quot;, &quot;app.yml&quot;)
+          show_banner
+        else
+          m.file &quot;app.yml&quot;, &quot;config/app.yml&quot;
+        end
+      else
+        ARGV.each do |arg|
+          path = &quot;config/app/#{arg.underscore}&quot;
+          m.directory File.dirname(path)
+          m.file &quot;app.yml&quot;, &quot;#{path}.yml&quot;
+        end
+      end
     end
   end
+
+  private
+
+  def show_banner
+    puts &quot;App: you already have an app.yml!&quot;
+    puts
+    puts &quot;  Remember to pass arguments to generate new configurations:&quot;
+    puts &quot;    script/generate app_config apis/twitter&quot;
+    puts
+    puts &quot;  Generates:&quot;
+    puts &quot;    config/app/apis&quot;
+    puts &quot;    config/app/apis/twitter.yml&quot;
+  end
 end</diff>
      <filename>generators/app_config/app_config_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,4 @@
-# Your app config, provided by the App plugin.
-#
-# See &quot;vendor/plugins/app/README.txt&quot; for details.
+# An app config, provided by App: http://github.com/stephencelis/app
 ---
 development: &amp;development
   loaded_at: &lt;%= Time.zone.now.iso8601 %&gt;</diff>
      <filename>generators/app_config/templates/app.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-STDOUT.puts 'Run `script/generate app_config` to generate &quot;config/app.yml&quot;.'
+$stdout.puts 'Run `script/generate app_config` to generate &quot;config/app.yml&quot;.'</diff>
      <filename>install.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,10 @@
 # App is your app.
 #
-# What would your app be without it? Still an app, but without the App.
+# What would your app be without it? Still an app, but without App.
 module App
-  VERSION = &quot;0.1.2&quot;
-
-  raw_config = File.read Rails.root.join(&quot;config&quot;, &quot;app.yml&quot;)
-  @@config = YAML.load(ERB.new(raw_config).result)[Rails.env].freeze
+  VERSION = &quot;0.2.0&quot;
 
+  @@config = {} # Initialize.
   class &lt;&lt; self
     # Returns the application configuration hash, as defined in
     # &quot;config/app.yml&quot;.
@@ -26,20 +24,10 @@ module App
       @@config if args.empty?
       args.inject(@@config) { |config, arg| config[arg] }
     end
-
-    alias []       config
-    alias __name__ name
-
-    # Returns the name of the web application, which can be overridden in
-    # &quot;config/app.yml&quot;.
-    #
-    # To return the name of the module, use &lt;tt&gt;App.__name__&lt;/tt&gt;.
-    def name
-      @@name ||= method_missing(:name) || File.basename(Rails.root)
-    end
+    alias [] config
 
     def inspect
-      &quot;#&lt;App: #{config.inspect}&gt;&quot;
+      &quot;#&lt;#{name}: #{config.inspect}&gt;&quot;
     end
 
     private
@@ -48,4 +36,37 @@ module App
       self[method.to_s, *args] || self[method, *args]
     end
   end
+
+  begin
+    raw = File.read Rails.root.join(&quot;config&quot;, &quot;#{name.underscore}.yml&quot;)
+    @@config = YAML.load(ERB.new(raw).result)[Rails.env]
+  rescue Errno::ENOENT =&gt; e
+    puts '** App: no file &quot;config/app.yml&quot;. Run `script/generate app_config`.'
+  end
+end
+
+unless __FILE__ == &quot;(eval)&quot;
+  module App
+    class &lt;&lt; self
+      # Returns the name of the web application, which can be overridden in
+      # &quot;config/app.yml&quot;.
+      def to_s
+        File.basename(Rails.root)
+      end
+    end
+  end
+
+  # Iterate through other App configs and namespace them.
+  Dir[Rails.root.join(&quot;config&quot;, &quot;app&quot;, &quot;**/*.yml&quot;)].sort.each do |config|
+    name = config.gsub(/#{Rails.root.join(&quot;config&quot;)}\/|\.yml/) {}.classify
+
+    # Recognize all parents.
+    line = name.split(&quot;::&quot;)
+    line.inject(line.shift) do |parentage, descendant|
+      eval &quot;module #{parentage}; end&quot;
+      &quot;#{parentage}::#{descendant}&quot;
+    end
+
+    eval File.read(__FILE__).sub &quot;module App&quot;, &quot;module #{name}&quot;
+  end
 end</diff>
      <filename>lib/app.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,38 +5,29 @@ require 'active_support/test_case'
 require 'mocha'
 require 'erb'
 
-# Mock
-module App
-  module Rails
-    def self.root
-      File
-    end
-    def self.env
-      &quot;development&quot;
-    end
+# Mock!
+module Rails
+  def self.root
+    self
+  end
+  def self.join(*args)
+    args.shift # No &quot;config&quot; dir, OK?
+    File.expand_path File.join(File.dirname(__FILE__), &quot;fixtures&quot;, *args)
+  end
+  def self.env
+    &quot;development&quot;
   end
 end
 
-File.stubs(:read).returns &lt;&lt;-YAML
----
-development:
-  loaded_at: &lt;%= Time.now.iso8601 %&gt;
-  username: Stephen
-  password: frobozz
-  apis:
-    braintree:
-      :login: testapi
-      :password: password1
-YAML
-
+# And load!
 require 'app'
 
 class AppTest &lt; ActiveSupport::TestCase
-  test &quot;different ways of access should return same values&quot; do
-    assert_equal &quot;Stephen&quot;, App.config[&quot;username&quot;]
-    assert_equal &quot;Stephen&quot;, App.config(&quot;username&quot;)
-    assert_equal &quot;Stephen&quot;, App[&quot;username&quot;]
-    assert_equal &quot;Stephen&quot;, App.username
+  test &quot;should access many ways&quot; do
+    assert_equal &quot;Welcome!&quot;, App.config[&quot;welcome_message&quot;]
+    assert_equal &quot;Welcome!&quot;, App.config(&quot;welcome_message&quot;)
+    assert_equal &quot;Welcome!&quot;, App[&quot;welcome_message&quot;]
+    assert_equal &quot;Welcome!&quot;, App.welcome_message
 
     assert_equal &quot;testapi&quot;, App.config[&quot;apis&quot;][&quot;braintree&quot;][:login]
     assert_equal &quot;testapi&quot;, App.config(&quot;apis&quot;, &quot;braintree&quot;, :login)
@@ -44,12 +35,26 @@ class AppTest &lt; ActiveSupport::TestCase
     assert_equal &quot;testapi&quot;, App.apis(&quot;braintree&quot;, :login)
   end
 
-  test &quot;ERB should be parsed&quot; do
+  test &quot;should parse ERB&quot; do
     assert_instance_of Time, App.loaded_at
   end
 
-  test &quot;App.name should be inferred&quot; do
+  test &quot;should accept boolean keys&quot; do
+    assert !App.process_payments?
+  end
+
+  test &quot;should infer App.name&quot; do
     File.stubs(:basename).returns &quot;root&quot;
-    assert_equal &quot;root&quot;, App.name
+    assert_equal &quot;root&quot;, App.to_s
+  end
+
+  test &quot;should namespace configs&quot; do
+    assert_instance_of Module, App::Authenticate
+    assert_equal &quot;frobozz&quot;, App::Authenticate[&quot;Stephen&quot;]
+  end
+
+  test &quot;should nest multiple levels of configs&quot; do
+    assert_instance_of Module, App::Authenticate::Basic::Config
+    assert_equal :basic, App::Authenticate::Basic::Config.authentication_type
   end
 end</diff>
      <filename>test/app_test.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>init.rb</filename>
    </removed>
    <removed>
      <filename>uninstall.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>e1d5644e1b349ea2ea5514f31e5ad307be52cbf4</id>
    </parent>
  </parents>
  <author>
    <name>Stephen Celis</name>
    <email>stephen@stephencelis.com</email>
  </author>
  <url>http://github.com/stephencelis/app/commit/f4a788560dd457fdc8545632f3690ec4c878c38c</url>
  <id>f4a788560dd457fdc8545632f3690ec4c878c38c</id>
  <committed-date>2009-04-17T11:49:20-07:00</committed-date>
  <authored-date>2009-04-17T11:45:40-07:00</authored-date>
  <message>Option to modular configuration files (from &quot;config/app/**/*.yml&quot;). App.name is now App.to_s (overriding the name is cool, but dangerous). Removed superfluous &quot;init&quot; and &quot;uninstall&quot; files (handle load errors more gracefully in &quot;app&quot;, and let &quot;script/destroy&quot; do its thing).</message>
  <tree>4a520c4c15846b3b210fde10c9580bc13b6154b5</tree>
  <committer>
    <name>Stephen Celis</name>
    <email>stephen@stephencelis.com</email>
  </committer>
</commit>
