<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,6 +2,8 @@ CHANGELOG
 lib/rakegen/polite_file.rb
 lib/rakegen.rb
 LICENSE
+Manifest
+rakegen.gemspec
 README
 test/helper.rb
 test/test_polite_file.rb
@@ -12,4 +14,3 @@ test/testdata/app/one
 test/testdata/app/six.textile
 test/testdata/app/three.rb
 test/testdata/app/two.txt
-Manifest</diff>
      <filename>Manifest</filename>
    </modified>
    <modified>
      <diff>@@ -12,8 +12,8 @@ Rakegen is a Rake extension for generating and updating projects from templates.
     gen.executables = %w{ bin/waves-console  bin/waves-server }
   end
   
-This will define a task named, naturally enough, &quot;generate:app&quot;.  You can invoke it in the usual way, with &lt;tt&gt;rake generate_app&lt;/tt&gt;, or you can call it from Ruby:
+This will define a task named, naturally enough, &quot;generate:app&quot;.  If you define the generator in a rakefile, you can run it with &lt;tt&gt;rake generate:app&lt;/tt&gt;.  If you're building your own executable, you can call it from Ruby:
 
-  Rake::Task[&quot;generate:app&quot;].invoke
-  
-At the moment, Rakegen happily clobbers any copyable files with mod dates older than the associated template file.  Files produced by template processing always get clobbered.  Soon to come is a more courteous file task that asks if you want to clobber or skip.
\ No newline at end of file
+  generator.invoke
+
+Rakegen asks you before clobbering existing files.
\ No newline at end of file</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
   require dep
 end
 
-Version = '0.6.5'
+Version = '0.6.6'
 
 task :default =&gt; [:test]
 
@@ -14,6 +14,7 @@ begin
     p.summary = &quot;Generation and updation of projects from templates.  Rake-powered, for sustainable blah blah.&quot;
     p.author = &quot;Matthew King&quot;
     p.email = &quot;automatthew@gmail.com&quot;
+    p.url = &quot;http://rakegen.rubyforge.org&quot;
     p.ignore_pattern = /^(\.git).+/
     p.test_pattern = &quot;test/test_*.rb&quot;
     p.dependencies &lt;&lt; &quot;rake&quot;</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -39,9 +39,26 @@ class Rakegen &lt; Rake::TaskLib
   
   attr_accessor :executables
     
-  # Create a Rakegen task named &lt;em&gt;task_name&lt;/em&gt;.  Default task name is +app+.
-  def initialize(name=:app)
-    @name = name
+  # Create a generator.  The task_name becomes the primary Rake task, which has dependency
+  # tasks that get all the work done.  You can use a string to supply a namespaced task name, 
+  # such as &quot;waves:app&quot;.
+  #
+  # In the required block, you must define the source and target directories.  You may also define
+  # a list of excludes, a list of executables, assign variables for templates, and lambdas for processing
+  # different kinds of templates, keyed by the file extension.
+  #
+  #   generator = Rakegen.new do |gen|
+  #     gen.source = &quot;some/place&quot;
+  #     gen.target = &quot;some/where/else&quot;
+  #     gen.excludes = &quot;**/*.yaml&quot;
+  #     gen.executables = %w{ bin/console  bin/server }
+  #     gen.template_assigns[:monkey] = &quot;howler&quot;
+  #     gen.template_processors[:erb] = lambda { |src, tgt| MyErb.process(src, tgt) }
+  #   end
+  #
+  
+  def initialize(task_name = :app)
+    @name = task_name
     @excludes = []
     @executables = []
     @template_processors = {}
@@ -54,7 +71,10 @@ class Rakegen &lt; Rake::TaskLib
       end
     end
     
