<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -23,6 +23,7 @@ Jeweler::Tasks.new do |gem|
   gem.add_development_dependency &quot;rr&quot;
   gem.add_development_dependency &quot;mocha&quot;
   gem.add_development_dependency &quot;redgreen&quot;
+  gem.add_development_dependency &quot;devver-construct&quot;
 
   gem.add_development_dependency &quot;yard&quot;
   gem.add_development_dependency &quot;cucumber&quot;</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,9 @@ class Jeweler
     def self.filelist_attribute(name)
       code = %{
         def #{name}
+          if @#{name} &amp;&amp; @#{name}.class != FileList
+            @#{name} = FileList[@#{name}]
+          end
           @#{name} ||= FileList[]
         end
         def #{name}=(value)
@@ -29,28 +32,40 @@ class Jeweler
 
     # Assigns the Jeweler defaults to the Gem::Specification
     def set_jeweler_defaults(base_dir, git_base_dir = nil)
-      Dir.chdir(base_dir) do
+      base_dir = File.expand_path(base_dir)
+      git_base_dir = if git_base_dir
+                       File.expand_path(git_base_dir)
+                     else
+                       base_dir
+                     end
+      can_git = git_base_dir &amp;&amp; File.directory?(File.join(git_base_dir, '.git'))
+
+      Dir.chdir(git_base_dir) do
         require 'git'
-        if blank?(files) &amp;&amp; git_base_dir
-          git_subdir = File.expand_path(base_dir).sub(File.join(File.expand_path(git_base_dir), &quot;&quot;), &quot;&quot;)          
-          repo = Git.open(git_base_dir)
-          self.files = (repo.ls_files.keys - repo.lib.ignored_files).map {|fn| fn.sub(File.join(git_subdir, &quot;&quot;), &quot;&quot;)}
+        repo = Git.open(git_base_dir) if can_git
+
+        if blank?(files) &amp;&amp; repo
+          base_dir_with_trailing_separator = File.join(base_dir, &quot;&quot;)
+
+          self.files = (repo.ls_files(base_dir).keys - repo.lib.ignored_files).map do |file|
+            #breakpoint
+            File.expand_path(file).sub(base_dir_with_trailing_separator, &quot;&quot;)
+          end
         end
 
-        if blank?(test_files) &amp;&amp; File.directory?(File.join(base_dir, '.git'))
-          repo = Git.open(base_dir)
+        if blank?(test_files) &amp;&amp; repo
           self.test_files = FileList['{spec,test,examples}/**/*.rb'] - repo.lib.ignored_files
         end
 
         if blank?(executables)
-          self.executables = Dir[&quot;bin/*&quot;].map { |f| File.basename(f) }
+          self.executables = Dir['bin/*'].map { |f| File.basename(f) }
         end
 
         self.has_rdoc = true
         rdoc_options &lt;&lt; '--charset=UTF-8'
 
         if blank?(extra_rdoc_files)
-          self.extra_rdoc_files = FileList[&quot;README*&quot;, &quot;ChangeLog*&quot;, &quot;LICENSE*&quot;]
+          self.extra_rdoc_files = FileList['README*', 'ChangeLog*', 'LICENSE*', 'TODO']
         end
       end
     end</diff>
      <filename>lib/jeweler/specification.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,60 +2,222 @@ require 'test_helper'
 
 class TestSpecification &lt; Test::Unit::TestCase
   def setup
-    remove_tmpdir!
-    path = File.join(FIXTURE_DIR, &quot;existing-project-with-version-yaml&quot;)
-    Git.init(path)
-    FileUtils.cp_r path, tmp_dir
-    #breakpoint
+    @project = create_construct
+  end
 
+  def teardown
+    @project.destroy!
+  end
 
-    @spec = Gem::Specification.new
-    @spec.extend(Jeweler::Specification)
-    @spec.set_jeweler_defaults(tmp_dir)
+  def build_jeweler_gemspec(&amp;block)
+    gemspec = if block
+                Gem::Specification.new(&amp;block)
+              else
+                Gem::Specification.new()
+              end
+    gemspec.extend(Jeweler::Specification)
+    gemspec
   end
 
-  def teardown
-    remove_tmpdir!
+  context &quot;basic defaults&quot; do
+    setup do
+      @gemspec = build_jeweler_gemspec
+    end
+
+    should &quot;make files a FileList&quot; do
+      assert_equal FileList, @gemspec.files.class
+    end
+
+    should &quot;make test_files a FileList&quot; do
+      assert_equal FileList, @gemspec.test_files.class
+    end
+
+    should &quot;make extra_rdoc_files a FileList&quot; do
+      assert_equal FileList, @gemspec.extra_rdoc_files.class
+    end
+
+    should &quot;enable rdoc&quot; do
+      assert @gemspec.has_rdoc
+    end
   end
+ 
+  context &quot;there aren't any executables in the project directory&quot; do
+    setup do
+      @project.directory 'bin' 
+    end
 
-  context &quot;Gem::Specification with Jeweler monkey-patches&quot; do
-    context &quot;when setting defaults&quot; do
-      should_eventually &quot;should populate `files'&quot; do
-        # this implementation changed to use ruby-git
-        assert_equal %w{Rakefile VERSION.yml bin/foo_the_ultimate_bin lib/foo_the_ultimate_lib.rb }, @spec.files.sort
+    context &quot;and there hasn't been any set on the gemspec&quot; do
+      setup do
+        @gemspec = build_jeweler_gemspec
+        @gemspec.set_jeweler_defaults(@project)
       end
 
-      should &quot;should populate `executables'&quot; do
-        assert_equal %w{ foo_the_ultimate_bin }, @spec.executables
+
+      should &quot;have empty gemspec executables&quot; do
+        assert_equal [], @gemspec.executables
       end
+    end
 
-      context &quot;with values already set&quot; do
-        setup do
-          @spec.files = %w{ hey_include_me_in_gemspec }
-          @spec.set_jeweler_defaults(fixture_dir)
+    context &quot;and has been previously set executables&quot; do
+      setup do
+        @gemspec  = build_jeweler_gemspec do |gemspec|
+          gemspec.executables = %w(non-existant)
         end
+        @gemspec.set_jeweler_defaults(@project)
+      end
 
-        should &quot;not re-populate `files'&quot; do
-          assert_equal %w{ hey_include_me_in_gemspec }, @spec.files
-        end
+      should &quot;have only the original executables in the gemspec&quot; do
+        assert_equal %w(non-existant), @gemspec.executables
+      end
+    end
+  end
+
+  context &quot;there are multiple executables in the project directory&quot; do
+    setup do
+      @project.directory('bin') do |bin|
+        bin.file 'burnination'
+        bin.file 'trogdor'
+      end
+    end
+
+    context &quot;and there hasn't been any set on the gemspec&quot; do
+      setup do
+        @gemspec  = build_jeweler_gemspec
+        @gemspec.set_jeweler_defaults(@project)
       end
 
-      context &quot;for rdoc&quot; do
-        should &quot;be enabled&quot; do
-          assert @spec.has_rdoc
+      should &quot;have the executables in the gemspec&quot; do
+        assert_equal %w(burnination trogdor), @gemspec.executables
+      end
+    end
+    context &quot;and has been previously set executables&quot; do
+      setup do
+        @gemspec  = build_jeweler_gemspec do |gemspec|
+          gemspec.executables = %w(burnination)
         end
+        @gemspec.set_jeweler_defaults(@project)
+      end
+      should &quot;have only the original executables in the gemspec&quot; do
+        assert_equal %w(burnination), @gemspec.executables
+      end
+    end
+  end
+
+  context &quot;there are some files and is setup for git&quot; do
+    setup do
+      @project.file 'Rakefile'
+      @project.directory('lib') do |lib|
+        lib.file 'example.rb'
+      end
 
-        should &quot;be utf-8&quot; do
-          assert @spec.rdoc_options.include?('--charset=UTF-8')
+      repo = Git.init(@project)
+      repo.add('.')
+      repo.commit('Initial commit')
+
+
+      @gemspec  = build_jeweler_gemspec
+      @gemspec.set_jeweler_defaults(@project, @project)
+    end
+
+    should &quot;populate files from git&quot; do
+      assert_equal %w(Rakefile lib/example.rb), @gemspec.files
+    end
+  end
+
+  context &quot;there are some files and is setup for git with ignored files&quot; do
+    setup do
+      @project.file '.gitignore', 'ignored'
+      @project.file 'ignored'
+      @project.file 'Rakefile'
+      @project.directory('lib') do |lib|
+        lib.file 'example.rb'
+      end
+
+      repo = Git.init(@project)
+      repo.add('.')
+      repo.commit('Initial commit')
+
+
+      @gemspec  = build_jeweler_gemspec
+      @gemspec.set_jeweler_defaults(@project, @project)
+    end
+
+    should &quot;populate files from git excluding ignored&quot; do
+      assert_equal %w(.gitignore Rakefile lib/example.rb), @gemspec.files
+    end
+  end
+
+  context &quot;there are some files and is setup for git and working in a sub directory&quot; do
+    setup do
+      @subproject = File.join(@project, 'subproject')
+      @project.file 'Rakefile'
+      @project.directory 'subproject' do |subproject|
+        subproject.directory('lib') do |lib|
+          lib.file 'subproject_example.rb'
         end
       end
+
+      repo = Git.init(@project)
+      repo.add('.')
+      repo.commit('Initial commit')
+
+      @gemspec  = build_jeweler_gemspec
+      @gemspec.set_jeweler_defaults(@subproject, @project)
+    end
+
+    should &quot;populate files from git relative to sub directory&quot; do
+      assert_equal %w(lib/subproject_example.rb).sort, @gemspec.files.sort
     end
+  end
+
+  context &quot;there are some files and is not setup for git&quot; do
+    setup do
+      @project.file 'Rakefile'
+      @project.directory('lib') do |lib|
+        lib.file 'example.rb'
+      end
 
-    should &quot;allow the user to concat files to the existing `files' array&quot; do
-      before = @spec.files.dup
-      @spec.files &lt;&lt; 'extra'
+      @gemspec  = build_jeweler_gemspec
+      @gemspec.set_jeweler_defaults(@project, @project)
+    end
 
-      assert_equal before + %w{ extra }, @spec.files
+    should &quot;not populate files&quot; do
+      assert_equal [], @gemspec.files.sort
     end
   end
+
+  #context &quot;Gem::Specification with Jeweler monkey-patches&quot; do
+  #  setup do
+  #    remove_tmpdir!
+  #    path = File.join(FIXTURE_DIR, &quot;existing-project-with-version-yaml&quot;)
+  #    Git.init(path)
+  #    FileUtils.cp_r path, tmp_dir
+
+  #    @spec = Gem::Specification.new
+  #    @spec.extend(Jeweler::Specification)
+
+  #  end
+
+  #  context &quot;when setting defaults&quot; do
+  #    setup do
+  #      @spec.set_jeweler_defaults(tmp_dir)
+  #    end
+
+  #    should_eventually &quot;should populate `files'&quot; do
+  #      assert_equal %w{Rakefile VERSION.yml bin/foo_the_ultimate_bin lib/foo_the_ultimate_lib.rb }, @spec.files.sort
+  #    end
+
+  #    context &quot;with values already set&quot; do
+  #      setup do
+  #        @spec.files = %w{ hey_include_me_in_gemspec }
+  #        @spec.set_jeweler_defaults(fixture_dir)
+  #      end
+
+  #      should &quot;not re-populate `files'&quot; do
+  #        assert_equal %w{ hey_include_me_in_gemspec }, @spec.files
+  #      end
+  #    end
+  #  end
+
+  #end
 end</diff>
      <filename>test/jeweler/test_specification.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,8 @@ begin
   require 'shoulda'
   require 'rr'
   require 'redgreen'
+  require 'construct'
+  require 'git'
 rescue LoadError =&gt; e
   puts &quot;*&quot; * 80
   puts &quot;Some dependencies needed to run tests were missing. Run the following command to find them:&quot;
@@ -42,6 +44,7 @@ end
 
 class Test::Unit::TestCase
   include RR::Adapters::TestUnit unless include?(RR::Adapters::TestUnit)
+  include Construct::Helpers
 
   def tmp_dir
     TMP_DIR</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>92dd67134b208440e70b7e9d058fe540a6ca7ed7</id>
    </parent>
  </parents>
  <author>
    <name>Joshua Nichols</name>
    <email>josh@technicalpickles.com</email>
  </author>
  <url>http://github.com/technicalpickles/jeweler/commit/8872d6c8b102a9b1a2b4d0ca1c0f297d084b5093</url>
  <id>8872d6c8b102a9b1a2b4d0ca1c0f297d084b5093</id>
  <committed-date>2009-11-01T17:35:11-08:00</committed-date>
  <authored-date>2009-11-01T17:35:11-08:00</authored-date>
  <message>Cleaning up how the Jeweler::Specification tests are done, and started using construct for them. Also, code cleanup in Jeweler::Specification.</message>
  <tree>c0afba9b0ecfd59a758a6e36ecfa7b9ecb8d0faf</tree>
  <committer>
    <name>Joshua Nichols</name>
    <email>josh@technicalpickles.com</email>
  </committer>
</commit>
