You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/08/06 08:29:27 UTC

svn commit: r683133 - in /incubator/buildr/trunk: CHANGELOG lib/buildr/packaging/zip.rb spec/archive_spec.rb

Author: assaf
Date: Tue Aug  5 23:29:26 2008
New Revision: 683133

URL: http://svn.apache.org/viewvc?rev=683133&view=rev
Log:
Fixed: BUILDR-124 unzip(...).from_path does not work correctly without include (Rhett Sutphin).

Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/lib/buildr/packaging/zip.rb
    incubator/buildr/trunk/spec/archive_spec.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=683133&r1=683132&r2=683133&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Tue Aug  5 23:29:26 2008
@@ -22,6 +22,7 @@
 like java.util.Properties (Lacton).
 * Fixed: BUILDR-116: TestTask should include the main compile target in its
 dependencies, even when using non standard directories (Lacton).
+* Fixed: BUILDR-124 unzip(...).from_path does not work correctly without include (Rhett Sutphin).
 * Docs: BUILDR-111 Troubleshoot tip when Buildr's bin directory shows up in
 RUBYLIB (Geoffrey Ruscoe).
 

Modified: incubator/buildr/trunk/lib/buildr/packaging/zip.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/packaging/zip.rb?rev=683133&r1=683132&r2=683133&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/packaging/zip.rb (original)
+++ incubator/buildr/trunk/lib/buildr/packaging/zip.rb Tue Aug  5 23:29:26 2008
@@ -653,10 +653,12 @@
         includes = @include || ['**/*']
         excludes = @exclude || []
         entries.inject({}) do |map, entry|
-          short = entry.name.sub(@path, '')
-          if includes.any? { |pat| File.fnmatch(pat, short, File::FNM_PATHNAME) } &&
-             !excludes.any? { |pat| File.fnmatch(pat, short, File::FNM_PATHNAME) }
-            map[short] = entry
+          if entry.name =~ /^#{@path}/
+            short = entry.name.sub(@path, '')
+            if includes.any? { |pat| File.fnmatch(pat, short, File::FNM_PATHNAME) } &&
+               !excludes.any? { |pat| File.fnmatch(pat, short, File::FNM_PATHNAME) }
+              map[short] = entry
+            end
           end
           map
         end

Modified: incubator/buildr/trunk/spec/archive_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/archive_spec.rb?rev=683133&r1=683132&r2=683133&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/archive_spec.rb (original)
+++ incubator/buildr/trunk/spec/archive_spec.rb Tue Aug  5 23:29:26 2008
@@ -464,7 +464,7 @@
       FileList[File.join(@target, 'path/*')].size.should be(2)
     end
   end
-
+  
   it 'should exclude with relative path' do
     with_zip @files, :path=>'test' do
       except = File.basename(@files.first)
@@ -474,6 +474,16 @@
     end
   end
 
+  it "should handle relative paths without any includes or excludes" do
+    lib_files = %w{Test3.so Test4.rb}.
+      map { |file| File.join(@dir, file) }.
+      each { |file| write file, content_for(file) }
+    zip(@zip).include(@files, :path => 'src').include(lib_files, :path => 'lib').invoke
+
+    unzip(@target=>@zip).tap { |unzip| unzip.from_path('lib') }.target.invoke
+    FileList[File.join(@target, '**/*')].should have(2).files
+  end
+
   it 'should return itself from root method' do
     task = unzip(@target=>@zip)
     task.root.should be(task)