-    yield self # if block_given?
+    yield self
+    
+    raise &quot;You must supply a source.&quot; unless @source
+    raise &quot;You must supply a target.&quot; unless @target
     
     Dir.chdir(@source) do
       @files = Rake::FileList.new(&quot;**/*&quot;).exclude(*@excludes).to_a
@@ -75,6 +95,19 @@ class Rakegen &lt; Rake::TaskLib
     define
   end
   
+  # Invoke the primary task.  In other words, run the generator.
+  def invoke
+    Rake::Task[name].invoke
+  end
+  
+  # A rake file-based task that assesses neededness of target files based on user confirmation,
+  # rather than relative timestamps.  As with Rake#file, you can do arbitrary stuff 
+  # in the block:
+  # 
+  #   polite_file &quot;some/target/file&quot; do
+  #     str = File.read(&quot;/etc/profile&quot;).reverse
+  #     File.write( &quot;some/target/file&quot;, str)
+  #   end
   
   def polite_file(args, &amp;block)
     PoliteFileTask.define_task(args, &amp;block)
@@ -85,12 +118,14 @@ class Rakegen &lt; Rake::TaskLib
     path ? File.join(@source, path) : @source
   end
   
-  # If given a path, joins it to @targe.  Otherwise returns @target
+  # If given a path, joins it to @target.  Otherwise returns @target
   def target(path=nil)
     path ? File.join(@target, path) : @target
   end
   
-  # Define the necessary Rakegen tasks
+  private
+  
+  # Define all the generator's dependent tasks
   def define
       desc &quot;Create or update project using Rakegen&quot;
       task name =&gt; @all_files.map { |f| target(f) }</diff>
      <filename>lib/rakegen.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 class PoliteFileTask &lt; Rake::FileTask
     
-  # Is this file task needed?  Yes if doesn't exist (or different content, TBI)
+  # Is this file task needed?  Yes if doesn't exist or if the user agrees to clobber.
   def needed?
     return true unless File.exist?(name)
     return confirm?</diff>
      <filename>lib/rakegen/polite_file.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,20 +1,20 @@
 
-# Gem::Specification for Rakegen-0.6.5
+# Gem::Specification for Rakegen-0.6.6
 # Originally generated by Echoe
 
 Gem::Specification.new do |s|
   s.name = %q{rakegen}
-  s.version = &quot;0.6.5&quot;
+  s.version = &quot;0.6.6&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Matthew King&quot;]
-  s.date = %q{2008-09-01}
+  s.date = %q{2008-09-03}
   s.description = %q{Generation and updation of projects from templates.  Rake-powered, for sustainable blah blah.}
   s.email = %q{automatthew@gmail.com}
   s.extra_rdoc_files = [&quot;CHANGELOG&quot;, &quot;lib/rakegen/polite_file.rb&quot;, &quot;lib/rakegen.rb&quot;, &quot;LICENSE&quot;, &quot;README&quot;]
-  s.files = [&quot;CHANGELOG&quot;, &quot;lib/rakegen/polite_file.rb&quot;, &quot;lib/rakegen.rb&quot;, &quot;LICENSE&quot;, &quot;README&quot;, &quot;test/helper.rb&quot;, &quot;test/test_polite_file.rb&quot;, &quot;test/test_rakegen.rb&quot;, &quot;test/testdata/app/alpha/beta/five.erb&quot;, &quot;test/testdata/app/four.erb&quot;, &quot;test/testdata/app/one&quot;, &quot;test/testdata/app/six.textile&quot;, &quot;test/testdata/app/three.rb&quot;, &quot;test/testdata/app/two.txt&quot;, &quot;Manifest&quot;, &quot;rakegen.gemspec&quot;]
+  s.files = [&quot;CHANGELOG&quot;, &quot;lib/rakegen/polite_file.rb&quot;, &quot;lib/rakegen.rb&quot;, &quot;LICENSE&quot;, &quot;Manifest&quot;, &quot;rakegen.gemspec&quot;, &quot;README&quot;, &quot;test/helper.rb&quot;, &quot;test/test_polite_file.rb&quot;, &quot;test/test_rakegen.rb&quot;, &quot;test/testdata/app/alpha/beta/five.erb&quot;, &quot;test/testdata/app/four.erb&quot;, &quot;test/testdata/app/one&quot;, &quot;test/testdata/app/six.textile&quot;, &quot;test/testdata/app/three.rb&quot;, &quot;test/testdata/app/two.txt&quot;]
   s.has_rdoc = true
-  s.homepage = %q{}
+  s.homepage = %q{http://rakegen.rubyforge.org}
   s.rdoc_options = [&quot;--line-numbers&quot;, &quot;--inline-source&quot;, &quot;--title&quot;, &quot;Rakegen&quot;, &quot;--main&quot;, &quot;README&quot;]
   s.require_paths = [&quot;lib&quot;]
   s.rubyforge_project = %q{rakegen}
@@ -49,7 +49,7 @@ end
 #   require dep
 # end
 # 
-# Version = '0.6.5'
+# Version = '0.6.6'
 # 
 # task :default =&gt; [:test]
 # 
@@ -61,6 +61,7 @@ end
 #     p.summary = &quot;Generation and updation of projects from templates.  Rake-powered, for sustainable blah blah.&quot;
 #     p.author = &quot;Matthew King&quot;
 #     p.email = &quot;automatthew@gmail.com&quot;
+#     p.url = &quot;http://rakegen.rubyforge.org&quot;
 #     p.ignore_pattern = /^(\.git).+/
 #     p.test_pattern = &quot;test/test_*.rb&quot;
 #     p.dependencies &lt;&lt; &quot;rake&quot;</diff>
      <filename>rakegen.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -33,7 +33,7 @@ context &quot;A file_copy task&quot; do
     Rake::Task[@target].needed?.should == true
   end
   
-  specify &quot;should ask if file exists (no idea how to test Highline stuff)&quot; do
+  specify &quot;should ask if file exists&quot; do
     File.open(@target, &quot;w&quot;) { |f| f.print &quot;two&quot; }
     # run in shell and answer &quot;n&quot;.  Also, find better way to test.
     puts &quot;Answer no to the next prompt&quot;</diff>
      <filename>test/test_polite_file.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require File.join(File.dirname(__FILE__), &quot;helper&quot;)
 
-context &quot;Simple rakegen&quot; do
+context &quot;A Simple rakegen&quot; do
   
   before(:each) do
     @target = File.join(TEST_DIR, &quot;app_target&quot;)
@@ -37,36 +37,36 @@ context &quot;Simple rakegen&quot; do
     rm_r @target if File.exist?(@target)
   end
   
-  specify &quot;should have all directories in the directories list&quot; do
+  specify &quot;includes all directories in the directories list&quot; do
     @generator.directories.to_a.should == @directories
     # @generator.template_files.should == 1
   end
   
-  specify &quot;should have all non-erb files in the copy list&quot; do
+  specify &quot;includes all non-erb files in the copy list&quot; do
     @generator.copy_files.to_a.should == @copy_files
   end
-
-  specify &quot;should have all .erb files in the template list&quot; do
+  
+  specify &quot;includes all .erb files in the template list&quot; do
     @generator.template_files.should == @template_files
   end
   
-  specify &quot;should have an empty excludes list&quot; do
+  specify &quot;has an empty excludes list&quot; do
     @generator.excludes.should == [&quot;**/two.*&quot;]
   end
   
