From 55b7beca28d214b88fe424da5620addf4f593769 Mon Sep 17 00:00:00 2001 From: Tim Connor Date: Wed, 26 Jun 2013 16:02:27 +1200 Subject: [PATCH] Updates for ruby 2.0.0 / rubygems 2.0.2 --- bin/gem-compile | 23 ++++------------------- lib/rubygems/compiler.rb | 23 ++++------------------- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/bin/gem-compile b/bin/gem-compile index 86074c8..dcd35a0 100755 --- a/bin/gem-compile +++ b/bin/gem-compile @@ -53,9 +53,8 @@ if args.length != 1 end -require 'rubygems/format' +require 'rubygems/package' require 'rubygems/ext' -require 'rubygems/builder' require 'shellwords' Gem::Command.build_args = build_args if build_args @@ -69,7 +68,7 @@ gem_dir = "#{File.basename(gem)}.build" gem_dir = File.expand_path(gem_dir) begin - format = Gem::Format.from_file_by_path(gem) + format = Gem::Package.new(gem) rescue => ex puts ex exit 1 @@ -102,21 +101,7 @@ end dest_path = File.join(gem_dir, spec.require_paths.first) FileUtils.rm_rf(dest_path) if File.exists?(dest_path) -format.file_entries.each do |entry, file_data| - path = entry['path'].untaint - path = File.expand_path File.join(gem_dir, path) - - FileUtils.rm_rf(path) if File.exists?(path) - FileUtils.mkdir_p File.dirname(path) - - File.open(path, "wb") do |out| - out.write file_data - end - - FileUtils.chmod entry['mode'], path - - puts path -end +format.extract_files gem_dir ran_rake = false start_dir = Dir.pwd @@ -210,7 +195,7 @@ spec.files = (spec.files + built_files).sort.uniq spec.platform = platform if platform Dir.chdir gem_dir -out_fname = Gem::Builder.new(spec).build +out_fname = Gem::Package.build(spec) FileUtils.mv(out_fname, start_dir) diff --git a/lib/rubygems/compiler.rb b/lib/rubygems/compiler.rb index cec97cd..a4c5799 100644 --- a/lib/rubygems/compiler.rb +++ b/lib/rubygems/compiler.rb @@ -1,6 +1,5 @@ -require 'rubygems/format' +require 'rubygems/package' require 'rubygems/ext' -require 'rubygems/builder' require 'rubygems/exceptions' require 'rubygems/user_interaction' require 'fileutils' @@ -14,7 +13,7 @@ def self.compile(gem, platform = Gem::Platform::CURRENT, fat_commands = {}) gem_dir = "#{File.basename(gem)}.build" gem_dir = File.expand_path(gem_dir) - format = Gem::Format.from_file_by_path(gem) + format = Gem::Package.new(gem) spec = format.spec @@ -29,21 +28,7 @@ def self.compile(gem, platform = Gem::Platform::CURRENT, fat_commands = {}) dest_path = File.join(gem_dir, spec.require_paths.first) FileUtils.rm_rf(dest_path) if File.exists?(dest_path) - format.file_entries.each do |entry, file_data| - path = entry['path'].untaint - path = File.expand_path File.join(gem_dir, path) - - FileUtils.rm_rf(path) if File.exists?(path) - FileUtils.mkdir_p File.dirname(path) - - File.open(path, "wb") do |out| - out.write file_data - end - - FileUtils.chmod entry['mode'], path - - say path if Gem.configuration.really_verbose - end + format.extract_files gem_dir ran_rake = false start_dir = Dir.pwd @@ -140,7 +125,7 @@ def self.compile(gem, platform = Gem::Platform::CURRENT, fat_commands = {}) Dir.chdir gem_dir begin - out_fname = Gem::Builder.new(spec).build + out_fname = Gem::Package.build(spec) FileUtils.mv(out_fname, start_dir) ensure Dir.chdir start_dir