1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems: Update to RubyGems master ec8ed22. Notable changes

include:

  * Renamed extension_install_dir to extension_dir (backwards
    compatible).

  * Fixed creation of gem.deps.rb.lock file from
    TestGemRequestSet#test_install_from_gemdeps_install_dir

  * Fixed a typo and some documentation.

* test/rubygems:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-12-10 19:54:19 +00:00
parent d36a129d7b
commit d6a5fe709e
17 changed files with 77 additions and 69 deletions

View file

@ -1,3 +1,18 @@
Wed Dec 11 04:54:03 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems: Update to RubyGems master ec8ed22. Notable changes
include:
* Renamed extension_install_dir to extension_dir (backwards
compatible).
* Fixed creation of gem.deps.rb.lock file from
TestGemRequestSet#test_install_from_gemdeps_install_dir
* Fixed a typo and some documentation.
* test/rubygems: ditto.
Wed Dec 11 03:18:08 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca> Wed Dec 11 03:18:08 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
* insns.def: Fix optimization bug of Float#/ [Bug #9238] * insns.def: Fix optimization bug of Float#/ [Bug #9238]

View file

@ -12,7 +12,7 @@ class Gem::BasicSpecification
## ##
# Sets the directory where extensions for this gem will be installed. # Sets the directory where extensions for this gem will be installed.
attr_writer :extension_install_dir # :nodoc: attr_writer :extension_dir # :nodoc:
## ##
# The path this gemspec was loaded from. This attribute is not persisted. # The path this gemspec was loaded from. This attribute is not persisted.
@ -69,16 +69,10 @@ class Gem::BasicSpecification
end end
## ##
# The directory the named +extension+ was installed into after being built. # Returns full path to the directory where gem's extensions are installed.
#
# Usage:
#
# spec.extensions.each do |ext|
# puts spec.extension_install_dir ext
# end
def extension_install_dir def extension_dir
@extension_install_dir ||= @extension_dir ||=
File.join base_dir, 'extensions', Gem::Platform.local.to_s, File.join base_dir, 'extensions', Gem::Platform.local.to_s,
Gem.extension_api_version, full_name Gem.extension_api_version, full_name
end end
@ -123,7 +117,7 @@ class Gem::BasicSpecification
File.join full_gem_path, path File.join full_gem_path, path
end end
full_paths.unshift extension_install_dir unless @extensions.empty? full_paths.unshift extension_dir unless @extensions.empty?
full_paths full_paths
end end
@ -152,7 +146,7 @@ class Gem::BasicSpecification
def loaded_from= path def loaded_from= path
@loaded_from = path && path.to_s @loaded_from = path && path.to_s
@extension_install_dir = nil @extension_dir = nil
@full_gem_path = nil @full_gem_path = nil
@gems_dir = nil @gems_dir = nil
@base_dir = nil @base_dir = nil
@ -196,11 +190,11 @@ class Gem::BasicSpecification
def require_paths def require_paths
return @require_paths if @extensions.empty? return @require_paths if @extensions.empty?
relative_extension_install_dir = relative_extension_dir =
File.join '..', '..', 'extensions', Gem::Platform.local.to_s, File.join '..', '..', 'extensions', Gem::Platform.local.to_s,
Gem.extension_api_version, full_name Gem.extension_api_version, full_name
[relative_extension_install_dir].concat @require_paths [relative_extension_dir].concat @require_paths
end end
## ##

View file

@ -17,7 +17,7 @@ class Gem::Commands::OutdatedCommand < Gem::Command
def description # :nodoc: def description # :nodoc:
<<-EOF <<-EOF
The outdated command lists gems you way wish to upgrade to a newer version. The outdated command lists gems you may wish to upgrade to a newer version.
You can check for dependency mismatches using the dependency command and You can check for dependency mismatches using the dependency command and
update the gems with the update or install commands. update the gems with the update or install commands.

View file

