Repository: buildr Updated Branches: refs/heads/master f11055e56 -> 4ab5169d8
upgrade rubyzip to 1.2.0 Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/4ab5169d Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/4ab5169d Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/4ab5169d Branch: refs/heads/master Commit: 4ab5169d8bb3b9879aab36fb202272d1cefb8cfd Parents: f11055e Author: Antoine Toulme <[email protected]> Authored: Sat Apr 30 18:35:17 2016 -0700 Committer: Antoine Toulme <[email protected]> Committed: Sat Apr 30 18:35:17 2016 -0700 ---------------------------------------------------------------------- CHANGELOG | 1 + buildr.gemspec | 2 +- lib/buildr/java/commands.rb | 2 +- lib/buildr/java/packaging.rb | 12 +++---- lib/buildr/packaging/archive.rb | 2 +- lib/buildr/packaging/zip.rb | 61 ++++++++++++++++++----------------- lib/buildr/packaging/ziptask.rb | 8 ++--- lib/buildr/scala/compiler.rb | 2 +- spec/addon/bnd_spec.rb | 8 ++--- spec/addon/custom_pom_spec.rb | 2 +- spec/groovy/compiler_spec.rb | 4 +-- spec/java/packaging_spec.rb | 46 +++++++++++++------------- spec/packaging/archive_spec.rb | 2 +- spec/packaging/packaging_spec.rb | 2 +- spec/scala/compiler_spec.rb | 16 ++++----- tests/integration_testing.rb | 4 +-- 16 files changed, 87 insertions(+), 87 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/CHANGELOG ---------------------------------------------------------------------- diff --git a/CHANGELOG b/CHANGELOG index 8c7b14c..6d83d39 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ 1.4.26 (Pending) * Change: Update RJB to 1.5.4 +* Change: Update rubyzip to 1.2.0 1.4.25 (2016-04-18) * Change: BUILDR-712 Update jruby-openssl dependency version or support a range of versions http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/buildr.gemspec ---------------------------------------------------------------------- diff --git a/buildr.gemspec b/buildr.gemspec index 27f8240..4445f10 100644 --- a/buildr.gemspec +++ b/buildr.gemspec @@ -62,7 +62,7 @@ for those one-off tasks, with a language that's a joy to use. spec.add_dependency 'net-sftp', '2.1.2' # Required for sftp support under windows spec.add_dependency 'jruby-pageant', '1.1.1' if $platform.to_s == 'java' - spec.add_dependency 'rubyzip', '0.9.9' + spec.add_dependency 'rubyzip', '1.2.0' spec.add_dependency 'json_pure', '1.8.0' spec.add_dependency 'hoe', '3.7.1' spec.add_dependency 'rjb', '1.5.4' if ($platform.to_s == 'x86-mswin32' || $platform.to_s == 'ruby') http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/lib/buildr/java/commands.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/java/commands.rb b/lib/buildr/java/commands.rb index 7328fb9..084fe0e 100644 --- a/lib/buildr/java/commands.rb +++ b/lib/buildr/java/commands.rb @@ -75,7 +75,7 @@ module Java end manifest = Buildr::Packaging::Java::Manifest.new([{'Class-Path' => paths.join(" ")}]) tjar = Tempfile.new(['javacmd', '.jar']) - Zip::ZipOutputStream.open(tjar.path) do |zos| + Zip::OutputStream.open(tjar.path) do |zos| zos.put_next_entry('META-INF/MANIFEST.MF') zos.write manifest.to_s zos.write "\n" http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/lib/buildr/java/packaging.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/java/packaging.rb b/lib/buildr/java/packaging.rb index 0e2da91..841c9fe 100644 --- a/lib/buildr/java/packaging.rb +++ b/lib/buildr/java/packaging.rb @@ -52,12 +52,8 @@ module Buildr #:nodoc: # # Parse the MANIFEST.MF entry of a ZIP (or JAR) file and return a new Manifest. def from_zip(file) - Zip::ZipInputStream::open(file.to_s) do |zip| - while (entry = zip.get_next_entry) - if entry.name == 'META-INF/MANIFEST.MF' - return Manifest.parse zip.read - end - end + Zip::File.open(file.to_s) do |zip| + return Manifest.parse zip.read('META-INF/MANIFEST.MF') if zip.find_entry('META-INF/MANIFEST.MF') end Manifest.new end @@ -71,7 +67,7 @@ module Buildr #:nodoc: def update_manifest(file) manifest = from_zip(file) result = yield manifest - Zip::ZipFile.open(file.to_s) do |zip| + Zip::File.open(file.to_s) do |zip| zip.get_output_stream('META-INF/MANIFEST.MF') do |out| out.write manifest.to_s out.write "\n" @@ -469,7 +465,7 @@ module Buildr #:nodoc: Manifest.update_manifest(task) do |manifest| class_path = manifest.main['Class-Path'].to_s.split included_libs = class_path.map { |fn| fn.pathmap('%f') } - Zip::ZipFile.foreach(task.to_s) do |entry| + Zip::File.foreach(task.to_s) do |entry| included_libs << entry.name.pathmap('%f') if entry.file? && entry.name =~ /^WEB-INF\/lib\/[^\/]+$/ end # Include all other libraries in the classpath. http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/lib/buildr/packaging/archive.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/packaging/archive.rb b/lib/buildr/packaging/archive.rb index cc053b7..da0603d 100644 --- a/lib/buildr/packaging/archive.rb +++ b/lib/buildr/packaging/archive.rb @@ -292,7 +292,7 @@ module Buildr #:nodoc: def expand(file_map, path) @includes = ['*'] if @includes.empty? - Zip::ZipFile.open(@zip_file) do |source| + Zip::File.open(@zip_file) do |source| source.entries.reject { |entry| entry.directory? }.each do |entry| if @includes.any? { |pattern| File.fnmatch(pattern, entry.name) } && [email protected]? { |pattern| File.fnmatch(pattern, entry.name) } http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/lib/buildr/packaging/zip.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/packaging/zip.rb b/lib/buildr/packaging/zip.rb index ebb6b67..3f2dfc7 100644 --- a/lib/buildr/packaging/zip.rb +++ b/lib/buildr/packaging/zip.rb @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations under # the License. +require 'zip' + if RUBY_VERSION >= '1.9.0' # Required to properly load RubyZip under Ruby 1.9 $LOADED_FEATURES.unshift 'ftools' require 'fileutils' @@ -26,29 +28,39 @@ if RUBY_VERSION >= '1.9.0' # Required to properly load RubyZip under Ruby 1.9 end end -require 'zip/zip' -require 'zip/zipfilesystem' - module Zip #:nodoc: - class ZipCentralDirectory #:nodoc: + class CentralDirectory #:nodoc: # Patch to add entries in alphabetical order. def write_to_stream(io) offset = io.tell - @entrySet.sort { |a,b| a.name <=> b.name }.each { |entry| entry.write_c_dir_entry(io) } - write_e_o_c_d(io, offset) + @entry_set.sort { |a,b| a.name <=> b.name }.each { |entry| entry.write_c_dir_entry(io) } + eocd_offset = io.tell + cdir_size = eocd_offset - offset + write_e_o_c_d(io, offset, cdir_size) + end + end + + class File + + # :call-seq: + # exist() => boolean + # + # Returns true if this entry exists. + def exist?(entry_name) + !!find_entry(entry_name) end end - class ZipEntry + class Entry # :call-seq: # exist() => boolean # # Returns true if this entry exists. def exist?() - Zip::ZipFile.open(zipfile) { |zip| zip.file.exist?(@name) } + File.open(zipfile) { |zip| zip.exist?(@name) } end # :call-seq: @@ -56,7 +68,7 @@ module Zip #:nodoc: # # Returns true if this entry is empty. def empty?() - Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) }.empty? + File.open(zipfile) { |zip| zip.read(@name) }.empty? end # :call-seq: @@ -65,7 +77,7 @@ module Zip #:nodoc: # Returns true if this ZIP file entry matches against all the arguments. An argument may be # a string or regular expression. def contain?(*patterns) - content = Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) } + content = File.open(zipfile) { |zip| zip.read(@name) } patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }. all? { |pattern| content =~ pattern } end @@ -89,7 +101,7 @@ module Zip #:nodoc: raise ZipInternalError, "unknown file type #{self.inspect}" end - @externalFileAttributes = (ft << 12 | (@unix_perms & 07777)) << 16 + @external_file_attributes = (ft << 12 | (@unix_perms & 07777)) << 16 end io << @@ -105,12 +117,12 @@ module Zip #:nodoc: @compressed_size, @size, @name ? @name.length : 0, - @extra ? @extra.c_dir_length : 0, + @extra ? @extra.c_dir_size : 0, @comment ? comment.to_s.length : 0, 0, # disk number start - @internalFileAttributes, # file type (binary=0, text=1) - @externalFileAttributes, # native filesystem attributes - @localHeaderOffset, + @internal_file_attributes, # file type (binary=0, text=1) + @external_file_attributes, # native filesystem attributes + @local_header_offset, @name, @extra, @comment @@ -142,7 +154,7 @@ module Zip #:nodoc: raise ZipInternalError, "unknown file type #{self.inspect}" end - @externalFileAttributes = (ft << 12 | (@unix_perms & 07777)) << 16 + @external_file_attributes = (ft << 12 | (@unix_perms & 07777)) << 16 end io << @@ -158,12 +170,12 @@ module Zip #:nodoc: @compressed_size, @size, @name ? @name.length : 0, - @extra ? @extra.c_dir_length : 0, + @extra ? @extra.c_dir_size : 0, @comment ? @comment.length : 0, 0, # disk number start - @internalFileAttributes, # file type (binary=0, text=1) - @externalFileAttributes, # native filesystem attributes - @localHeaderOffset, + @internal_file_attributes, # file type (binary=0, text=1) + @external_file_attributes, # native filesystem attributes + @local_header_offset, @name, @extra, @comment].pack('VCCvvvvvVVVvvvvvVV') @@ -174,13 +186,4 @@ module Zip #:nodoc: end end - - class ZipEntrySet - alias_method :original_push, :"<<" - alias_method :push, :"<<" - - def <<(entry) - original_push(entry) if entry != nil - end - end end http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/lib/buildr/packaging/ziptask.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/packaging/ziptask.rb b/lib/buildr/packaging/ziptask.rb index f57b4da..644c0b5 100644 --- a/lib/buildr/packaging/ziptask.rb +++ b/lib/buildr/packaging/ziptask.rb @@ -42,17 +42,17 @@ module Buildr #:nodoc: # for example: # package(:jar).entry("META-INF/LICENSE").should contain(/Apache Software License/) def entry(entry_name) - ::Zip::ZipEntry.new(name, entry_name) + ::Zip::Entry.new(name, entry_name) end def entries #:nodoc: - @entries ||= Zip::ZipFile.open(name) { |zip| zip.entries } + @entries ||= Zip::File.open(name) { |zip| zip.entries } end private def create_from(file_map) - Zip::ZipOutputStream.open name do |zip| + Zip::OutputStream.open name do |zip| seen = {} mkpath = lambda do |dir| dirname = (dir[-1..-1] =~ /\/$/) ? dir : dir + '/' @@ -166,7 +166,7 @@ module Buildr #:nodoc: end } else - Zip::ZipFile.open(zip_file.to_s) do |zip| + Zip::File.open(zip_file.to_s) do |zip| entries = zip.collect @paths.each do |path, patterns| patterns.map(entries).each do |dest, entry| http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/lib/buildr/scala/compiler.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/scala/compiler.rb b/lib/buildr/scala/compiler.rb index c41076e..0fc6147 100644 --- a/lib/buildr/scala/compiler.rb +++ b/lib/buildr/scala/compiler.rb @@ -29,7 +29,7 @@ module Buildr::Scala @installed_version = if Scalac.installed? begin # try to read the value from the properties file - props = Zip::ZipFile.open(File.expand_path('lib/scala-library.jar', Scalac.scala_home)) do |zipfile| + props = Zip::File.open(File.expand_path('lib/scala-library.jar', Scalac.scala_home)) do |zipfile| zipfile.read 'library.properties' end http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/spec/addon/bnd_spec.rb ---------------------------------------------------------------------- diff --git a/spec/addon/bnd_spec.rb b/spec/addon/bnd_spec.rb index e65167e..ec3a10b 100644 --- a/spec/addon/bnd_spec.rb +++ b/spec/addon/bnd_spec.rb @@ -20,7 +20,7 @@ Sandbox.require_optional_extension 'buildr/bnd' def open_zip_file(file = 'target/foo-2.1.3.jar') jar_filename = @foo._(file) File.should be_exist(jar_filename) - Zip::ZipFile.open(jar_filename) do |zip| + Zip::File.open(jar_filename) do |zip| yield zip end end @@ -130,13 +130,13 @@ SRC it "produces a .jar containing correct .class files for root project" do open_zip_file do |zip| - zip.file.exist?('com/biz/Foo.class').should be_true + zip.exist?('com/biz/Foo.class').should be_true end end it "produces a .jar containing resoruces from resource directory root project" do open_zip_file do |zip| - zip.file.exist?('IRIS-INF/iris.config').should be_true + zip.exist?('IRIS-INF/iris.config').should be_true end end @@ -167,7 +167,7 @@ SRC it "produces a .jar containing correct .class files for subproject project" do open_zip_file('bar/target/foo-bar-2.2.jar') do |zip| - zip.file.exist?('com/biz/bar/Bar.class').should be_true + zip.exist?('com/biz/bar/Bar.class').should be_true end end http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/spec/addon/custom_pom_spec.rb ---------------------------------------------------------------------- diff --git a/spec/addon/custom_pom_spec.rb b/spec/addon/custom_pom_spec.rb index 9b78bf5..4834b49 100644 --- a/spec/addon/custom_pom_spec.rb +++ b/spec/addon/custom_pom_spec.rb @@ -70,7 +70,7 @@ describe Buildr::CustomPom do ['id-provided', 'id-optional', 'id-runtime', 'id-test'].each do |artifact_id| artifact("group:#{artifact_id}:jar:1.0") do |t| mkdir_p File.dirname(t.to_s) - Zip::ZipOutputStream.open t.to_s do |zip| + Zip::OutputStream.open t.to_s do |zip| zip.put_next_entry 'empty.txt' end end http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/spec/groovy/compiler_spec.rb ---------------------------------------------------------------------- diff --git a/spec/groovy/compiler_spec.rb b/spec/groovy/compiler_spec.rb index e42bba0..a6f19c5 100644 --- a/spec/groovy/compiler_spec.rb +++ b/spec/groovy/compiler_spec.rb @@ -140,8 +140,8 @@ describe 'groovyc compiler' do write 'src/main/groovy/some/Example.groovy', 'package some; class Example { }' define('foo', :version => '1.0').package.invoke file('target/foo-1.0.jar').should exist - Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar| - jar.file.exist?('some/Example.class').should be_true + Zip::File.open(project('foo').package(:jar).to_s) do |jar| + jar.exist?('some/Example.class').should be_true end end http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/spec/java/packaging_spec.rb ---------------------------------------------------------------------- diff --git a/spec/java/packaging_spec.rb b/spec/java/packaging_spec.rb index d267189..a13f4a4 100644 --- a/spec/java/packaging_spec.rb +++ b/spec/java/packaging_spec.rb @@ -91,13 +91,13 @@ shared_examples_for 'package with manifest' do it 'should not exist when manifest=false' do package_with_manifest false @project.package(@packaging).invoke - Zip::ZipFile.open(@project.package(@packaging).to_s) do |zip| - zip.file.exist?('META-INF/MANIFEST.MF').should be_false + Zip::File.open(@project.package(@packaging).to_s) do |zip| + zip.exist?('META-INF/MANIFEST.MF').should be_false end end it 'should generate a new manifest for a file that does not have one' do - Zip::ZipOutputStream.open 'tmp.zip' do |zip| + Zip::OutputStream.open 'tmp.zip' do |zip| zip.put_next_entry 'empty.txt' end begin @@ -135,7 +135,7 @@ shared_examples_for 'package with manifest' do package_with_manifest 'Foo'=>1, :bar=>'Bar' package = project('foo').package(@packaging) package.invoke - Zip::ZipFile.open(package.to_s) { |zip| zip.file.read('META-INF/MANIFEST.MF').should =~ /#{Buildr::Packaging::Java::Manifest::LINE_SEPARATOR}$/ } + Zip::File.open(package.to_s) { |zip| zip.read('META-INF/MANIFEST.MF').should =~ /#{Buildr::Packaging::Java::Manifest::LINE_SEPARATOR}$/ } end it 'should break hash manifest lines longer than 72 characters using continuations' do @@ -160,7 +160,7 @@ shared_examples_for 'package with manifest' do package_with_manifest [ { :foo=>'first' }, { :bar=>'second' } ] package = project('foo').package(@packaging) package.invoke - Zip::ZipFile.open(package.to_s) { |zip| zip.file.read('META-INF/MANIFEST.MF')[-1].should == ?\n } + Zip::File.open(package.to_s) { |zip| zip.read('META-INF/MANIFEST.MF')[-1].should == ?\n } end it 'should break array manifest lines longer than 72 characters using continuations' do @@ -202,8 +202,8 @@ shared_examples_for 'package with manifest' do package_with_manifest [ {}, { 'Name'=>'first', :Foo=>'first', :bar=>'second' } ] package ||= project('foo').package(@packaging) package.invoke - Zip::ZipFile.open(package.to_s) do |zip| - permissions = format("%o", zip.file.stat('META-INF/MANIFEST.MF').mode) + Zip::File.open(package.to_s) do |zip| + permissions = format("%o", zip.find_entry('META-INF/MANIFEST.MF').unix_perms) expected_mode = Buildr::Util.win_os? ? /666$/ : /644$/ permissions.should match expected_mode end @@ -214,7 +214,7 @@ shared_examples_for 'package with manifest' do package_with_manifest 'MANIFEST.MF' package ||= project('foo').package(@packaging) package.invoke - Zip::ZipFile.open(package.to_s) do |zip| + Zip::File.open(package.to_s) do |zip| zip.read('META-INF/MANIFEST.MF').scan(/(Manifest-Version)/m).size.should == 1 end end @@ -251,7 +251,7 @@ shared_examples_for 'package with manifest' do packaging = @packaging package = define('foo', :version=>'1.0') { package(packaging) }.packages.first package.invoke - Zip::ZipFile.open(package.to_s) do |zip| + Zip::File.open(package.to_s) do |zip| zip.entries.map(&:to_s).should include('META-INF/') end end @@ -361,7 +361,7 @@ shared_examples_for 'package with meta_inf' do package = project('foo').package(@packaging) package.invoke assumed = Array(@meta_inf_ignore) - Zip::ZipFile.open(package.to_s) do |zip| + Zip::File.open(package.to_s) do |zip| entries = zip.entries.map(&:name).select { |f| File.dirname(f) == 'META-INF' }.map { |f| File.basename(f) } assumed.each { |f| entries.should include(f) } yield entries - assumed if block_given? @@ -435,7 +435,7 @@ describe Packaging, 'jar' do write 'src/main/java/Test.java', 'class Test {}' define('foo', :version=>'1.0') { package(:jar) } project('foo').package(:jar).invoke - Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar| + Zip::File.open(project('foo').package(:jar).to_s) do |jar| 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 @@ -446,7 +446,7 @@ describe Packaging, 'jar' do write 'src/main/java/Test.java', 'class Test {}' define('foo', :version=>'1.0') { package(:jar) } project('foo').package(:jar).invoke - Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar| + Zip::File.open(project('foo').package(:jar).to_s) do |jar| jar.entries.map(&:to_s).sort.should include('META-INF/MANIFEST.MF', 'Test.class') end end @@ -455,7 +455,7 @@ describe Packaging, 'jar' do write 'src/main/resources/test/important.properties' define('foo', :version=>'1.0') { package(:jar) } project('foo').package(:jar).invoke - Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar| + Zip::File.open(project('foo').package(:jar).to_s) do |jar| jar.entries.map(&:to_s).sort.should include('test/important.properties') end end @@ -464,7 +464,7 @@ describe Packaging, 'jar' do write 'src/main/java/code/Test.java', 'package code ; class Test {}' define('foo', :version=>'1.0') { package(:jar) } project('foo').package(:jar).invoke - Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar| + Zip::File.open(project('foo').package(:jar).to_s) do |jar| jar.entries.map(&:to_s).sort.should include('code/') end end @@ -473,7 +473,7 @@ describe Packaging, 'jar' do write 'src/main/resources/test/.config' define('foo', :version=>'1.0') { package(:jar) } project('foo').package(:jar).invoke - Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar| + Zip::File.open(project('foo').package(:jar).to_s) do |jar| jar.entries.map(&:to_s).sort.should include('test/.config') end end @@ -482,7 +482,7 @@ describe Packaging, 'jar' do mkpath 'src/main/resources/empty' define('foo', :version=>'1.0') { package(:jar) } project('foo').package(:jar).invoke - Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar| + Zip::File.open(project('foo').package(:jar).to_s) do |jar| jar.entries.map(&:to_s).sort.should include('empty/') end end @@ -497,7 +497,7 @@ describe Packaging, 'jar' do write 'src/main/resources/foo.xml', '' foo = define('foo', :version => '1.0') { package(:jar).exclude('foo.xml')} foo.package(:jar).invoke - Zip::ZipFile.open(foo.package(:jar).to_s) do |jar| + Zip::File.open(foo.package(:jar).to_s) do |jar| jar.entries.map(&:to_s).sort.should_not include('foo.xml') end end @@ -519,7 +519,7 @@ describe Packaging, 'war' do def inspect_war project('foo').package(:war).invoke - Zip::ZipFile.open(project('foo').package(:war).to_s) do |war| + Zip::File.open(project('foo').package(:war).to_s) do |war| yield war.entries.map(&:to_s).sort end end @@ -678,7 +678,7 @@ describe Packaging, 'aar' do def inspect_aar project('foo').package(:aar).invoke - Zip::ZipFile.open(project('foo').package(:aar).to_s) do |aar| + Zip::File.open(project('foo').package(:aar).to_s) do |aar| yield aar.entries.map(&:to_s).sort end end @@ -752,23 +752,23 @@ describe Packaging, 'ear' do def inspect_ear project('foo').package(:ear).invoke - Zip::ZipFile.open(project('foo').package(:ear).to_s) do |ear| + Zip::File.open(project('foo').package(:ear).to_s) do |ear| yield ear.entries.map(&:to_s).sort end end def inspect_application_xml project('foo').package(:ear).invoke - Zip::ZipFile.open(project('foo').package(:ear).to_s) do |ear| + Zip::File.open(project('foo').package(:ear).to_s) do |ear| yield REXML::Document.new(ear.read('META-INF/application.xml')).root end end def inspect_classpath(package) project('foo').package(:ear).invoke - Zip::ZipFile.open(project('foo').package(:ear).to_s) do |ear| + Zip::File.open(project('foo').package(:ear).to_s) do |ear| File.open('tmp.zip', 'wb') do |tmp| - tmp.write ear.file.read(package) + tmp.write ear.read(package) end manifest = Buildr::Packaging::Java::Manifest.from_zip('tmp.zip') yield manifest.main['Class-Path'].split(' ') http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/spec/packaging/archive_spec.rb ---------------------------------------------------------------------- diff --git a/spec/packaging/archive_spec.rb b/spec/packaging/archive_spec.rb index b911baf..d7121b5 100644 --- a/spec/packaging/archive_spec.rb +++ b/spec/packaging/archive_spec.rb @@ -524,7 +524,7 @@ describe "ZipTask" do def inspect_archive entries = {} - Zip::ZipFile.open @archive do |zip| + Zip::File.open @archive do |zip| zip.entries.each do |entry| if entry.directory? # Ignore the / directory created for empty ZIPs when using java.util.zip. http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/spec/packaging/packaging_spec.rb ---------------------------------------------------------------------- diff --git a/spec/packaging/packaging_spec.rb b/spec/packaging/packaging_spec.rb index 259d4b0..02b9e0d 100644 --- a/spec/packaging/packaging_spec.rb +++ b/spec/packaging/packaging_spec.rb @@ -680,7 +680,7 @@ describe Packaging, 'zip' do it 'should not include META-INF directory' do define('foo', :version=>'1.0') { package(:zip) } project('foo').package(:zip).invoke - Zip::ZipFile.open(project('foo').package(:zip).to_s) do |zip| + Zip::File.open(project('foo').package(:zip).to_s) do |zip| zip.entries.map(&:to_s).should_not include('META-INF/') end end http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/spec/scala/compiler_spec.rb ---------------------------------------------------------------------- diff --git a/spec/scala/compiler_spec.rb b/spec/scala/compiler_spec.rb index 5f2869f..3fc4556 100644 --- a/spec/scala/compiler_spec.rb +++ b/spec/scala/compiler_spec.rb @@ -76,8 +76,8 @@ share_as :ScalacCompiler do define_test1_project task('test1:package').invoke file('target/test1-1.0.jar').should exist - Zip::ZipFile.open(project('test1').package(:jar).to_s) do |zip| - zip.file.exist?('com/example/Test1.class').should be_true + Zip::File.open(project('test1').package(:jar).to_s) do |zip| + zip.exist?('com/example/Test1.class').should be_true end end @@ -89,9 +89,9 @@ share_as :ScalacCompiler do end task('test1:package').invoke file('target/test1-1.0.jar').should exist - Zip::ZipFile.open(project('test1').package(:jar).to_s) do |zip| - zip.file.exist?('com/example/Foo.class').should be_true - zip.file.exist?('com/example/Bar.class').should be_true + Zip::File.open(project('test1').package(:jar).to_s) do |zip| + zip.exist?('com/example/Foo.class').should be_true + zip.exist?('com/example/Bar.class').should be_true end end @@ -103,9 +103,9 @@ share_as :ScalacCompiler do end task('test1:package').invoke file('target/test1-1.0.jar').should exist - Zip::ZipFile.open(project('test1').package(:jar).to_s) do |zip| - zip.file.exist?('com/example/Foo.class').should be_true - zip.file.exist?('com/example/Bar.class').should be_true + Zip::File.open(project('test1').package(:jar).to_s) do |zip| + zip.exist?('com/example/Foo.class').should be_true + zip.exist?('com/example/Bar.class').should be_true end end end http://git-wip-us.apache.org/repos/asf/buildr/blob/4ab5169d/tests/integration_testing.rb ---------------------------------------------------------------------- diff --git a/tests/integration_testing.rb b/tests/integration_testing.rb index 7949bc0..4d1139f 100644 --- a/tests/integration_testing.rb +++ b/tests/integration_testing.rb @@ -57,7 +57,7 @@ module Buildr test "include_path", "package", <<-CHECK path = File.expand_path("#{TEST_DIR}/include_path/target/proj-1.0.zip") assert(File.exist?(path), "File exists?") -Zip::ZipFile.open(path) {|zip| +Zip::File.open(path) {|zip| assert(!zip.get_entry("distrib/doc/index.html").nil?) assert(!zip.get_entry("distrib/lib/slf4j-api-1.6.1.jar").nil?) } @@ -66,7 +66,7 @@ assert(!zip.get_entry("distrib/lib/slf4j-api-1.6.1.jar").nil?) test "include_as", "package", <<-CHECK path = File.expand_path("#{TEST_DIR}/include_as/target/proj-1.0.zip") assert(File.exist? path) -Zip::ZipFile.open(path) {|zip| +Zip::File.open(path) {|zip| assert(!zip.get_entry("docu/index.html").nil?) assert(!zip.get_entry("lib/logging.jar").nil?) }
