Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to work with ruby 2.0.0 / rubygems 2.0.2 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions bin/gem-compile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

23 changes: 4 additions & 19 deletions lib/rubygems/compiler.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down