@ -186,7 +186,7 @@ EOF
say "This could take a while..." say "This could take a while..."
end end
dest_path = @spec.extension_install_dir dest_path = @spec.extension_dir
FileUtils.rm_f @spec.gem_build_complete_path FileUtils.rm_f @spec.gem_build_complete_path
@ -205,9 +205,9 @@ EOF
# Writes +output+ to gem_make.out in the extension install directory. # Writes +output+ to gem_make.out in the extension install directory.
def write_gem_make_out output # :nodoc: def write_gem_make_out output # :nodoc:
destination = File.join @spec.extension_install_dir, 'gem_make.out' destination = File.join @spec.extension_dir, 'gem_make.out'
FileUtils.mkdir_p @spec.extension_install_dir FileUtils.mkdir_p @spec.extension_dir
open destination, 'wb' do |io| io.puts output end open destination, 'wb' do |io| io.puts output end

View file

@ -191,7 +191,7 @@ class Gem::Source::Git < Gem::Source
spec.loaded_from = loaded_from spec.loaded_from = loaded_from
spec.base_dir = base_dir spec.base_dir = base_dir
spec.extension_install_dir = spec.extension_dir =
File.join base_dir, 'extensions', Gem::Platform.local.to_s, File.join base_dir, 'extensions', Gem::Platform.local.to_s,
Gem.extension_api_version, "#{name}-#{dir_shortref}" Gem.extension_api_version, "#{name}-#{dir_shortref}"

View file

@ -1744,7 +1744,7 @@ class Gem::Specification < Gem::BasicSpecification
# directory. # directory.
def gem_build_complete_path # :nodoc: def gem_build_complete_path # :nodoc:
File.join extension_install_dir, 'gem.build_complete' File.join extension_dir, 'gem.build_complete'
end end
## ##

View file

@ -247,7 +247,7 @@ class Gem::Uninstaller
File.writable?(spec.base_dir) File.writable?(spec.base_dir)
FileUtils.rm_rf spec.full_gem_path FileUtils.rm_rf spec.full_gem_path
FileUtils.rm_rf spec.extension_install_dir FileUtils.rm_rf spec.extension_dir
old_platform_name = spec.original_name old_platform_name = spec.original_name
gemspec = spec.spec_file gemspec = spec.spec_file

View file

@ -338,7 +338,7 @@ class TestGem < Gem::TestCase
end end
end end
def test_self_extension_install_dir_shared def test_self_extension_dir_shared
enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
RbConfig::CONFIG['ENABLE_SHARED'], 'yes' RbConfig::CONFIG['ENABLE_SHARED'], 'yes'
@ -347,7 +347,7 @@ class TestGem < Gem::TestCase
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
end end
def test_self_extension_install_dir_static def test_self_extension_dir_static
enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
RbConfig::CONFIG['ENABLE_SHARED'], 'no' RbConfig::CONFIG['ENABLE_SHARED'], 'no'

View file

@ -407,7 +407,7 @@ class TestGemDependencyInstaller < Gem::TestCase
_, f1_gem = util_gem 'f', '1', 'e' => nil _, f1_gem = util_gem 'f', '1', 'e' => nil
Gem::Installer.new(e1_gem).install Gem::Installer.new(e1_gem).install
FileUtils.rm_r e1.extension_install_dir FileUtils.rm_r e1.extension_dir
FileUtils.mv e1_gem, @tempdir FileUtils.mv e1_gem, @tempdir
FileUtils.mv f1_gem, @tempdir FileUtils.mv f1_gem, @tempdir
@ -420,7 +420,7 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[f-1], inst.installed_gems.map { |s| s.full_name } assert_equal %w[f-1], inst.installed_gems.map { |s| s.full_name }
assert_path_exists e1.extension_install_dir assert_path_exists e1.extension_dir
end end
def test_install_dependency_old def test_install_dependency_old

View file

