Skip to content

Commit

Permalink
Merge RubyGems 2.7.7
Browse files Browse the repository at this point in the history
  see release details here: https://blog.rubygems.org/2018/05/18/2.7.7-released.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
hsbt committed May 18, 2018
1 parent ecedeba commit c6da9ca
Show file tree
Hide file tree
Showing 29 changed files with 161 additions and 60 deletions.
24 changes: 21 additions & 3 deletions lib/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require 'thread'

module Gem
VERSION = "2.7.6"
VERSION = "2.7.7"
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down Expand Up @@ -604,7 +604,7 @@ def self.find_home

private_class_method :find_home

# FIXME deprecate these in 3.0
# TODO: remove in RubyGems 4.0

##
# Zlib::GzipReader wrapper that unzips +data+.
Expand All @@ -613,20 +613,35 @@ def self.gunzip(data)
Gem::Util.gunzip data
end

class << self
extend Gem::Deprecate
deprecate :gunzip, "Gem::Util.gunzip", 2018, 12
end

##
# Zlib::GzipWriter wrapper that zips +data+.

def self.gzip(data)
Gem::Util.gzip data
end

class << self
extend Gem::Deprecate
deprecate :gzip, "Gem::Util.gzip", 2018, 12
end

##
# A Zlib::Inflate#inflate wrapper

def self.inflate(data)
Gem::Util.inflate data
end

class << self
extend Gem::Deprecate
deprecate :inflate, "Gem::Util.inflate", 2018, 12
end

##
# Top level install helper method. Allows you to install gems interactively:
#
Expand Down Expand Up @@ -1225,9 +1240,12 @@ def self.use_gemdeps path = nil

class << self
##
# TODO remove with RubyGems 3.0
# TODO remove with RubyGems 4.0

alias detect_gemdeps use_gemdeps # :nodoc:

extend Gem::Deprecate
deprecate :detect_gemdeps, "Gem.use_gemdeps", 2018, 12
end

# FIX: Almost everywhere else we use the `def self.` way of defining class
Expand Down
6 changes: 5 additions & 1 deletion lib/rubygems/bundler_version_finder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# frozen_string_literal: true

require "rubygems/util"

module Gem::BundlerVersionFinder
@without_filtering = false

Expand Down Expand Up @@ -102,7 +106,7 @@ def self.lockfile_contents
lockfile = case gemfile
when "gems.rb" then "gems.locked"
else "#{gemfile}.lock"
end.untaint
end.dup.untaint

return unless File.file?(lockfile)

Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/commands/push_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def description # :nodoc:
The push command uploads a gem to the push server (the default is
https://rubygems.org) and adds it to the index.
The gem can be removed from the index (but only the index) using the yank
The gem can be removed from the index and deleted from the server using the yank
command. For further discussion see the help for the yank command.
EOF
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/commands/setup_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def install_default_bundler_gem
each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
end

bundler_bin_dir = File.join(Gem.default_dir, 'gems', bundler_spec.full_name, bundler_spec.bindir)
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
bundler_spec.executables.each do |e|
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/commands/unpack_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def get_metadata path, security_policy = nil
when 'metadata' then
metadata = entry.read
when 'metadata.gz' then
metadata = Gem.gunzip entry.read
metadata = Gem::Util.gunzip entry.read
end
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
##
# The Dependency class holds a Gem name and a Gem::Requirement.

require "rubygems/bundler_version_finder"
require "rubygems/requirement"

class Gem::Dependency
Expand Down
6 changes: 4 additions & 2 deletions lib/rubygems/dependency_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def initialize options = {}

##
#--
# TODO remove, no longer used
# TODO remove at RubyGems 4, no longer used

def add_found_dependencies to_do, dependency_list # :nodoc:
seen = {}
Expand Down Expand Up @@ -163,6 +163,7 @@ def add_found_dependencies to_do, dependency_list # :nodoc:

dependency_list.remove_specs_unsatisfied_by dependencies
end
deprecate :add_found_dependencies, :none, 2018, 12

##
# Creates an AvailableSet to install from based on +dep_or_name+ and
Expand Down Expand Up @@ -321,7 +322,7 @@ def find_spec_by_name_and_version gem_name,
# Gathers all dependencies necessary for the installation from local and
# remote sources unless the ignore_dependencies was given.
#--
# TODO remove at RubyGems 3
# TODO remove at RubyGems 4

def gather_dependencies # :nodoc:
specs = @available.all_specs
Expand Down Expand Up @@ -354,6 +355,7 @@ def gather_dependencies # :nodoc:

@gems_to_install = dependency_list.dependency_order.reverse
end
deprecate :gather_dependencies, :none, 2018, 12

def in_background what # :nodoc:
fork_happened = false
Expand Down
6 changes: 5 additions & 1 deletion lib/rubygems/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
# Each exception needs a brief description and the scenarios where it is
# likely to be raised

require 'rubygems/deprecate'

##
# Base exception class for RubyGems. All exception raised by RubyGems are a
# subclass of this one.
class Gem::Exception < RuntimeError

##
#--
# TODO: remove in RubyGems 3, nobody sets this
# TODO: remove in RubyGems 4, nobody sets this

attr_accessor :source_exception # :nodoc:

extend Gem::Deprecate
deprecate :source_exception, :none, 2018, 12
end

class Gem::CommandLineError < Gem::Exception; end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def paranoid(path, extension)
data = Gem.read_binary path
compressed_data = Gem.read_binary "#{path}.#{extension}"

unless data == Gem.inflate(compressed_data) then
unless data == Gem::Util.inflate(compressed_data) then
raise "Compressed file #{compressed_path} does not match uncompressed file #{path}"
end
end
Expand Down
6 changes: 5 additions & 1 deletion lib/rubygems/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

require 'rubygems/command'
require 'rubygems/exceptions'
require 'rubygems/deprecate'
require 'rubygems/package'
require 'rubygems/ext'
require 'rubygems/user_interaction'
Expand All @@ -27,6 +28,8 @@

class Gem::Installer

extend Gem::Deprecate

##
# Paths where env(1) might live. Some systems are broken and have it in
# /bin
Expand Down Expand Up @@ -777,13 +780,14 @@ def build_extensions
##
# Logs the build +output+ in +build_dir+, then raises Gem::Ext::BuildError.
#
# TODO: Delete this for RubyGems 3. It remains for API compatibility
# TODO: Delete this for RubyGems 4. It remains for API compatibility

def extension_build_error(build_dir, output, backtrace = nil) # :nodoc:
builder = Gem::Ext::Builder.new spec, @build_args

builder.build_error build_dir, output, backtrace
end
deprecate :extension_build_error, :none, 2018, 12

##
# Reads the file index and extracts each file into the gem directory.
Expand Down
12 changes: 10 additions & 2 deletions lib/rubygems/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,14 @@ def install_location filename, destination_dir # :nodoc:
destination
end

def normalize_path(pathname)
if Gem.win_platform?
pathname.downcase
else
pathname
end
end

def mkdir_p_safe mkdir, mkdir_options, destination_dir, file_name
destination_dir = realpath File.expand_path(destination_dir)
parts = mkdir.split(File::SEPARATOR)
Expand All @@ -437,7 +445,7 @@ def mkdir_p_safe mkdir, mkdir_options, destination_dir, file_name
path = File.expand_path(path + File::SEPARATOR + basename)
lstat = File.lstat path rescue nil
if !lstat || !lstat.directory?
unless path.start_with? destination_dir and (FileUtils.mkdir path, mkdir_options rescue false)
unless normalize_path(path).start_with? normalize_path(destination_dir) and (FileUtils.mkdir path, mkdir_options rescue false)
raise Gem::Package::PathError.new(file_name, destination_dir)
end
end
Expand Down Expand Up @@ -591,7 +599,7 @@ def verify_entry entry
end

case file_name
when /^metadata(.gz)?$/ then
when "metadata", "metadata.gz" then
load_spec entry
when 'data.tar.gz' then
verify_gz entry
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/remote_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def fetch_path(uri, mtime = nil, head = false)

if data and !head and uri.to_s =~ /\.gz$/
begin
data = Gem.gunzip data
data = Gem::Util.gunzip data
rescue Zlib::GzipFile::Error
raise FetchError.new("server did not return a valid file", uri.to_s)
end
Expand Down
4 changes: 3 additions & 1 deletion lib/rubygems/request_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def install options, &block # :yields: request, installer
rescue Gem::RuntimeRequirementNotMetError => e
recent_match = req.spec.set.find_all(req.request).sort_by(&:version).reverse_each.find do |s|
s = s.spec
s.required_ruby_version.satisfied_by?(Gem.ruby_version) && s.required_rubygems_version.satisfied_by?(Gem.rubygems_version)
s.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
s.required_rubygems_version.satisfied_by?(Gem.rubygems_version) &&
Gem::Platform.installable?(s)
end
if recent_match
suggestion = "The last version of #{req.request} to support your Ruby & RubyGems was #{recent_match.version}. Try installing it with `gem install #{recent_match.name} -v #{recent_match.version}`"
Expand Down
6 changes: 3 additions & 3 deletions lib/rubygems/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def latest_specs(req, res)
specs = Marshal.dump specs

if req.path =~ /\.gz$/ then
specs = Gem.gzip specs
specs = Gem::Util.gzip specs
res['content-type'] = 'application/x-gzip'
else
res['content-type'] = 'application/octet-stream'
Expand Down Expand Up @@ -553,7 +553,7 @@ def prerelease_specs req, res
specs = Marshal.dump specs

if req.path =~ /\.gz$/ then
specs = Gem.gzip specs
specs = Gem::Util.gzip specs
res['content-type'] = 'application/x-gzip'
else
res['content-type'] = 'application/octet-stream'
Expand Down Expand Up @@ -852,7 +852,7 @@ def specs(req, res)
specs = Marshal.dump specs

if req.path =~ /\.gz$/ then
specs = Gem.gzip specs
specs = Gem::Util.gzip specs
res['content-type'] = 'application/x-gzip'
else
res['content-type'] = 'application/octet-stream'
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def fetch_spec name_tuple
uri.path << '.rz'

spec = fetcher.fetch_path uri
spec = Gem.inflate spec
spec = Gem::Util.inflate spec

if update_cache? then
FileUtils.mkdir_p cache_dir
Expand Down
17 changes: 7 additions & 10 deletions lib/rubygems/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

class Gem::Specification < Gem::BasicSpecification

extend Gem::Deprecate

# REFACTOR: Consider breaking out this version stuff into a separate
# module. There's enough special stuff around it that it may justify
# a separate class.
Expand Down Expand Up @@ -715,6 +717,7 @@ def test_files= files # :nodoc:
# Deprecated: You must now specify the executable name to Gem.bin_path.

attr_writer :default_executable
deprecate :default_executable=, :none, 2018, 12

##
# Allows deinstallation of gems with legacy platforms.
Expand Down Expand Up @@ -1810,6 +1813,7 @@ def default_executable # :nodoc:
end
result
end
deprecate :default_executable, :none, 2018, 12

##
# The default value for specification attribute +name+
Expand Down Expand Up @@ -2018,6 +2022,7 @@ def gems_dir
def has_rdoc # :nodoc:
true
end
deprecate :has_rdoc, :none, 2018, 12

##
# Deprecated and ignored.
Expand All @@ -2027,8 +2032,10 @@ def has_rdoc # :nodoc:
def has_rdoc= ignored # :nodoc:
@has_rdoc = true
end
deprecate :has_rdoc=, :none, 2018, 12

alias :has_rdoc? :has_rdoc # :nodoc:
deprecate :has_rdoc?, :none, 2018, 12

##
# True if this gem has files in test_files
Expand Down Expand Up @@ -3074,16 +3081,6 @@ def raw_require_paths # :nodoc:
@require_paths
end

extend Gem::Deprecate

# TODO:
# deprecate :has_rdoc, :none, 2011, 10
# deprecate :has_rdoc?, :none, 2011, 10
# deprecate :has_rdoc=, :none, 2011, 10
# deprecate :default_executable, :none, 2011, 10
# deprecate :default_executable=, :none, 2011, 10
# deprecate :file_name, :cache_file, 2011, 10
# deprecate :full_gem_path, :cache_file, 2011, 10
end

# DOC: What is this and why is it here, randomly, at the end of this file?
Expand Down
Loading

0 comments on commit c6da9ca

Please sign in to comment.