1
0
Fork 0
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:
hsbt 2018-12-23 00:20:49 +00:00
parent 9b9fe826fd
commit ae19a18996
8 changed files with 34 additions and 17 deletions

View file

@ -9,7 +9,7 @@
require 'rbconfig'
module Gem
VERSION = "3.0.0".freeze
VERSION = "3.0.1".freeze
end
# 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
Dir.home
Dir.home.dup
rescue
if Gem.win_platform?
File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')

View file

@ -312,7 +312,7 @@ By default, this RubyGems will install gem as:
dest_file = File.join dest_dir, file
dest_dir = File.dirname dest_file
unless File.directory? dest_dir
mkdir_p dest_dir, :mode => 0700
mkdir_p dest_dir, :mode => 0755
end
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 = 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.
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 = 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|
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
end
@ -446,8 +446,8 @@ By default, this RubyGems will install gem as:
lib_dir, bin_dir = generate_default_dirs(install_destdir)
end
mkdir_p lib_dir, :mode => 0700
mkdir_p bin_dir, :mode => 0700
mkdir_p lib_dir, :mode => 0755
mkdir_p bin_dir, :mode => 0755
return lib_dir, bin_dir
end

View file

@ -309,7 +309,7 @@ class Gem::Installer
FileUtils.rm_rf spec.extension_dir
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]
extract_bin
@ -481,7 +481,7 @@ class Gem::Installer
return if spec.executables.nil? or spec.executables.empty?
begin
Dir.mkdir @bin_dir, *[options[:dir_mode] && 0700].compact
Dir.mkdir @bin_dir, *[options[:dir_mode] && 0755].compact
rescue SystemCallError
raise unless File.directory? @bin_dir
end
@ -525,7 +525,7 @@ class Gem::Installer
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.chmod(options[:prog_mode] || 0755)
end
@ -720,7 +720,7 @@ class Gem::Installer
end
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
unpack or File.writable?(gem_home)
end
@ -905,7 +905,7 @@ TEXT
build_info_dir = File.join gem_home, 'build_info'
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"

View file

@ -357,7 +357,7 @@ EOM
def extract_files(destination_dir, pattern = "*")
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|
reader = Gem::Package::TarReader.new io
@ -394,7 +394,7 @@ EOM
FileUtils.rm_rf destination
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 =
if entry.directory?
destination

View file

@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package
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|
out.write file_data

View file

@ -122,7 +122,7 @@ module Gem::Util
def self.glob_files_in_dir(glob, base_path)
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
Dir.glob(File.expand_path(glob, base_path))
end

View file

@ -198,7 +198,7 @@ class TestGem < Gem::TestCase
end
assert_equal(expected, result)
ensure
File.chmod(0700, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
File.chmod(0755, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
end
def test_require_missing

View file

@ -58,4 +58,21 @@ class TestGemUtil < Gem::TestCase
assert_equal 4, list.find { |x| x == 4 }
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