mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge RubyGems 3.0.1 from rubygems/rubygems.
It fixed the issues of RubyGems 3.0.0. https://blog.rubygems.org/2018/12/23/3.0.1-released.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9b9fe826fd
commit
ae19a18996
8 changed files with 34 additions and 17 deletions
|
@ -9,7 +9,7 @@
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = "3.0.0".freeze
|
VERSION = "3.0.1".freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must be first since it unloads the prelude from 1.9.2
|
# Must be first since it unloads the prelude from 1.9.2
|
||||||
|
@ -572,7 +572,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
||||||
#++
|
#++
|
||||||
|
|
||||||
def self.find_home
|
def self.find_home
|
||||||
Dir.home
|
Dir.home.dup
|
||||||
rescue
|
rescue
|
||||||
if Gem.win_platform?
|
if Gem.win_platform?
|
||||||
File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
|
File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
|
||||||
|
|
|
@ -312,7 +312,7 @@ By default, this RubyGems will install gem as:
|
||||||
dest_file = File.join dest_dir, file
|
dest_file = File.join dest_dir, file
|
||||||
dest_dir = File.dirname dest_file
|
dest_dir = File.dirname dest_file
|
||||||
unless File.directory? dest_dir
|
unless File.directory? dest_dir
|
||||||
mkdir_p dest_dir, :mode => 0700
|
mkdir_p dest_dir, :mode => 0755
|
||||||
end
|
end
|
||||||
|
|
||||||
install file, dest_file, :mode => options[:data_mode] || 0644
|
install file, dest_file, :mode => options[:data_mode] || 0644
|
||||||
|
@ -387,7 +387,7 @@ By default, this RubyGems will install gem as:
|
||||||
|
|
||||||
specs_dir = Gem::Specification.default_specifications_dir
|
specs_dir = Gem::Specification.default_specifications_dir
|
||||||
specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
|
specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
|
||||||
mkdir_p specs_dir, :mode => 0700
|
mkdir_p specs_dir, :mode => 0755
|
||||||
|
|
||||||
# Workaround for non-git environment.
|
# Workaround for non-git environment.
|
||||||
gemspec = File.open('bundler/bundler.gemspec', 'rb'){|f| f.read.gsub(/`git ls-files -z`/, "''") }
|
gemspec = File.open('bundler/bundler.gemspec', 'rb'){|f| f.read.gsub(/`git ls-files -z`/, "''") }
|
||||||
|
@ -422,7 +422,7 @@ By default, this RubyGems will install gem as:
|
||||||
|
|
||||||
bundler_bin_dir = bundler_spec.bin_dir
|
bundler_bin_dir = bundler_spec.bin_dir
|
||||||
bundler_bin_dir = File.join(options[:destdir], bundler_bin_dir) unless Gem.win_platform?
|
bundler_bin_dir = File.join(options[:destdir], bundler_bin_dir) unless Gem.win_platform?
|
||||||
mkdir_p bundler_bin_dir, :mode => 0700
|
mkdir_p bundler_bin_dir, :mode => 0755
|
||||||
bundler_spec.executables.each do |e|
|
bundler_spec.executables.each do |e|
|
||||||
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
|
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
|
||||||
end
|
end
|
||||||
|
@ -446,8 +446,8 @@ By default, this RubyGems will install gem as:
|
||||||
lib_dir, bin_dir = generate_default_dirs(install_destdir)
|
lib_dir, bin_dir = generate_default_dirs(install_destdir)
|
||||||
end
|
end
|
||||||
|
|
||||||
mkdir_p lib_dir, :mode => 0700
|
mkdir_p lib_dir, :mode => 0755
|
||||||
mkdir_p bin_dir, :mode => 0700
|
mkdir_p bin_dir, :mode => 0755
|
||||||
|
|
||||||
return lib_dir, bin_dir
|
return lib_dir, bin_dir
|
||||||
end
|
end
|
||||||
|
|
|
@ -309,7 +309,7 @@ class Gem::Installer
|
||||||
FileUtils.rm_rf spec.extension_dir
|
FileUtils.rm_rf spec.extension_dir
|
||||||
|
|
||||||
dir_mode = options[:dir_mode]
|
dir_mode = options[:dir_mode]
|
||||||
FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0700
|
FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0755
|
||||||
|
|
||||||
if @options[:install_as_default]
|
if @options[:install_as_default]
|
||||||
extract_bin
|
extract_bin
|
||||||
|
@ -481,7 +481,7 @@ class Gem::Installer
|
||||||
return if spec.executables.nil? or spec.executables.empty?
|
return if spec.executables.nil? or spec.executables.empty?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Dir.mkdir @bin_dir, *[options[:dir_mode] && 0700].compact
|
Dir.mkdir @bin_dir, *[options[:dir_mode] && 0755].compact
|
||||||
rescue SystemCallError
|
rescue SystemCallError
|
||||||
raise unless File.directory? @bin_dir
|
raise unless File.directory? @bin_dir
|
||||||
end
|
end
|
||||||
|
@ -525,7 +525,7 @@ class Gem::Installer
|
||||||
|
|
||||||
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
|
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
|
||||||
|
|
||||||
File.open bin_script_path, 'wb', 0700 do |file|
|
File.open bin_script_path, 'wb', 0755 do |file|
|
||||||
file.print app_script_text(filename)
|
file.print app_script_text(filename)
|
||||||
file.chmod(options[:prog_mode] || 0755)
|
file.chmod(options[:prog_mode] || 0755)
|
||||||
end
|
end
|
||||||
|
@ -720,7 +720,7 @@ class Gem::Installer
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_gem_home(unpack = false) # :nodoc:
|
def verify_gem_home(unpack = false) # :nodoc:
|
||||||
FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0700
|
FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0755
|
||||||
raise Gem::FilePermissionError, gem_home unless
|
raise Gem::FilePermissionError, gem_home unless
|
||||||
unpack or File.writable?(gem_home)
|
unpack or File.writable?(gem_home)
|
||||||
end
|
end
|
||||||
|
@ -905,7 +905,7 @@ TEXT
|
||||||
build_info_dir = File.join gem_home, 'build_info'
|
build_info_dir = File.join gem_home, 'build_info'
|
||||||
|
|
||||||
dir_mode = options[:dir_mode]
|
dir_mode = options[:dir_mode]
|
||||||
FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0700
|
FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0755
|
||||||
|
|
||||||
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
|
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ EOM
|
||||||
def extract_files(destination_dir, pattern = "*")
|
def extract_files(destination_dir, pattern = "*")
|
||||||
verify unless @spec
|
verify unless @spec
|
||||||
|
|
||||||
FileUtils.mkdir_p destination_dir, :mode => dir_mode && 0700
|
FileUtils.mkdir_p destination_dir, :mode => dir_mode && 0755
|
||||||
|
|
||||||
@gem.with_read_io do |io|
|
@gem.with_read_io do |io|
|
||||||
reader = Gem::Package::TarReader.new io
|
reader = Gem::Package::TarReader.new io
|
||||||
|
@ -394,7 +394,7 @@ EOM
|
||||||
FileUtils.rm_rf destination
|
FileUtils.rm_rf destination
|
||||||
|
|
||||||
mkdir_options = {}
|
mkdir_options = {}
|
||||||
mkdir_options[:mode] = dir_mode ? 0700 : (entry.header.mode if entry.directory?)
|
mkdir_options[:mode] = dir_mode ? 0755 : (entry.header.mode if entry.directory?)
|
||||||
mkdir =
|
mkdir =
|
||||||
if entry.directory?
|
if entry.directory?
|
||||||
destination
|
destination
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package
|
||||||
|
|
||||||
FileUtils.rm_rf destination
|
FileUtils.rm_rf destination
|
||||||
|
|
||||||
FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0700
|
FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0755
|
||||||
|
|
||||||
File.open destination, 'wb', file_mode(entry['mode']) do |out|
|
File.open destination, 'wb', file_mode(entry['mode']) do |out|
|
||||||
out.write file_data
|
out.write file_data
|
||||||
|
|
|
@ -122,7 +122,7 @@ module Gem::Util
|
||||||
|
|
||||||
def self.glob_files_in_dir(glob, base_path)
|
def self.glob_files_in_dir(glob, base_path)
|
||||||
if RUBY_VERSION >= "2.5"
|
if RUBY_VERSION >= "2.5"
|
||||||
Dir.glob(glob, base: base_path).map! {|f| File.join(base_path, f) }
|
Dir.glob(glob, base: base_path).map! {|f| File.expand_path(f, base_path) }
|
||||||
else
|
else
|
||||||
Dir.glob(File.expand_path(glob, base_path))
|
Dir.glob(File.expand_path(glob, base_path))
|
||||||
end
|
end
|
||||||
|
|
|
@ -198,7 +198,7 @@ class TestGem < Gem::TestCase
|
||||||
end
|
end
|
||||||
assert_equal(expected, result)
|
assert_equal(expected, result)
|
||||||
ensure
|
ensure
|
||||||
File.chmod(0700, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
|
File.chmod(0755, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_require_missing
|
def test_require_missing
|
||||||
|
|
|
@ -58,4 +58,21 @@ class TestGemUtil < Gem::TestCase
|
||||||
assert_equal 4, list.find { |x| x == 4 }
|
assert_equal 4, list.find { |x| x == 4 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_glob_files_in_dir
|
||||||
|
FileUtils.mkdir_p 'g'
|
||||||
|
FileUtils.touch File.join('g', 'h.rb')
|
||||||
|
FileUtils.touch File.join('g', 'i.rb')
|
||||||
|
|
||||||
|
expected_paths = [
|
||||||
|
File.join(@tempdir, 'g/h.rb'),
|
||||||
|
File.join(@tempdir, 'g/i.rb'),
|
||||||
|
]
|
||||||
|
|
||||||
|
files_with_absolute_base = Gem::Util.glob_files_in_dir('*.rb', File.join(@tempdir, 'g'))
|
||||||
|
assert_equal expected_paths.to_set, files_with_absolute_base.to_set
|
||||||
|
|
||||||
|
files_with_relative_base = Gem::Util.glob_files_in_dir('*.rb', 'g')
|
||||||
|
assert_equal expected_paths.to_set, files_with_relative_base.to_set
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue