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

* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.5.2.

It supports to enable frozen string literal and add `--norc` option for
  disable to `.gemrc` configuration.
  See 2.5.2 release notes for other fixes and enhancements.
  a8aa3bac72/History.txt (L3)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2016-02-01 12:43:26 +00:00
parent 94cfa2893c
commit a21d403f21
304 changed files with 966 additions and 624 deletions

View file

@ -1,3 +1,11 @@
Mon Feb 1 21:41:58 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.5.2.
It supports to enable frozen string literal and add `--norc` option for
disable to `.gemrc` configuration.
See 2.5.2 release notes for other fixes and enhancements.
https://github.com/rubygems/rubygems/blob/a8aa3bac723f045c52471c7b9328310a048561e0/History.txt#L3
Sun Jan 31 12:33:13 2016 Dan Kreiger <dan@dankreiger.com>
* test/drb/ut_large.rb (multiply, avg, median): add additional

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
@ -10,7 +10,7 @@ require 'rbconfig'
require 'thread'
module Gem
VERSION = '2.5.1'
VERSION = '2.5.2'
end
# Must be first since it unloads the prelude from 1.9.2
@ -239,7 +239,7 @@ module Gem
specs = dep.matching_specs(true)
raise Gem::GemNotFoundException,
"can't find gem #{name} (#{requirements})" if specs.empty?
"can't find gem #{dep}" if specs.empty?
specs = specs.find_all { |spec|
spec.executables.include? exec_name

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
class Gem::AvailableSet
include Enumerable

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# BasicSpecification is an abstract class which implements some common code
# used by both Specification and StubSpecification.
@ -125,9 +125,9 @@ class Gem::BasicSpecification
def full_name
if platform == Gem::Platform::RUBY or platform.nil? then
"#{name}-#{version}".untaint
"#{name}-#{version}".dup.untaint
else
"#{name}-#{version}-#{platform}".untaint
"#{name}-#{version}-#{platform}".dup.untaint
end
end
@ -282,7 +282,7 @@ class Gem::BasicSpecification
self.require_paths.first
end
"#{self.full_gem_path}/#{dirs}".untaint
"#{self.full_gem_path}/#{dirs}".dup.untaint
end
##
@ -326,4 +326,3 @@ class Gem::BasicSpecification
end
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@ -154,7 +154,7 @@ class Gem::Command
def show_lookup_failure(gem_name, version, errors, domain)
if errors and !errors.empty?
msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n"
msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n".dup
errors.each { |x| msg << " #{x.wordy}\n" }
alert_error msg
else
@ -540,6 +540,11 @@ class Gem::Command
'Turn on Ruby debugging') do
end
add_common_option('--norc',
'Avoid loading any .gemrc file') do
end
# :stopdoc:
HELP = <<-HELP
@ -580,4 +585,3 @@ end
module Gem::Commands
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/package'
@ -42,6 +42,10 @@ with gem spec:
def execute
gemspec = get_one_gem_name
unless File.exist? gemspec
gemspec += '.gemspec' if File.exist? gemspec + '.gemspec'
end
if File.exist? gemspec then
spec = Gem::Specification.load gemspec

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/security'
begin

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/validator'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/dependency_list'
require 'rubygems/uninstaller'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'English'
require 'rubygems/command'
require 'rubygems/version_option'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
@ -100,7 +100,7 @@ use with other commands.
end
def display_readable specs, reverse # :nodoc:
response = ''
response = String.new
specs.each do |spec|
response << print_dependencies(spec)
@ -153,7 +153,7 @@ use with other commands.
end
def print_dependencies(spec, level = 0) # :nodoc:
response = ''
response = String.new
response << ' ' * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty? then
spec.dependencies.sort_by { |dep| dep.name }.each do |dep|

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::EnvironmentCommand < Gem::Command
@ -72,7 +72,7 @@ lib/rubygems/defaults/operating_system.rb
end
def execute
out = ''
out = String.new
arg = options[:args][0]
out <<
case arg
@ -104,7 +104,7 @@ lib/rubygems/defaults/operating_system.rb
end
def show_environment # :nodoc:
out = "RubyGems Environment:\n"
out = "RubyGems Environment:\n".dup
out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n"
@ -158,4 +158,3 @@ lib/rubygems/defaults/operating_system.rb
end
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/indexer'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::HelpCommand < Gem::Command

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/install_update_options'
require 'rubygems/dependency_installer'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/commands/query_command'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::LockCommand < Gem::Command

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
unless defined? Gem::Commands::MirrorCommand

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'English'
require 'rubygems/command'
require 'rubygems/version_option'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/package'
require 'rubygems/installer'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
@ -50,6 +50,12 @@ class Gem::Commands::QueryCommand < Gem::Command
options[:all] = value
end
add_option('-e', '--exact',
'Name of gem(s) to query on matches the',
'provided STRING') do |value, options|
options[:exact] = value
end
add_option( '--[no-]prerelease',
'Display prerelease versions') do |value, options|
options[:prerelease] = value
@ -79,7 +85,8 @@ is too hard to use.
elsif !options[:name].source.empty?
name = Array(options[:name])
else
name = options[:args].to_a.map{|arg| /#{arg}/i }
args = options[:args].to_a
name = options[:exact] ? args : args.map{|arg| /#{arg}/i }
end
prerelease = options[:prerelease]
@ -162,7 +169,7 @@ is too hard to use.
:latest
end
if name.source.empty?
if name.respond_to?(:source) && name.source.empty?
spec_tuples = fetcher.detect(type) { true }
else
spec_tuples = fetcher.detect(type) do |name_tuple|
@ -277,7 +284,7 @@ is too hard to use.
end
def spec_authors entry, spec
authors = "Author#{spec.authors.length > 1 ? 's' : ''}: "
authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup
authors << spec.authors.join(', ')
entry << format_text(authors, 68, 4)
end
@ -291,7 +298,7 @@ is too hard to use.
def spec_license entry, spec
return if spec.license.nil? or spec.license.empty?
licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: "
licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup
licenses << spec.licenses.join(', ')
entry << "\n" << format_text(licenses, 68, 4)
end
@ -341,4 +348,3 @@ is too hard to use.
end
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/rdoc'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/commands/query_command'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/server'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
##

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/remote_fetcher'
require 'rubygems/spec_fetcher'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::StaleCommand < Gem::Command

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/uninstaller'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/installer'
require 'rubygems/version_option'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/command_manager'
require 'rubygems/dependency_installer'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::WhichCommand < Gem::Command

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
@ -32,7 +32,7 @@ as the reason for the removal request.
end
def usage # :nodoc:
"#{program_name} GEM -v VERSION [-p PLATFORM] [--undo] [--key KEY_NAME]"
"#{program_name} GEM -v VERSION [-p PLATFORM] [--key KEY_NAME] [--host HOST]"
end
def initialize
@ -41,25 +41,25 @@ as the reason for the removal request.
add_version_option("remove")
add_platform_option("remove")
add_option('--undo') do |value, options|
options[:undo] = true
add_option('--host HOST',
'Yank from another gemcutter-compatible host') do |value, options|
options[:host] = value
end
add_key_option
@host = nil
end
def execute
sign_in
@host = options[:host]
sign_in @host
version = get_version_from_requirements(options[:version])
platform = get_platform_from_requirements(options)
if version then
if options[:undo] then
unyank_gem(version, platform)
else
yank_gem(version, platform)
end
yank_gem(version, platform)
else
say "A version argument is required: #{usage}"
terminate_interaction
@ -71,16 +71,11 @@ as the reason for the removal request.
yank_api_request(:delete, version, platform, "api/v1/gems/yank")
end
def unyank_gem(version, platform)
say "Unyanking gem from #{host}..."
yank_api_request(:put, version, platform, "api/v1/gems/unyank")
end
private
def yank_api_request(method, version, platform, api)
name = get_one_gem_name
response = rubygems_api_request(method, api) do |request|
response = rubygems_api_request(method, api, host) do |request|
request.add_field("Authorization", api_key)
data = {

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
# :stopdoc:
#--

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@ -201,11 +201,12 @@ class Gem::ConfigFile
result.merge load_file file
end
@hash = operating_system_config.merge platform_config
@hash = @hash.merge system_config
@hash = @hash.merge user_config
@hash = @hash.merge environment_config
unless arg_list.index '--norc'
@hash = @hash.merge system_config
@hash = @hash.merge user_config
@hash = @hash.merge environment_config
end
# HACK these override command-line args, which is bad
@backtrace = @hash[:backtrace] if @hash.key? :backtrace

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# RubyGems adds the #gem method to allow activation of specific gem versions
# and overrides the #require method on Kernel to make gems appear as if they

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
module Gem
DEFAULT_HOST = "https://rubygems.org"

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# The Dependency class holds a Gem name and a Gem::Requirement.
@ -307,9 +307,9 @@ class Gem::Dependency
if specs.empty?
total = Gem::Specification.to_a.size
msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n"
msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n".dup
else
msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n"
msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n".dup
end
msg << "Checked in 'GEM_PATH=#{Gem.path.join(File::PATH_SEPARATOR)}', execute `gem env` for more information"

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/dependency_list'
require 'rubygems/package'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# Provides a single method +deprecate+ to be used to declare when
# something is going away.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# This file contains all the various exceptions and other errors that are used
# inside of RubyGems.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
# TODO: the documentation in here is terrible.
#
# Each exception needs a brief description and the scenarios where it is
@ -138,7 +138,7 @@ class Gem::ImpossibleDependenciesError < Gem::Exception
requester = requester ? requester.spec.full_name : 'The user'
dependency = @request.dependency
message = "#{requester} requires #{dependency} but it conflicted:\n"
message = "#{requester} requires #{dependency} but it conflicted:\n".dup
@conflicts.each do |_, conflict|
message << conflict.explanation
@ -268,4 +268,3 @@ end
# Backwards compatible typo'd exception class for early RubyGems 2.0.x
Gem::UnsatisfiableDepedencyError = Gem::UnsatisfiableDependencyError # :nodoc:

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# Raised when there is an error while building extensions.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@ -12,9 +12,20 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
FileEntry = FileUtils::Entry_ # :nodoc:
def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
# relative path required as some versions of mktmpdir return an absolute
# path which breaks make if it includes a space in the name
tmp_dest = get_relative_path(Dir.mktmpdir(".gem.", "."))
tmp_dest = Dir.mktmpdir(".gem.", ".")
# Some versions of `mktmpdir` return absolute paths, which will break make
# if the paths contain spaces. However, on Ruby 1.9.x on Windows, relative
# paths cause all C extension builds to fail.
#
# As such, we convert to a relative path unless we are using Ruby 1.9.x on
# Windows. This means that when using Ruby 1.9.x on Windows, paths with
# spaces do not work.
#
# Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
#
# TODO: Make this unconditional when rubygems no longer supports Ruby 1.9.x.
tmp_dest = get_relative_path(tmp_dest) unless Gem.win_platform? && RUBY_VERSION <= '2.0'
t = nil
Tempfile.open %w"siteconf .rb", "." do |siteconf|
@ -81,4 +92,3 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
end
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/remote_fetcher'
##
@ -69,9 +69,14 @@ module Gem::GemcutterUtilities
terminate_interaction 1 # TODO: question this
end
if allowed_push_host and self.host != allowed_push_host
alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}"
terminate_interaction 1
if allowed_push_host
allowed_host_uri = URI.parse(allowed_push_host)
host_uri = URI.parse(self.host)
unless (host_uri.scheme == allowed_host_uri.scheme) && (host_uri.host == allowed_host_uri.host)
alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}"
terminate_interaction 1
end
end
uri = URI.parse "#{self.host}/#{path}"

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/package'
require 'time'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@ -174,6 +174,11 @@ module Gem::InstallUpdateOptions
"meet version requirements") do |value, options|
options[:minimal_deps] = true
end
add_option(:"Install/Update", "--[no-]post-install-message",
"Print post install message") do |value, options|
options[:post_install_message] = value
end
end
##

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@ -213,7 +213,13 @@ class Gem::Installer
next unless io.gets =~ /This file was generated by RubyGems/
ruby_executable = true
existing = io.read.slice(/^gem (['"])(.*?)(\1),/, 2)
existing = io.read.slice(%r{
^(
gem \s |
load \s Gem\.bin_path\(
)
(['"])(.*?)(\2),
}x, 3)
end
return if spec.name == existing
@ -221,7 +227,7 @@ class Gem::Installer
# somebody has written to RubyGems' directory, overwrite, too bad
return if Gem.default_bindir != @bin_dir and not ruby_executable
question = "#{spec.name}'s executable \"#{filename}\" conflicts with "
question = "#{spec.name}'s executable \"#{filename}\" conflicts with ".dup
if ruby_executable then
question << existing
@ -297,7 +303,7 @@ class Gem::Installer
write_cache_file
end
say spec.post_install_message unless spec.post_install_message.nil?
say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil?
Gem::Installer.install_lock.synchronize { Gem::Specification.reset }
@ -627,7 +633,8 @@ class Gem::Installer
:bin_dir => nil,
:env_shebang => false,
:force => false,
:only_install_dir => false
:only_install_dir => false,
:post_install_message => true
}.merge options
@env_shebang = options[:env_shebang]
@ -712,7 +719,6 @@ if ARGV.first
end
end
gem '#{spec.name}', version
load Gem.bin_path('#{spec.name}', '#{bin_file_name}', version)
TEXT
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/test_case'
require 'rubygems/installer'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@ -24,7 +24,7 @@ module Gem::LocalRemoteOptions
raise OptionParser::InvalidArgument, value
end
unless ['http', 'https', 'file'].include?(uri.scheme)
unless ['http', 'https', 'file', 's3'].include?(uri.scheme)
raise OptionParser::InvalidArgument, value
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'stringio'
require 'rubygems/user_interaction'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
#
# Represents a gem of name +name+ at +version+ of +platform+. These
@ -54,7 +54,7 @@ class Gem::NameTuple
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{@platform}"
end.untaint
end.dup.untaint
end
##

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# -*- coding: utf-8 -*-
# frozen_string_literal: false
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
@ -59,7 +59,7 @@ class Gem::Package
if source
@path = source.path
message << " in #{path}" if path
message = message + " in #{path}" if path
end
super message
@ -383,7 +383,7 @@ EOM
FileUtils.chmod entry.header.mode, destination
end if entry.file?
File.symlink(install_location(entry.header.linkname, destination_dir), destination) if entry.symlink?
File.symlink(entry.header.linkname, destination) if entry.symlink?
verbose destination
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# IO wrapper that creates digests of contents written to the IO it wraps.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# The primary source of gems is a file on disk, including all usages
# internal to rubygems.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# Supports reading and writing gems from/to a generic IO object. This is
# useful for other applications built on top of rubygems, such as

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@ -64,7 +64,7 @@ class Gem::Package::Old < Gem::Package
destination = install_location full_name, destination_dir
file_data = ''
file_data = String.new
read_until_dashes io do |line|
file_data << line
@ -95,7 +95,7 @@ class Gem::Package::Old < Gem::Package
# Reads the file list section from the old-format gem +io+
def file_list io # :nodoc:
header = ''
header = String.new
read_until_dashes io do |line|
header << line
@ -135,7 +135,7 @@ class Gem::Package::Old < Gem::Package
return @spec if @spec
yaml = ''
yaml = String.new
@gem.with_read_io do |io|
skip_ruby io
@ -176,4 +176,3 @@ class Gem::Package::Old < Gem::Package
end
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
class Gem::Package::Source # :nodoc:
end

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# -*- coding: utf-8 -*-
# frozen_string_literal: false
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# -*- coding: utf-8 -*-
# frozen_string_literal: false
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# -*- coding: utf-8 -*-
# frozen_string_literal: false
#++
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/test_case'
require 'rubygems/package'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
# -*- coding: utf-8 -*-
# frozen_string_literal: false
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
# Copyright (c) 2003, 2004 Jim Weirich, 2009 Eric Hodel
#
# Permission is hereby granted, free of charge, to any person obtaining

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
#
# Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings
@ -59,6 +59,9 @@ class Gem::PathSupport
gem_path = gpaths.dup
else
gem_path = gpaths.split(Gem.path_separator)
if gpaths.end_with?(Gem.path_separator)
gem_path += default_path
end
end
if File::ALT_SEPARATOR then
@ -69,13 +72,19 @@ class Gem::PathSupport
gem_path << @home
else
gem_path = Gem.default_path + [@home]
if defined?(APPLE_GEM_HOME)
gem_path << APPLE_GEM_HOME
end
gem_path = default_path
end
@path = gem_path.uniq
end
# Return the default Gem path
def default_path
gem_path = Gem.default_path + [@home]
if defined?(APPLE_GEM_HOME)
gem_path << APPLE_GEM_HOME
end
gem_path
end
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require "rubygems/deprecate"
##

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
# This exists just to satisfy bugs in marshal'd gemspecs that
# contain a reference to YAML::PrivateType. We prune these out
# in Specification._load, but if we don't have the constant, Marshal

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
module Gem
if defined? ::Psych::Visitors
class NoAliasYAMLTree < Psych::Visitors::YAMLTree

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'
require 'fileutils'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/request'
require 'rubygems/uri_formatter'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'net/http'
require 'thread'
require 'time'
@ -156,7 +156,7 @@ class Gem::Request
if Net::HTTPOK === incomplete_response
reporter.fetch(file_name, incomplete_response.content_length)
downloaded = 0
data = ''
data = String.new
incomplete_response.read_body do |segment|
data << segment
@ -223,7 +223,7 @@ class Gem::Request
end
def user_agent
ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}"
ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}".dup
ruby_version = RUBY_VERSION
ruby_version += 'dev' if RUBY_PATCHLEVEL == -1

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'thread'
class Gem::Request::ConnectionPools # :nodoc:

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# A connection "pool" that only manages one connection for now. Provides
# thread safe `checkout` and `checkin` methods. The pool consists of one

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
class Gem::Request::HTTPSPool < Gem::Request::HTTPPool # :nodoc:
private

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'tsort'
##
@ -77,6 +77,11 @@ class Gem::RequestSet
attr_reader :vendor_set # :nodoc:
##
# The set of source gems imported via load_gemdeps.
attr_reader :source_set
##
# Creates a RequestSet for a list of Gem::Dependency objects, +deps+. You
# can then #resolve and #install the resolved list of dependencies.
@ -106,6 +111,7 @@ class Gem::RequestSet
@sorted = nil
@specs = nil
@vendor_set = nil
@source_set = nil
yield self if block_given?
end
@ -143,7 +149,6 @@ class Gem::RequestSet
return requests
end
cache_dir = options[:cache_dir] || Gem.dir
@prerelease = options[:prerelease]
requests = []
@ -158,13 +163,11 @@ class Gem::RequestSet
end
end
path = req.download cache_dir
spec = req.spec.install options do |installer|
yield req, installer if block_given?
end
inst = Gem::Installer.at path, options
yield req, inst if block_given?
requests << inst.install
requests << spec
end
return requests if options[:gemdeps]
@ -272,10 +275,11 @@ class Gem::RequestSet
def load_gemdeps path, without_groups = [], installing = false
@git_set = Gem::Resolver::GitSet.new
@vendor_set = Gem::Resolver::VendorSet.new
@source_set = Gem::Resolver::SourceSet.new
@git_set.root_dir = @install_dir
lock_file = "#{File.expand_path(path)}.lock".untaint
lock_file = "#{File.expand_path(path)}.lock".dup.untaint
begin
tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file
parser = tokenizer.make_parser self, []
@ -339,6 +343,7 @@ class Gem::RequestSet
@sets << set
@sets << @git_set
@sets << @vendor_set
@sets << @source_set
set = Gem::Resolver.compose_sets(*@sets)
set.remote = @remote

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# A semi-compatible DSL for the Bundler Gemfile and Isolate gem dependencies
# files.
@ -205,6 +205,7 @@ class Gem::RequestSet::GemDependencyAPI
@installing = false
@requires = Hash.new { |h, name| h[name] = [] }
@vendor_set = @set.vendor_set
@source_set = @set.source_set
@gem_sources = {}
@without_groups = []
@ -363,6 +364,7 @@ class Gem::RequestSet::GemDependencyAPI
source_set ||= gem_path name, options
source_set ||= gem_git name, options
source_set ||= gem_git_source name, options
source_set ||= gem_source name, options
duplicate = @dependencies.include? name
@ -408,11 +410,7 @@ Gem dependencies file #{@path} requires #{name} more than once.
pin_gem_source name, :git, repository
reference = nil
reference ||= options.delete :ref
reference ||= options.delete :branch
reference ||= options.delete :tag
reference ||= 'master'
reference = gem_git_reference options
submodules = options.delete :submodules
@ -421,6 +419,36 @@ Gem dependencies file #{@path} requires #{name} more than once.
true
end
##
# Handles the git options from +options+ for git gem.
#
# Returns reference for the git gem.
def gem_git_reference options # :nodoc:
ref = options.delete :ref
branch = options.delete :branch
tag = options.delete :tag
reference = nil
reference ||= ref
reference ||= branch
reference ||= tag
reference ||= 'master'
if ref && branch
warn <<-WARNING
Gem dependencies file #{@path} includes git reference for both ref and branch but only ref is used.
WARNING
end
if (ref||branch) && tag
warn <<-WARNING
Gem dependencies file #{@path} includes git reference for both ref/branch and tag but only ref/branch is used.
WARNING
end
reference
end
private :gem_git
##
@ -481,6 +509,23 @@ Gem dependencies file #{@path} requires #{name} more than once.
private :gem_path
##
# Handles the source: option from +options+ for gem +name+.
#
# Returns +true+ if the source option was handled.
def gem_source name, options # :nodoc:
return unless source = options.delete(:source)
pin_gem_source name, :source, source
@source_set.add_source_gem name, source
true
end
private :gem_source
##
# Handles the platforms: option from +options+. Returns true if the
# platform matches the current platform.
@ -527,6 +572,7 @@ Gem dependencies file #{@path} requires #{name} more than once.
else
@requires[name] << name
end
raise ArgumentError, "Unhandled gem options #{options.inspect}" unless options.empty?
end
private :gem_requires
@ -612,6 +658,7 @@ Gem dependencies file #{@path} requires #{name} more than once.
add_dependencies groups, spec.development_dependencies
@vendor_set.add_vendor_gem spec.name, path
gem_requires spec.name, options
end
@ -651,6 +698,7 @@ Gem dependencies file #{@path} requires #{name} more than once.
when :default then '(default)'
when :path then "path: #{source}"
when :git then "git: #{source}"
when :source then "source: #{source}"
else '(unknown)'
end
@ -799,4 +847,3 @@ Gem dependencies file #{@path} requires #{name} more than once.
Gem::RequestSet::GemDepedencyAPI = self # :nodoc:
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# Parses a gem.deps.rb.lock file and constructs a LockSet containing the
# dependencies found inside. If the lock file is missing no LockSet is
@ -130,8 +130,8 @@ class Gem::RequestSet::Lockfile
[source.repository, source.rev_parse]
end
out << "GIT"
by_repository_revision.each do |(repository, revision), requests|
out << "GIT"
out << " remote: #{repository}"
out << " revision: #{revision}"
out << " specs:"
@ -144,9 +144,8 @@ class Gem::RequestSet::Lockfile
out << " #{dep.name}#{dep.requirement.for_lockfile}"
end
end
out << nil
end
out << nil
end
def relative_path_from dest, base # :nodoc:

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
class Gem::RequestSet::Lockfile::Parser
###
# Parses lockfiles
@ -325,15 +325,24 @@ class Gem::RequestSet::Lockfile::Parser
@tokens.peek
end
def pinned_requirement name # :nodoc:
spec = @set.sets.select { |set|
Gem::Resolver::GitSet === set or
Gem::Resolver::VendorSet === set
}.map { |set|
set.specs[name]
}.compact.first
if [].respond_to? :flat_map
def pinned_requirement name # :nodoc:
requirement = Gem::Dependency.new name
specification = @set.sets.flat_map { |set|
set.find_all(requirement)
}.compact.first
spec.version
specification && specification.version
end
else # FIXME: remove when 1.8 is dropped
def pinned_requirement name # :nodoc:
requirement = Gem::Dependency.new name
specification = @set.sets.map { |set|
set.find_all(requirement)
}.flatten(1).compact.first
specification && specification.version
end
end
##
@ -343,4 +352,3 @@ class Gem::RequestSet::Lockfile::Parser
@tokens.unshift token
end
end

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'strscan'
require 'rubygems/request_set/lockfile/parser'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require "rubygems/version"
require "rubygems/deprecate"

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/dependency'
require 'rubygems/exceptions'
require 'rubygems/util'
@ -279,6 +279,7 @@ require 'rubygems/resolver/index_set'
require 'rubygems/resolver/installer_set'
require 'rubygems/resolver/lock_set'
require 'rubygems/resolver/vendor_set'
require 'rubygems/resolver/source_set'
require 'rubygems/resolver/specification'
require 'rubygems/resolver/spec_specification'

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# Specifies a Specification object that should be activated. Also contains a
# dependency that was used to introduce this activation.
@ -50,15 +50,27 @@ class Gem::Resolver::ActivationRequest
# Downloads a gem at +path+ and returns the file path.
def download path
if @spec.respond_to? :source
source = @spec.source
else
source = Gem.sources.first
end
Gem.ensure_gem_subdirectories path
source.download full_spec, path
if @spec.respond_to? :sources
exception = nil
path = @spec.sources.find{ |source|
begin
source.download full_spec, path
rescue exception
end
}
return path if path
raise exception if exception
elsif @spec.respond_to? :source
source = @spec.source
source.download full_spec, path
else
source = Gem.sources.first
source.download full_spec, path
end
end
##

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# The global rubygems pool, available via the rubygems.org API.
# Returns instances of APISpecification.

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
##
# Represents a specification retrieved via the rubygems.org API.
#

Some files were not shown because too many files have changed in this diff Show more