44
55module Bundler
66 class RubygemsIntegration
7- if defined? ( Gem ::Ext ::Builder ::CHDIR_MONITOR )
8- EXT_LOCK = Gem ::Ext ::Builder ::CHDIR_MONITOR
9- else
10- require "monitor"
7+ require "monitor"
118
12- EXT_LOCK = Monitor . new
13- end
9+ EXT_LOCK = Monitor . new
1410
1511 def initialize
1612 @replaced_methods = { }
17- backport_ext_builder_monitor
1813 end
1914
2015 def version
@@ -43,18 +38,6 @@ def loaded_specs(name)
4338 Gem . loaded_specs [ name ]
4439 end
4540
46- def add_to_load_path ( paths )
47- return Gem . add_to_load_path ( *paths ) if Gem . respond_to? ( :add_to_load_path )
48-
49- if insert_index = Gem . load_path_insert_index
50- # Gem directories must come after -I and ENV['RUBYLIB']
51- $LOAD_PATH. insert ( insert_index , *paths )
52- else
53- # We are probably testing in core, -I and RUBYLIB don't apply
54- $LOAD_PATH. unshift ( *paths )
55- end
56- end
57-
5841 def mark_loaded ( spec )
5942 if spec . respond_to? ( :activated= )
6043 current = Gem . loaded_specs [ spec . name ]
@@ -116,16 +99,6 @@ def inflate(obj)
11699 Gem ::Util . inflate ( obj )
117100 end
118101
119- def correct_for_windows_path ( path )
120- if Gem ::Util . respond_to? ( :correct_for_windows_path )
121- Gem ::Util . correct_for_windows_path ( path )
122- elsif path [ 0 ] . chr == "/" && path [ 1 ] . chr =~ /[a-z]/i && path [ 2 ] . chr == ":"
123- path [ 1 ..-1 ]
124- else
125- path
126- end
127- end
128-
129102 def gem_dir
130103 Gem . dir
131104 end
@@ -161,7 +134,7 @@ def gem_cache
161134 def spec_cache_dirs
162135 @spec_cache_dirs ||= begin
163136 dirs = gem_path . map { |dir | File . join ( dir , "specifications" ) }
164- dirs << Gem . spec_cache_dir if Gem . respond_to? ( :spec_cache_dir ) # Not in RubyGems 2.0.3 or earlier
137+ dirs << Gem . spec_cache_dir
165138 dirs . uniq . select { |dir | File . directory? dir }
166139 end
167140 end
@@ -183,18 +156,6 @@ def loaded_gem_paths
183156 loaded_gem_paths . flatten
184157 end
185158
186- def load_plugins
187- Gem . load_plugins if Gem . respond_to? ( :load_plugins )
188- end
189-
190- def load_plugin_files ( files )
191- Gem . load_plugin_files ( files ) if Gem . respond_to? ( :load_plugin_files )
192- end
193-
194- def load_env_plugins
195- Gem . load_env_plugins if Gem . respond_to? ( :load_env_plugins )
196- end
197-
198159 def ui = ( obj )
199160 Gem ::DefaultUserInteraction . ui = obj
200161 end
@@ -480,7 +441,6 @@ def download_gem(spec, uri, cache_dir, fetcher)
480441
481442 begin
482443 remote_gem_path = uri + "gems/#{ gem_file_name } "
483- remote_gem_path = remote_gem_path . to_s if provides? ( "< 3.2.0.rc.1" )
484444
485445 SharedHelpers . filesystem_access ( local_gem_path ) do
486446 fetcher . cache_update_path remote_gem_path , local_gem_path
@@ -514,25 +474,6 @@ def all_specs
514474 end
515475 end
516476
517- def backport_ext_builder_monitor
518- # So we can avoid requiring "rubygems/ext" in its entirety
519- Gem . module_eval <<-RUBY , __FILE__ , __LINE__ + 1
520- module Ext
521- end
522- RUBY
523-
524- require "rubygems/ext/builder"
525-
526- Gem ::Ext ::Builder . class_eval do
527- unless const_defined? ( :CHDIR_MONITOR )
528- const_set ( :CHDIR_MONITOR , EXT_LOCK )
529- end
530-
531- remove_const ( :CHDIR_MUTEX ) if const_defined? ( :CHDIR_MUTEX )
532- const_set ( :CHDIR_MUTEX , const_get ( :CHDIR_MONITOR ) )
533- end
534- end
535-
536477 def find_bundler ( version )
537478 find_name ( "bundler" ) . find { |s | s . version . to_s == version }
538479 end
@@ -541,14 +482,8 @@ def find_name(name)
541482 Gem ::Specification . stubs_for ( name ) . map ( &:to_spec )
542483 end
543484
544- if Gem ::Specification . respond_to? ( :default_stubs )
545- def default_stubs
546- Gem ::Specification . default_stubs ( "*.gemspec" )
547- end
548- else
549- def default_stubs
550- Gem ::Specification . send ( :default_stubs , "*.gemspec" )
551- end
485+ def default_stubs
486+ Gem ::Specification . default_stubs ( "*.gemspec" )
552487 end
553488 end
554489
0 commit comments