Skip to content

Commit

Permalink
Showing 66 changed files with 908 additions and 2,488 deletions.
50 changes: 0 additions & 50 deletions lib/ruby/stdlib/gauntlet_rubygems.rb

This file was deleted.

51 changes: 17 additions & 34 deletions lib/ruby/stdlib/rubygems.rb
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
require 'thread'

module Gem
VERSION = '2.5.1'
VERSION = '2.4.8'
end

# Must be first since it unloads the prelude from 1.9.2
@@ -26,12 +26,12 @@ module Gem
# For user documentation, see:
#
# * <tt>gem help</tt> and <tt>gem help [command]</tt>
# * {RubyGems User Guide}[http://guides.rubygems.org/]
# * {Frequently Asked Questions}[http://guides.rubygems.org/faqs]
# * {RubyGems User Guide}[http://docs.rubygems.org/read/book/1]
# * {Frequently Asked Questions}[http://docs.rubygems.org/read/book/3]
#
# For gem developer documentation see:
#
# * {Creating Gems}[http://guides.rubygems.org/make-your-own-gem]
# * {Creating Gems}[http://docs.rubygems.org/read/chapter/5]
# * Gem::Specification
# * Gem::Version for version dependency notes
#
@@ -156,7 +156,6 @@ module Gem
@@win_platform = nil

@configuration = nil
@gemdeps = nil
@loaded_specs = {}
LOADED_SPECS_MUTEX = Mutex.new
@path_to_default_spec_map = {}
@@ -185,9 +184,13 @@ def self.try_activate path
# or if it was ambiguous (and thus unresolved) the code in our custom
# require will try to activate the more specific version.

spec = Gem::Specification.find_by_path path
return false unless spec
return true if spec.activated?
spec = Gem::Specification.find_inactive_by_path path

unless spec
spec = Gem::Specification.find_by_path path
return true if spec && spec.activated?
return false
end

begin
spec.activate
@@ -307,10 +310,11 @@ def self.configuration=(config)
# package is not available as a gem, return nil.

def self.datadir(gem_name)
# TODO: deprecate
# TODO: deprecate and move to Gem::Specification
# and drop the extra ", gem_name" which is uselessly redundant
spec = @loaded_specs[gem_name]
return nil if spec.nil?
spec.datadir
File.join spec.full_gem_path, "data", gem_name
end

##
@@ -429,7 +433,7 @@ def self.find_files(glob, check_load_path=true)

files = find_files_from_load_path glob if check_load_path

files.concat Gem::Specification.stubs.map { |spec|
files.concat Gem::Specification.map { |spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
}.flatten

@@ -576,10 +580,6 @@ def self.host= host
# gem's paths are inserted before site lib directory by default.

def self.load_path_insert_index
$LOAD_PATH.each_with_index do |path, i|
return i if path.instance_variable_defined?(:@gem_prelude_index)
end

index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']

index
@@ -596,9 +596,6 @@ def self.load_yaml

test_syck = ENV['TEST_SYCK']

# Only Ruby 1.8 and 1.9 have syck
test_syck = false unless /^1\./ =~ RUBY_VERSION

unless test_syck
begin
gem 'psych', '>= 1.2.1'
@@ -780,14 +777,6 @@ def self.read_binary(path)
open path, 'rb' do |f|
f.read
end
rescue Errno::ENOLCK # NFS
if Thread.main != Thread.current
raise
else
open path, 'rb' do |f|
f.read
end
end
end

##
@@ -1063,7 +1052,7 @@ def self.use_gemdeps path = nil
end

rs = Gem::RequestSet.new
@gemdeps = rs.load_gemdeps path
rs.load_gemdeps path

rs.resolve_current.map do |s|
sp = s.full_spec
@@ -1093,12 +1082,6 @@ class << self

attr_reader :loaded_specs

##
# GemDependencyAPI object, which is set when .use_gemdeps is called.
# This contains all the information from the Gemfile.

attr_reader :gemdeps

##
# Register a Gem::Specification for default gem.
#
@@ -1213,7 +1196,6 @@ def clear_default_specs
autoload :DependencyList, 'rubygems/dependency_list'
autoload :DependencyResolver, 'rubygems/resolver'
autoload :Installer, 'rubygems/installer'
autoload :Licenses, 'rubygems/util/licenses'
autoload :PathSupport, 'rubygems/path_support'
autoload :Platform, 'rubygems/platform'
autoload :RequestSet, 'rubygems/request_set'
@@ -1260,3 +1242,4 @@ def clear_default_specs
require 'rubygems/core_ext/kernel_require'

Gem.use_gemdeps

Loading

0 comments on commit 88e39cf

Please sign in to comment.