-  specify &quot;should have an executables list&quot; do
+  specify &quot;has an executables list&quot; do
     @generator.executables.should == [&quot;one&quot;]
   end
   
-  specify &quot;should have a working erb template_processor&quot; do
+  specify &quot;has a working erb template_processor&quot; do
     @generator.template_processors[&quot;erb&quot;].should.respond_to :call
     @generator.template_processors[&quot;erb&quot;].call(&quot;#{TEST_APP}/four.erb&quot;, &quot;#{TEST_DIR}/catch.txt&quot;)
     File.open(&quot;#{TEST_DIR}/catch.txt&quot;, &quot;r&quot;).read.should == &quot;Yossarian jumped.&quot;
     rm &quot;#{TEST_DIR}/catch.txt&quot;
   end
   
-  specify &quot;should copy or process all files and directories&quot; do
-    Rake::Task[&quot;waves:app&quot;].invoke
+  specify &quot;can copy or process all files and directories using #invoke&quot; do
+    @generator.invoke
     @copy_files.each do |f|
       assert File.exist?(File.join(@target, f))
     end</diff>
      <filename>test/test_rakegen.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1cdf1606935d6c231b251d84c38b15b4544e9855</id>
    </parent>
  </parents>
  <author>
    <name>Matthew King</name>
    <email>automatthew@gmail.com</email>
  </author>
  <url>http://github.com/automatthew/rakegen/commit/d1f758c08e222a7536ff02c2f373f84141b08f44</url>
  <id>d1f758c08e222a7536ff02c2f373f84141b08f44</id>
  <committed-date>2008-09-03T07:14:21-07:00</committed-date>
  <authored-date>2008-09-03T07:14:21-07:00</authored-date>
  <message>added #invoke method; slightly better docs</message>
  <tree>0c5d5e468c10c27155cdb0f352037f303944848e</tree>
  <committer>
    <name>Matthew King</name>
    <email>automatthew@gmail.com</email>
  </committer>
</commit>
