Skip to content
Merged
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
17 changes: 17 additions & 0 deletions lib/rubygems/ext/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil, targets = [
end
end

def self.ruby
require "shellwords"
# Gem.ruby is quoted if it contains whitespace
cmd = Gem.ruby.shellsplit

# This load_path is only needed when running rubygems test without a proper installation.
# Prepending it in a normal installation will cause problem with order of $LOAD_PATH.
# Therefore only add load_path if it is not present in the default $LOAD_PATH.
load_path = File.expand_path("../..", __dir__)
case load_path
when RbConfig::CONFIG["sitelibdir"], RbConfig::CONFIG["vendorlibdir"], RbConfig::CONFIG["rubylibdir"]
cmd
else
cmd << "-I#{load_path}"
end
end

def self.run(command, results, command_name = nil, dir = Dir.pwd, env = {})
verbose = Gem.configuration.really_verbose

Expand Down
3 changes: 1 addition & 2 deletions lib/rubygems/ext/ext_conf_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_di
destdir = ENV["DESTDIR"]

begin
require "shellwords"
cmd = Gem.ruby.shellsplit << "-I" << File.expand_path("../..", __dir__) << File.basename(extension)
cmd = ruby << File.basename(extension)
cmd.push(*args)

run(cmd, results, class_name, extension_dir) do |s, r|
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/ext/rake_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_di
rake = rake.shellsplit
else
begin
rake = [Gem.ruby, "-I#{File.expand_path("../..", __dir__)}", "-rrubygems", Gem.bin_path("rake", "rake")]
rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
rescue Gem::Exception
rake = [Gem.default_exec_format % "rake"]
end
Expand Down