<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,9 +1,12 @@
 require 'rake'
-# Install hook code here
+
 begin
   puts &quot;======================================================================&quot;
   puts &quot;Attempting to copy Streamlined required files into your application...&quot;
   puts &quot;======================================================================&quot;
+  RAKE_FILE = File.join(File.dirname(__FILE__), '/tasks/relevance_extensions_tasks.rake')
+  load RAKE_FILE
+  
   Rake::Task['streamlined:install_files'].invoke
   puts &quot;======================================================================&quot;
   puts &quot;Success!&quot;</diff>
      <filename>install.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
+require 'find'
+
 # Handle copying over the default assets, views, and layout that Streamlined depends on.
 # We don't do all this in the rake task to make things easier to test.
 module Streamlined
@@ -9,9 +11,26 @@ module Streamlined
     end
 
     # Copy the files from streamlined into the Rails project
+    # Ignores any files or directories that start with a period (so .svn will get ignored),
+    # also will ignore CVS metadata.
     def self.install
-      files = Dir.glob(&quot;#{source}/*&quot;)
-      files.each { |file| FileUtils.cp_r(file, destination) }
+      paths = []
+      Find.find(source) do |path|
+        Find.prune if path =~ /\/\..+/
+        Find.prune if path =~ /CVS/
+        paths &lt;&lt; path
+      end
+      paths.each do |path| 
+        dest_path = path.gsub(source, destination)
+        if File.directory?(path)
+          FileUtils.mkdir_p(dest_path) unless File.exists?(dest_path)
+        else
+          FileUtils.cp(path, dest_path)
+        end
+      end
+    rescue Exception =&gt; e
+      puts &quot;Error trying to copy files: #{e.inspect}&quot;
+      raise e
     end
     
   end  </diff>
      <filename>tasks/relevance_extensions_tasks.rake</filename>
    </modified>
    <modified>
      <diff>@@ -1,47 +1,88 @@
 require File.join(File.dirname(__FILE__), '../../test_helper')
 require 'rake'
 
+# Test the install process that runs on install that copies over static files required by Streamlined
 class Streamlined::RakeTasksTest &lt; Test::Unit::TestCase
   RAKE_FILE = File.join(File.dirname(__FILE__), '../../../tasks/relevance_extensions_tasks.rake')
+
+  # We test the install task using real files and real directories, because mocks are to easy to give
+  # us &quot;false passes&quot; when the code really doesn't work for all edge cases.
+  
+  # we have a root directory we create in the tmp dir to do all our work in
+  # we have a &quot;source&quot; there which we use as a sandbox to create our test files, and a &quot;destination&quot;
+  # which would correspond to RAILS_ROOT in a real project
+  attr_with_default(:root) { &quot;#{Dir.tmpdir}/streamlined_test&quot; }
+  attr_with_default(:source) { &quot;#{root}/src&quot; }
+  attr_with_default(:destination) { &quot;#{root}/dest&quot; }
+
+  # our stub directories and files that we will create and test against
+  attr_with_default(:source_directories)   { [&quot;/CVS&quot;, &quot;/images&quot;, &quot;/images/.svn/&quot;, &quot;/javascripts&quot;, &quot;/javascripts/nested_js&quot;] }
+  attr_with_default(:should_be_copied)     { %w[readme.txt foo.rb images/logo.png javascripts/foo.js javascripts/nested_js/bar.js] }
+  attr_with_default(:should_not_be_copied) { %w[.svn .DS_STORE /images/.svn/svn_meta_data] }
+  
   
   def setup
     load RAKE_FILE
-    @test_target_directory_root = &quot;#{Dir.tmpdir}/streamlined_test&quot;
-    
-    @test_target_directory_source = &quot;#{@test_target_directory_root}/src&quot;
-    @test_target_directory_destination = &quot;#{@test_target_directory_root}/dest&quot;
+
+    create_directory [source, destination]
+    create_source_directories
+
+    (should_be_copied + should_not_be_copied).each { |path| FileUtils.touch &quot;#{source}/#{path}&quot; }
     
-    @original_source, Streamlined::Assets.source = Streamlined::Assets.source, @test_target_directory_source
-    @original_destination, Streamlined::Assets.destination = Streamlined::Assets.destination, @test_target_directory_destination
+    # swap the original and the temp directories we are using for the test
+    @original_source, Streamlined::Assets.source = Streamlined::Assets.source, source
+    @original_destination, Streamlined::Assets.destination = Streamlined::Assets.destination, destination
   end
 
   def teardown
+    # replace the source and dest with the original values
     Streamlined::Assets.source = @original_source
     Streamlined::Assets.destination = @original_destination
-    
-    FileUtils.rm_r @test_target_directory_root
-    assert_false File.exists?(@test_target_directory_root)
+    # clean up after ourselves
+    FileUtils.rm_r root
+    should_not_exist root
   end
   
-  def test_install_skips_svn_directories
-    create_directory &quot;#{@test_target_directory_source}/images&quot;
-    create_directory @test_target_directory_destination
-    
-    [&quot;.svn&quot;, &quot;should_get_copied&quot;, &quot;images/should_get_copied.png&quot;].each do |path|
-      FileUtils.touch &quot;#{@test_target_directory_source}/#{path}&quot;
-    end
-    
+  def test_install_skips_dot_files_and_CVS_metadata
     Streamlined::Assets.install
     
-    assert File.exists?(&quot;#{@test_target_directory_destination}/should_get_copied&quot;)
-    assert File.exists?(&quot;#{@test_target_directory_destination}/images/should_get_copied.png&quot;)
-    assert_false File.exists?(&quot;#{@test_target_directory_destination}/.svn&quot;)
+    should_be_copied.each { |path| should_exist(path) }
+    should_not_be_copied.each { |path| should_not_exist(path) }
+  end
+  
+  # lets make sure things work fine using rake invoke, since thats how install.rb does it
+  def test_should_be_able_to_install_using_rake_invoke
+    Rake::Task['streamlined:install_files'].invoke
+
+    should_be_copied.each { |path| should_exist(path) }
+    should_not_be_copied.each { |path| should_not_exist(path) }
   end
   
   private
+
+  def create_source_directories
+    self.source_directories = source_directories.map { |dir| &quot;#{source}/#{dir}&quot;}
+    create_directories source_directories
+  end
+  
+  def should_exist(path)
+    assert File.exists?(full_destination_path(path)), &quot;The path '#{full_destination_path(path)}' should exist but does not.&quot;
+  end
   
-  def create_directory(path)
-    FileUtils.mkdir_p path unless File.exists? path
+  def should_not_exist(path)
+    assert_false File.exists?(full_destination_path(path)), &quot;The path '#{full_destination_path(path)}' should not exist but does.&quot;
   end
+  
+  def full_destination_path(path)
+    File.join(destination, path)
+  end
+  
+  # creates 1 to many directories if they don't exist
+  def create_directories(paths)
+    paths = Array(paths)
+    paths.each { |path| FileUtils.mkdir_p path unless File.exists? path }
+  end
+  alias_method :create_directory, :create_directories
+  
 
 end</diff>
      <filename>test/unit/streamlined/relevance_extensions_tasks_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>71e225594d9190b09e7078c9c545d10ad8558953</id>
    </parent>
  </parents>
  <author>
    <name>rob</name>
    <email>rob@4f249914-c612-0410-8deb-f4485a9d85ab</email>
  </author>
  <url>http://github.com/relevance/streamlined/commit/cb99d8585f008e83318b819fa5711903c9771986</url>
  <id>cb99d8585f008e83318b819fa5711903c9771986</id>
  <committed-date>2007-07-30T08:46:40-07:00</committed-date>
  <authored-date>2007-07-30T08:46:40-07:00</authored-date>
  <message>Make sure that the test for the install task really does test for .svn metadata, and .svn folders,
and CVS metadata, and those annoying mac meta data files too.  Refactor a bunch to clean up the test,
and comment to explain what is going on.</message>
  <tree>e98fdda51f16c027e1aadc82da6213994f97b73c</tree>
  <committer>
    <name>rob</name>
    <email>rob@4f249914-c612-0410-8deb-f4485a9d85ab</email>
  </committer>
</commit>
