buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r753061 - in /buildr/trunk: CHANGELOG lib/buildr/java/packaging.rb spec/java/packaging_spec.rb
Date Thu, 12 Mar 2009 23:45:27 GMT
Author: assaf
Date: Thu Mar 12 23:45:26 2009
New Revision: 753061

URL: http://svn.apache.org/viewvc?rev=753061&view=rev
Log:
Fixed:  BUILDR-218 Manifest.from_zip fails if the zip doesn't already have META-INF/MANIFEST.MF.

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/packaging.rb
    buildr/trunk/spec/java/packaging_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=753061&r1=753060&r2=753061&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Mar 12 23:45:26 2009
@@ -42,6 +42,8 @@
 * Fixed:  BUILDR-201 Sample project is not valid (Alexis Midon).
 * Fixed:  BUILDR-214 Buildr is stuck uploading to sftp repository (Heikki Hulkko).
 * Fixed:  BUILDR-216 Profiles documentation is wrong (Shane Witbeck).
+* Fixed:  BUILDR-218 Manifest.from_zip fails if the zip doesn't already have
+META-INF/MANIFEST.MF (Joel Muzzerall).
 * Fixed:  BUILDR-226 Release task should use XML output of "svn info" instead
 of human-readable output (Alexis Midon).
 * Fixed:  BUILDR-235 JRuby download link is broke (Alexis Midon).

Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=753061&r1=753060&r2=753061&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Thu Mar 12 23:45:26 2009
@@ -57,8 +57,7 @@
           # Parse the MANIFEST.MF entry of a ZIP (or JAR) file and return a new Manifest.
           def from_zip(file)
             Zip::ZipFile.open(file.to_s) do |zip|
-              return Manifest.new unless zip.get_entry('META-INF/MANIFEST.MF')
-              Manifest.parse zip.read('META-INF/MANIFEST.MF')
+              Manifest.parse zip.read('META-INF/MANIFEST.MF') rescue Manifest.new
             end
           end
 

Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=753061&r1=753060&r2=753061&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Thu Mar 12 23:45:26 2009
@@ -96,6 +96,18 @@
     end
   end
 
+  it 'should generate a new manifest for a file that does not have one' do
+    Zip::ZipFile.open("tmp.zip", Zip::ZipFile::CREATE).close 
+    begin
+      manifest = Buildr::Packaging::Java::Manifest.from_zip('tmp.zip')
+      manifest.each do |key, val|
+        Buildr::Packaging::Java::Manifest::STANDARD_HEADER.should include(key)
+      end
+    ensure
+      rm 'tmp.zip'
+    end
+  end
+
   it 'should map manifest from hash' do
     package_with_manifest 'Foo'=>1, :bar=>'Bar'
     inspect_manifest do |manifest|



Mime
View raw message