@ -124,10 +124,10 @@ install:
@builder.build_extensions @builder.build_extensions
end end
assert_path_exists @spec.extension_install_dir assert_path_exists @spec.extension_dir
assert_path_exists @spec.gem_build_complete_path assert_path_exists @spec.gem_build_complete_path
assert_path_exists File.join @spec.extension_install_dir, 'gem_make.out' assert_path_exists File.join @spec.extension_dir, 'gem_make.out'
assert_path_exists File.join @spec.extension_install_dir, 'a.rb' assert_path_exists File.join @spec.extension_dir, 'a.rb'
assert_path_exists File.join @spec.gem_dir, 'lib', 'a.rb' assert_path_exists File.join @spec.gem_dir, 'lib', 'a.rb'
assert_path_exists File.join @spec.gem_dir, 'lib', 'a', 'b.rb' assert_path_exists File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
end end
@ -140,11 +140,11 @@ install:
assert_equal '', @ui.output assert_equal '', @ui.output
assert_equal '', @ui.error assert_equal '', @ui.error
refute_path_exists File.join @spec.extension_install_dir, 'gem_make.out' refute_path_exists File.join @spec.extension_dir, 'gem_make.out'
end end
def test_build_extensions_rebuild_failure def test_build_extensions_rebuild_failure
FileUtils.mkdir_p @spec.extension_install_dir FileUtils.mkdir_p @spec.extension_dir
FileUtils.touch @spec.gem_build_complete_path FileUtils.touch @spec.gem_build_complete_path
@spec.extensions << nil @spec.extensions << nil
@ -175,7 +175,7 @@ install:
@ui.output @ui.output
assert_equal '', @ui.error assert_equal '', @ui.error
gem_make_out = File.join @spec.extension_install_dir, 'gem_make.out' gem_make_out = File.join @spec.extension_dir, 'gem_make.out'
assert_match %r%#{Regexp.escape Gem.ruby} extconf\.rb%, assert_match %r%#{Regexp.escape Gem.ruby} extconf\.rb%,
File.read(gem_make_out) File.read(gem_make_out)
@ -187,7 +187,7 @@ install:
def test_build_extensions_unsupported def test_build_extensions_unsupported
FileUtils.mkdir_p @spec.gem_dir FileUtils.mkdir_p @spec.gem_dir
gem_make_out = File.join @spec.extension_install_dir, 'gem_make.out' gem_make_out = File.join @spec.extension_dir, 'gem_make.out'
@spec.extensions << nil @spec.extensions << nil
e = assert_raises Gem::Ext::BuildError do e = assert_raises Gem::Ext::BuildError do
@ -239,7 +239,7 @@ install:
path = File.join @spec.gem_dir, "extconf_args" path = File.join @spec.gem_dir, "extconf_args"
assert_equal args.inspect, File.read(path).strip assert_equal args.inspect, File.read(path).strip
assert_path_exists @spec.extension_install_dir assert_path_exists @spec.extension_dir
end end
def test_initialize def test_initialize

View file

@ -937,7 +937,7 @@ gem 'other', version
assert_match %r|I am a shiny gem!|, @ui.output assert_match %r|I am a shiny gem!|, @ui.output
end end
def test_install_extension_install_dir def test_install_extension_dir
gemhome2 = "#{@gemhome}2" gemhome2 = "#{@gemhome}2"
@spec.extensions << "extconf.rb" @spec.extensions << "extconf.rb"

View file

@ -72,18 +72,17 @@ class TestGemRequestSet < Gem::TestCase
rs = Gem::RequestSet.new rs = Gem::RequestSet.new
installed = [] installed = []
Tempfile.open 'gem.deps.rb' do |io| open 'gem.deps.rb', 'w' do |io|
io.puts 'gem "a"' io.puts 'gem "a"'
io.flush end
options = { options = {
:gemdeps => io.path, :gemdeps => 'gem.deps.rb',
:install_dir => "#{@gemhome}2", :install_dir => "#{@gemhome}2",
} }
rs.install_from_gemdeps options do |req, installer| rs.install_from_gemdeps options do |req, installer|
installed << req.full_name installed << req.full_name
end
end end
assert_includes installed, 'a-2' assert_includes installed, 'a-2'

View file

@ -77,7 +77,7 @@ class TestGemResolverGitSpecification < Gem::TestCase
git_spec.install({}) git_spec.install({})
assert_path_exists File.join git_spec.spec.extension_install_dir, 'b.rb' assert_path_exists File.join git_spec.spec.extension_dir, 'b.rb'
end end
def test_install_installed def test_install_installed

View file

