You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/06/05 03:52:05 UTC
svn commit: r951632 - in /buildr/trunk: CHANGELOG
lib/buildr/packaging/archive.rb spec/java/packaging_spec.rb
spec/packaging/archive_spec.rb
Author: toulmean
Date: Sat Jun 5 01:52:05 2010
New Revision: 951632
URL: http://svn.apache.org/viewvc?rev=951632&view=rev
Log:
BUILDR-447 Path object do not include empty dirs in base directory (Peter Donald)
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/packaging/archive.rb
buildr/trunk/spec/java/packaging_spec.rb
buildr/trunk/spec/packaging/archive_spec.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=951632&r1=951631&r2=951632&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sat Jun 5 01:52:05 2010
@@ -135,6 +135,7 @@
* Fixed: BUILDR-419 Exclusion patterns only work if they contain a wildcard
* Fixed: BUILDR-421 The MANIFEST.MF file packaged by Buildr as permissions set to 600
* Fixed: BUILDR-423 MANIFEST.MF files are not closed, leading to open files leak.
+* Fixed: BUILDR-447 Path object do not include empty dirs in base directory (Peter Donald)
1.3.5 (2009-10-05)
* Added: Interactive shell (REPL) support
* Added: BeanShell as default shell for java projects, bsh is small and it's
Modified: buildr/trunk/lib/buildr/packaging/archive.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/archive.rb?rev=951632&r1=951631&r2=951632&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/archive.rb (original)
+++ buildr/trunk/lib/buildr/packaging/archive.rb Sat Jun 5 01:52:05 2010
@@ -46,10 +46,9 @@ module Buildr
file_map[dest] = file
end
end
- else
- trace "Adding #{@path}#{File.basename(path)}"
- file_map["#{@path}#{File.basename(path)}"] = path
end
+ trace "Adding #{@path}#{File.basename(path)}"
+ file_map["#{@path}#{File.basename(path)}"] = path
end
end
end
@@ -215,10 +214,9 @@ module Buildr
file_map[dest] = file
end
end
- else
- trace "Adding #{@path}#{as}"
- file_map["#{@path}#{as}"] = file
end
+ trace "Adding #{@path}#{as}"
+ file_map["#{@path}#{as}"] = file
end
end
end
Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=951632&r1=951631&r2=951632&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Sat Jun 5 01:52:05 2010
@@ -435,7 +435,7 @@ describe Packaging, 'jar' do
define('foo', :version=>'1.0') { package(:jar) }
project('foo').package(:jar).invoke
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
- entries_to_s = jar.entries.map(&:to_s)
+ entries_to_s = jar.entries.map(&:to_s).delete_if {|entry| entry[-1,1] == "/"}
# Sometimes META-INF/ is counted as first entry, which is fair game.
(entries_to_s.first == 'META-INF/MANIFEST.MF' || entries_to_s[1] == 'META-INF/MANIFEST.MF').should be_true
end
Modified: buildr/trunk/spec/packaging/archive_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/archive_spec.rb?rev=951632&r1=951631&r2=951632&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/archive_spec.rb (original)
+++ buildr/trunk/spec/packaging/archive_spec.rb Sat Jun 5 01:52:05 2010
@@ -22,6 +22,8 @@ describe 'ArchiveTask', :shared=>true do
@dir = File.expand_path('test')
@files = %w{Test1.txt Text2.html}.map { |file| File.expand_path(file, @dir) }.
each { |file| write file, content_for(file) }
+ @empty_dirs = %w{EmptyDir1 EmptyDir2}.map { |file| File.expand_path(file, @dir) }.
+ each { |file| mkdir file }
end
# Not too smart, we just create some content based on file name to make sure you read what you write.
@@ -397,6 +399,22 @@ describe ZipTask do
entries
end
+ it 'should include empty dirs' do
+ archive(@archive).include(@dir)
+ archive(@archive).invoke
+ inspect_archive do |archive|
+ archive.keys.should include('test/EmptyDir1/')
+ end
+ end
+
+ it 'should include empty dirs from Dir' do
+ archive(@archive).include(Dir["#{@dir}/*"])
+ archive(@archive).invoke
+ inspect_archive do |archive|
+ archive.keys.should include('EmptyDir1/')
+ end
+ end
+
it 'should work with path object' do
archive(@archive).path('code').include(@files)
archive(@archive).invoke