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/11/06 22:09:50 UTC
svn commit: r711976 - in /incubator/buildr/trunk: CHANGELOG
lib/buildr/java/packaging.rb spec/java/packaging_spec.rb
Author: assaf
Date: Thu Nov 6 13:09:42 2008
New Revision: 711976
URL: http://svn.apache.org/viewvc?rev=711976&view=rev
Log:
Fixed: BUILDR-194 Buildr always adds 'Manifest-Version' to generated manifest file.
Modified:
incubator/buildr/trunk/CHANGELOG
incubator/buildr/trunk/lib/buildr/java/packaging.rb
incubator/buildr/trunk/spec/java/packaging_spec.rb
Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=711976&r1=711975&r2=711976&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Thu Nov 6 13:09:42 2008
@@ -19,6 +19,7 @@
* Fixed: BUILDR-192 TestNG report results are overwritten (Alexis Midon).
* Fixed: BUILDR-193 TestNG uses project name for suite name (not valid file
name on Windows).
+* Fixed: BUILDR-194 Buildr always adds 'Manifest-Version' to generated manifest file.
* Fixed: BUILDR-198 Filter#run always calls mkpath with :verbose.
* Fixed: BUILDR-199 ArchiveTask#needed uses 'each' with no effect (Ittay
Dror).
Modified: incubator/buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/packaging.rb?rev=711976&r1=711975&r2=711976&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/packaging.rb Thu Nov 6 13:09:42 2008
@@ -25,7 +25,7 @@
class Manifest
- STANDARD_HEADER = "Manifest-Version: 1.0\nCreated-By: Buildr\n"
+ STANDARD_HEADER = { 'Manifest-Version'=>'1.0', 'Created-By'=>'Buildr' }
LINE_SEPARATOR = /\r\n|\n|\r[^\n]/ #:nodoc:
SECTION_SEPARATOR = /(#{LINE_SEPARATOR}){2}/ #:nodoc:
@@ -97,6 +97,10 @@
else
fail 'Invalid manifest, expecting Hash, Array, file name/task or proc/method.'
end
+ # Add Manifest-Version and Created-By, if not specified.
+ STANDARD_HEADER.each do |name, value|
+ sections.first[name] ||= value
+ end
end
# The sections of this manifest.
@@ -171,7 +175,7 @@
@manifest_tmp = Tempfile.new('MANIFEST.MF')
self.manifest = File.read(manifest.to_s) if String === manifest || Rake::Task === manifest
self.manifest = Manifest.new(manifest) unless Manifest === manifest
- @manifest_tmp.write Manifest::STANDARD_HEADER
+ #@manifest_tmp.write Manifest::STANDARD_HEADER
@manifest_tmp.write manifest.to_s
@manifest_tmp.write "\n"
@manifest_tmp.rewind
Modified: incubator/buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/java/packaging_spec.rb?rev=711976&r1=711975&r2=711976&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/java/packaging_spec.rb (original)
+++ incubator/buildr/trunk/spec/java/packaging_spec.rb Thu Nov 6 13:09:42 2008
@@ -170,11 +170,20 @@
package_with_manifest 'MANIFEST.MF'
inspect_manifest do |manifest|
manifest.sections.size.should be(1)
- manifest.main['Manifest-Version'].should eql('1.0')
manifest.main['Meta'].should eql('data')
end
end
+ it 'should not add manifest version twice' do
+ write 'MANIFEST.MF', 'Manifest-Version: 1.9'
+ package_with_manifest 'MANIFEST.MF'
+ package ||= project('foo').package(@packaging)
+ package.invoke
+ Zip::ZipFile.open(package.to_s) do |zip|
+ zip.read('META-INF/MANIFEST.MF').scan(/(Manifest-Version)/m).size.should == 1
+ end
+ end
+
it 'should create manifest from task' do
file 'MANIFEST.MF' do |task|
write task.to_s, 'Meta: data'