@ -194,12 +194,12 @@ class TestGemSourceGit < Gem::TestCase
assert_equal File.join(source.install_dir, 'a.gemspec'), a_spec.loaded_from assert_equal File.join(source.install_dir, 'a.gemspec'), a_spec.loaded_from
assert_equal base_dir, a_spec.base_dir assert_equal base_dir, a_spec.base_dir
extension_install_dir = extension_dir =
File.join Gem.dir, 'bundler', 'extensions', File.join Gem.dir, 'bundler', 'extensions',
Gem::Platform.local.to_s, Gem.extension_api_version, Gem::Platform.local.to_s, Gem.extension_api_version,
"a-#{source.dir_shortref}" "a-#{source.dir_shortref}"
assert_equal extension_install_dir, a_spec.extension_install_dir assert_equal extension_dir, a_spec.extension_dir
b_spec = specs.shift b_spec = specs.shift
@ -208,7 +208,7 @@ class TestGemSourceGit < Gem::TestCase
b_spec.loaded_from b_spec.loaded_from
assert_equal base_dir, b_spec.base_dir assert_equal base_dir, b_spec.base_dir
assert_equal extension_install_dir, b_spec.extension_install_dir assert_equal extension_dir, b_spec.extension_dir
end end
def test_uri_hash def test_uri_hash

View file

@ -1115,7 +1115,7 @@ dependencies: []
def test_build_extensions def test_build_extensions
ext_spec ext_spec
refute_path_exists @ext.extension_install_dir, 'sanity check' refute_path_exists @ext.extension_dir, 'sanity check'
refute_empty @ext.extensions, 'sanity check' refute_empty @ext.extensions, 'sanity check'
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
@ -1133,7 +1133,7 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
assert_path_exists @ext.extension_install_dir assert_path_exists @ext.extension_dir
end end
def test_build_extensions_built def test_build_extensions_built
@ -1142,14 +1142,14 @@ dependencies: []
refute_empty @ext.extensions, 'sanity check' refute_empty @ext.extensions, 'sanity check'
gem_build_complete = gem_build_complete =
File.join @ext.extension_install_dir, 'gem.build_complete' File.join @ext.extension_dir, 'gem.build_complete'
FileUtils.mkdir_p @ext.extension_install_dir FileUtils.mkdir_p @ext.extension_dir
FileUtils.touch gem_build_complete FileUtils.touch gem_build_complete
@ext.build_extensions @ext.build_extensions
gem_make_out = File.join @ext.extension_install_dir, 'gem_make.out' gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
refute_path_exists gem_make_out refute_path_exists gem_make_out
end end
@ -1171,7 +1171,7 @@ dependencies: []
spec.build_extensions spec.build_extensions
refute_path_exists spec.extension_install_dir refute_path_exists spec.extension_dir
end end
def test_build_extensions_error def test_build_extensions_error
@ -1243,19 +1243,19 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
gem_make_out = File.join @ext.extension_install_dir, 'gem_make.out' gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
refute_path_exists gem_make_out refute_path_exists gem_make_out
ensure ensure
FileUtils.chmod 0755, @gemhome FileUtils.chmod 0755, @gemhome
end end
def test_build_extensions_none def test_build_extensions_none
refute_path_exists @a1.extension_install_dir, 'sanity check' refute_path_exists @a1.extension_dir, 'sanity check'
assert_empty @a1.extensions, 'sanity check' assert_empty @a1.extensions, 'sanity check'
@a1.build_extensions @a1.build_extensions
refute_path_exists @a1.extension_install_dir refute_path_exists @a1.extension_dir
end end
def test_build_extensions_old def test_build_extensions_old
@ -1267,7 +1267,7 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
gem_make_out = File.join @ext.extension_install_dir, 'gem_make.out' gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
refute_path_exists gem_make_out refute_path_exists gem_make_out
end end
@ -1293,7 +1293,7 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
gem_make_out = File.join @ext.extension_install_dir, 'gem_make.out' gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
assert_path_exists gem_make_out assert_path_exists gem_make_out
end end
@ -1323,7 +1323,7 @@ dependencies: []
refute @ext.contains_requirable_file? 'nonexistent' refute @ext.contains_requirable_file? 'nonexistent'
assert_path_exists @ext.extension_install_dir assert_path_exists @ext.extension_dir
end end
def test_date def test_date
@ -1444,7 +1444,7 @@ dependencies: []
assert_equal ['ext/extconf.rb'], ext_spec.extensions assert_equal ['ext/extconf.rb'], ext_spec.extensions
end end
def test_extension_install_dir def test_extension_dir
enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
RbConfig::CONFIG['ENABLE_SHARED'], 'no' RbConfig::CONFIG['ENABLE_SHARED'], 'no'
@ -1456,7 +1456,7 @@ dependencies: []
File.join(@ext.base_dir, 'extensions', Gem::Platform.local.to_s, File.join(@ext.base_dir, 'extensions', Gem::Platform.local.to_s,
"#{Gem.ruby_api_version}-static", @ext.full_name) "#{Gem.ruby_api_version}-static", @ext.full_name)
assert_equal expected, @ext.extension_install_dir assert_equal expected, @ext.extension_dir
ensure ensure
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
end end
@ -1610,7 +1610,7 @@ dependencies: []
end end
def test_gem_build_complete_path def test_gem_build_complete_path
expected = File.join @a1.extension_install_dir, 'gem.build_complete' expected = File.join @a1.extension_dir, 'gem.build_complete'
assert_equal expected, @a1.gem_build_complete_path assert_equal expected, @a1.gem_build_complete_path
end end
@ -1743,7 +1743,7 @@ dependencies: []
@ext.require_path = 'lib' @ext.require_path = 'lib'
ext_install_dir = Pathname(@ext.extension_install_dir) ext_install_dir = Pathname(@ext.extension_dir)
full_gem_path = Pathname(@ext.full_gem_path) full_gem_path = Pathname(@ext.full_gem_path)
relative_install_dir = ext_install_dir.relative_path_from full_gem_path relative_install_dir = ext_install_dir.relative_path_from full_gem_path
@ -1762,7 +1762,7 @@ dependencies: []
@ext.require_path = 'lib' @ext.require_path = 'lib'
expected = [ expected = [
@ext.extension_install_dir, @ext.extension_dir,
File.join(@gemhome, 'gems', @ext.original_name, 'lib'), File.join(@gemhome, 'gems', @ext.original_name, 'lib'),
] ]

