9
9
require 'thread'
10
10
11
11
module Gem
12
- VERSION = '2.4.8 '
12
+ VERSION = '2.5.0 '
13
13
end
14
14
15
15
# Must be first since it unloads the prelude from 1.9.2
@@ -26,12 +26,12 @@ module Gem
26
26
# For user documentation, see:
27
27
#
28
28
# * <tt>gem help</tt> and <tt>gem help [command]</tt>
29
- # * {RubyGems User Guide}[http://docs .rubygems.org/read/book/1 ]
30
- # * {Frequently Asked Questions}[http://docs .rubygems.org/read/book/3 ]
29
+ # * {RubyGems User Guide}[http://guides .rubygems.org/]
30
+ # * {Frequently Asked Questions}[http://guides .rubygems.org/faqs ]
31
31
#
32
32
# For gem developer documentation see:
33
33
#
34
- # * {Creating Gems}[http://docs .rubygems.org/read/chapter/5 ]
34
+ # * {Creating Gems}[http://guides .rubygems.org/make-your-own-gem ]
35
35
# * Gem::Specification
36
36
# * Gem::Version for version dependency notes
37
37
#
@@ -156,6 +156,7 @@ module Gem
156
156
@@win_platform = nil
157
157
158
158
@configuration = nil
159
+ @gemdeps = nil
159
160
@loaded_specs = { }
160
161
LOADED_SPECS_MUTEX = Mutex . new
161
162
@path_to_default_spec_map = { }
@@ -184,13 +185,9 @@ def self.try_activate path
184
185
# or if it was ambiguous (and thus unresolved) the code in our custom
185
186
# require will try to activate the more specific version.
186
187
187
- spec = Gem ::Specification . find_inactive_by_path path
188
-
189
- unless spec
190
- spec = Gem ::Specification . find_by_path path
191
- return true if spec && spec . activated?
192
- return false
193
- end
188
+ spec = Gem ::Specification . find_by_path path
189
+ return false unless spec
190
+ return true if spec . activated?
194
191
195
192
begin
196
193
spec . activate
@@ -433,7 +430,7 @@ def self.find_files(glob, check_load_path=true)
433
430
434
431
files = find_files_from_load_path glob if check_load_path
435
432
436
- files . concat Gem ::Specification . map { |spec |
433
+ files . concat Gem ::Specification . stubs . map { |spec |
437
434
spec . matches_for_glob ( "#{ glob } #{ Gem . suffix_pattern } " )
438
435
} . flatten
439
436
@@ -580,6 +577,10 @@ def self.host= host
580
577
# gem's paths are inserted before site lib directory by default.
581
578
582
579
def self . load_path_insert_index
580
+ $LOAD_PATH. each_with_index do |path , i |
581
+ return i if path . instance_variable_defined? ( :@gem_prelude_index )
582
+ end
583
+
583
584
index = $LOAD_PATH. index RbConfig ::CONFIG [ 'sitelibdir' ]
584
585
585
586
index
@@ -596,6 +597,9 @@ def self.load_yaml
596
597
597
598
test_syck = ENV [ 'TEST_SYCK' ]
598
599
600
+ # Only Ruby 1.8 and 1.9 have syck
601
+ test_syck = false unless /^1\. / =~ RUBY_VERSION
602
+
599
603
unless test_syck
600
604
begin
601
605
gem 'psych' , '>= 1.2.1'
@@ -777,6 +781,14 @@ def self.read_binary(path)
777
781
open path , 'rb' do |f |
778
782
f . read
779
783
end
784
+ rescue Errno ::ENOLCK # NFS
785
+ if Thread . main != Thread . current
786
+ raise
787
+ else
788
+ open path , 'rb' do |f |
789
+ f . read
790
+ end
791
+ end
780
792
end
781
793
782
794
##
@@ -1052,7 +1064,7 @@ def self.use_gemdeps path = nil
1052
1064
end
1053
1065
1054
1066
rs = Gem ::RequestSet . new
1055
- rs . load_gemdeps path
1067
+ @gemdeps = rs . load_gemdeps path
1056
1068
1057
1069
rs . resolve_current . map do |s |
1058
1070
sp = s . full_spec
@@ -1082,6 +1094,12 @@ class << self
1082
1094
1083
1095
attr_reader :loaded_specs
1084
1096
1097
+ ##
1098
+ # GemDependencyAPI object, which is set when .use_gemdeps is called.
1099
+ # This contains all the information from the Gemfile.
1100
+
1101
+ attr_reader :gemdeps
1102
+
1085
1103
##
1086
1104
# Register a Gem::Specification for default gem.
1087
1105
#
@@ -1196,6 +1214,7 @@ def clear_default_specs
1196
1214
autoload :DependencyList , 'rubygems/dependency_list'
1197
1215
autoload :DependencyResolver , 'rubygems/resolver'
1198
1216
autoload :Installer , 'rubygems/installer'
1217
+ autoload :Licenses , 'rubygems/util/licenses'
1199
1218
autoload :PathSupport , 'rubygems/path_support'
1200
1219
autoload :Platform , 'rubygems/platform'
1201
1220
autoload :RequestSet , 'rubygems/request_set'
@@ -1242,4 +1261,3 @@ def clear_default_specs
1242
1261
require 'rubygems/core_ext/kernel_require'
1243
1262
1244
1263
Gem . use_gemdeps
1245
-
0 commit comments