View file

@ -23,7 +23,7 @@ class TestStubSpecification < Gem::TestCase
def test_initialize_extension def test_initialize_extension
stub = stub_with_extension stub = stub_with_extension
ext_install_dir = Pathname(stub.extension_install_dir) ext_install_dir = Pathname(stub.extension_dir)
full_gem_path = Pathname(stub.full_gem_path) full_gem_path = Pathname(stub.full_gem_path)
relative_install_dir = ext_install_dir.relative_path_from full_gem_path relative_install_dir = ext_install_dir.relative_path_from full_gem_path
relative_install_dir = relative_install_dir.to_s relative_install_dir = relative_install_dir.to_s
@ -70,7 +70,7 @@ class TestStubSpecification < Gem::TestCase
refute stub.contains_requirable_file? 'nonexistent' refute stub.contains_requirable_file? 'nonexistent'
assert_path_exists stub.extension_install_dir assert_path_exists stub.extension_dir
end end
end end
@ -78,7 +78,7 @@ class TestStubSpecification < Gem::TestCase
stub = stub_with_extension stub = stub_with_extension
expected = [ expected = [
stub.extension_install_dir, stub.extension_dir,
File.join(stub.full_gem_path, 'lib'), File.join(stub.full_gem_path, 'lib'),
] ]

View file

@ -223,12 +223,12 @@ create_makefile '#{@spec.name}'
installer.install installer.install
end end
assert_path_exists @spec.extension_install_dir, 'sanity check' assert_path_exists @spec.extension_dir, 'sanity check'
uninstaller = Gem::Uninstaller.new @spec.name, :executables => true uninstaller = Gem::Uninstaller.new @spec.name, :executables => true
uninstaller.uninstall uninstaller.uninstall
refute_path_exists @spec.extension_install_dir refute_path_exists @spec.extension_dir
end end
def test_uninstall_nonexistent def test_uninstall_nonexistent