rubygems-update 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (105) hide show
  1. data/.document +4 -0
  2. data/ChangeLog +458 -0
  3. data/GPL.txt +340 -0
  4. data/LICENSE.txt +53 -0
  5. data/Rakefile +26 -10
  6. data/TODO +0 -1
  7. data/bin/gem_server +2 -434
  8. data/bin/gemlock +1 -1
  9. data/bin/index_gem_repository.rb +34 -12
  10. data/examples/application/an-app.gemspec +4 -2
  11. data/examples/application/ext/Makefile +139 -0
  12. data/examples/application/ext/extconf.rb +3 -0
  13. data/examples/application/ext/foo.c +1 -0
  14. data/lib/gemconfigure.rb +2 -2
  15. data/lib/rubygems.rb +85 -46
  16. data/lib/rubygems/cmd_manager.rb +14 -11
  17. data/lib/rubygems/command.rb +18 -9
  18. data/lib/rubygems/config_file.rb +17 -16
  19. data/lib/rubygems/custom_require.rb +7 -12
  20. data/lib/rubygems/dependency_list.rb +38 -38
  21. data/lib/rubygems/gem_commands.rb +471 -242
  22. data/lib/rubygems/gem_openssl.rb +1 -1
  23. data/lib/rubygems/gem_runner.rb +2 -1
  24. data/lib/rubygems/installer.rb +189 -143
  25. data/lib/rubygems/package.rb +625 -621
  26. data/lib/rubygems/remote_fetcher.rb +142 -0
  27. data/lib/rubygems/remote_installer.rb +85 -465
  28. data/lib/rubygems/rubygems_version.rb +1 -1
  29. data/lib/rubygems/security.rb +54 -11
  30. data/lib/rubygems/server.rb +486 -0
  31. data/lib/rubygems/source_index.rb +187 -21
  32. data/lib/rubygems/source_info_cache.rb +153 -0
  33. data/lib/rubygems/source_info_cache_entry.rb +31 -0
  34. data/lib/rubygems/specification.rb +71 -30
  35. data/lib/rubygems/user_interaction.rb +22 -20
  36. data/lib/rubygems/validator.rb +8 -7
  37. data/lib/rubygems/version.rb +32 -17
  38. data/pkgs/sources/sources-0.0.1.gem +0 -0
  39. data/post-install.rb +42 -3
  40. data/scripts/gemdoc.rb +3 -3
  41. data/scripts/runtest.rb +1 -1
  42. data/scripts/upload_gemdoc.rb +11 -11
  43. data/setup.rb +14 -7
  44. data/test/brokenbuildgem.rb +35 -0
  45. data/test/data/a-0.0.1.gem +0 -0
  46. data/test/data/a-0.0.2.gem +0 -0
  47. data/test/data/b-0.0.2.gem +0 -0
  48. data/test/data/broken-1.0.0.gem +0 -0
  49. data/test/data/broken_build/broken-build.gemspec +20 -0
  50. data/test/data/broken_build/ext/extconf.rb +3 -0
  51. data/test/data/broken_build/ext/foo.c +1 -0
  52. data/test/data/c-1.2.gem +0 -0
  53. data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
  54. data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
  55. data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
  56. data/test/data/gemhome/cache/c-1.2.gem +0 -0
  57. data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +0 -6
  58. data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +0 -6
  59. data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +0 -6
  60. data/test/data/gemhome/gems/c-1.2/lib/code.rb +0 -6
  61. data/test/data/gemhome/specifications/a-0.0.1.gemspec +1 -1
  62. data/test/data/gemhome/specifications/a-0.0.2.gemspec +1 -1
  63. data/test/data/gemhome/specifications/b-0.0.2.gemspec +1 -1
  64. data/test/data/gemhome/specifications/c-1.2.gemspec +1 -1
  65. data/test/data/lib/code.rb +0 -6
  66. data/test/data/one/one-0.0.1.gem +0 -0
  67. data/test/functional.rb +24 -21
  68. data/test/functional_extension_gems.rb +48 -0
  69. data/test/functional_generate_yaml_index.rb +6 -3
  70. data/test/gemenvironment.rb +27 -22
  71. data/test/gemutilities.rb +95 -5
  72. data/test/insure_session.rb +2 -2
  73. data/test/io_capture.rb +33 -0
  74. data/test/test_check_command.rb +2 -2
  75. data/test/test_command.rb +16 -13
  76. data/test/test_dependency_list.rb +20 -20
  77. data/test/test_file_list.rb +10 -11
  78. data/test/test_format.rb +19 -46
  79. data/test/test_gem.rb +25 -0
  80. data/test/test_gem_ext_configure_builder.rb +88 -0
  81. data/test/test_gem_ext_ext_conf_builder.rb +122 -0
  82. data/test/test_gem_ext_rake_builder.rb +61 -0
  83. data/test/test_gem_outdated_command.rb +37 -0
  84. data/test/test_gem_source_info_cache.rb +196 -0
  85. data/test/test_gem_source_info_cache_entry.rb +44 -0
  86. data/test/test_gem_sources_command.rb +130 -0
  87. data/test/test_installer.rb +137 -9
  88. data/test/test_package.rb +521 -531
  89. data/test/test_parse_commands.rb +7 -7
  90. data/test/test_process_commands.rb +1 -1
  91. data/test/test_remote_fetcher.rb +187 -45
  92. data/test/test_remote_installer.rb +35 -52
  93. data/test/test_require_gem.rb +12 -12
  94. data/test/test_source_index.rb +194 -48
  95. data/test/test_specification.rb +154 -0
  96. data/test/test_user_interaction.rb +48 -0
  97. data/test/test_validator.rb +1 -1
  98. data/test/test_version_comparison.rb +116 -5
  99. metadata +33 -10
  100. data/lib/rubygems/incremental_fetcher.rb +0 -136
  101. data/lib/rubygems/loadpath_manager.rb +0 -114
  102. data/lib/rubygems/open-uri.rb +0 -756
  103. data/test/test_cached_fetcher.rb +0 -64
  104. data/test/test_incremental_fetcher.rb +0 -175
  105. data/test/test_local_cache.rb +0 -106
@@ -16,6 +16,11 @@ require 'optparse'
16
16
  require 'rubygems'
17
17
  require 'zlib'
18
18
  require 'digest/sha2'
19
+ begin
20
+ require 'builder/xchar'
21
+ rescue LoadError
22
+ fail "index_gem_repository requires that the XML Builder library be installed"
23
+ end
19
24
 
20
25
  Gem.manage_gems
21
26
 
@@ -69,14 +74,14 @@ class AbstractIndexBuilder
69
74
  yield
70
75
  else
71
76
  unless File.exist?(@directory)
72
- FileUtils.mkdir_p(@directory)
77
+ FileUtils.mkdir_p(@directory)
73
78
  end
74
79
  fail "not a directory: #{@directory}" unless File.directory?(@directory)
75
80
  File.open(File.join(@directory, @filename), "w") do |file|
76
- @file = file
77
- start_index
78
- yield
79
- end_index
81
+ @file = file
82
+ start_index
83
+ yield
84
+ end_index
80
85
  end
81
86
  cleanup
82
87
  end
@@ -191,13 +196,14 @@ class Indexer
191
196
  FileUtils.rm_r(@options[:quick_directory]) rescue nil
192
197
  @master_index.build do
193
198
  @quick_index.build do
194
- gem_file_list.each do |gemfile|
195
- spec = Gem::Format.from_file_by_path(gemfile).spec
196
- abbreviate(spec)
197
- announce " ... adding #{spec.full_name}"
198
- @master_index.add(spec)
199
- @quick_index.add(spec)
200
- end
199
+ gem_file_list.each do |gemfile|
200
+ spec = Gem::Format.from_file_by_path(gemfile).spec
201
+ abbreviate(spec)
202
+ sanitize(spec)
203
+ announce " ... adding #{spec.full_name}"
204
+ @master_index.add(spec)
205
+ @quick_index.add(spec)
206
+ end
201
207
  end
202
208
  end
203
209
  end
@@ -219,6 +225,22 @@ class Indexer
219
225
  spec.cert_chain = []
220
226
  spec
221
227
  end
228
+
229
+ # Sanitize the descriptive fields in the spec. Sometimes non-ASCII
230
+ # characters will garble the site index. Non-ASCII characters will
231
+ # be replaced by their XML entity equivalent.
232
+ def sanitize(spec)
233
+ spec.summary = sanitize_string(spec.summary)
234
+ spec.description = sanitize_string(spec.description)
235
+ spec.post_install_message = sanitize_string(spec.post_install_message)
236
+ spec.authors = spec.authors.collect { |a| sanitize_string(a) }
237
+ spec
238
+ end
239
+
240
+ # Sanitize a single string.
241
+ def sanitize_string(string)
242
+ string ? string.to_xs : string
243
+ end
222
244
  end
223
245
 
224
246
  ######################################################################
@@ -9,16 +9,18 @@ spec = Gem::Specification.new do |s|
9
9
  s.summary = "This gem demonstrates executable scripts"
10
10
  s.requirements << 'a computer processor'
11
11
  s.files = Dir.glob("lib/**/*").delete_if {|item| item.include?("CVS")}
12
+ s.files = Dir.glob("ext/**/*").delete_if {|item| item.include?("CVS")}
12
13
  s.files.concat Dir.glob("bin/**/*").delete_if {|item| item.include?("CVS")}
13
14
  s.require_path = 'lib'
14
15
  s.autorequire = 'somefunctionality'
15
16
  s.executables = ["myapp"]
16
17
  s.has_rdoc = false
18
+ s.extensions << "ext/extconf.rb"
17
19
  #s.extra_rdoc_files = ["README", "Changes.rdoc"]
18
20
  #s.default_executable = "myapp"
19
21
  s.bindir = "bin"
20
- s.signing_key = '/Users/chadfowler/cvs/rubygems/gem-private_key.pem'
21
- s.cert_chain = ['/Users/chadfowler/cvs/rubygems/gem-public_cert.pem']
22
+ #s.signing_key = '/Users/chadfowler/cvs/rubygems/gem-private_key.pem'
23
+ #s.cert_chain = ['/Users/chadfowler/cvs/rubygems/gem-public_cert.pem']
22
24
  end
23
25
 
24
26
  if $0==__FILE__
@@ -0,0 +1,139 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /usr/local/lib/ruby/1.8/i686-darwin8.6.1
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ prefix = $(DESTDIR)/usr/local
11
+ exec_prefix = $(prefix)
12
+ sitedir = $(prefix)/lib/ruby/site_ruby
13
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
14
+ archdir = $(rubylibdir)/$(arch)
15
+ sbindir = $(exec_prefix)/sbin
16
+ datadir = $(prefix)/share
17
+ includedir = $(prefix)/include
18
+ infodir = $(prefix)/info
19
+ sysconfdir = $(prefix)/etc
20
+ mandir = $(prefix)/man
21
+ libdir = $(exec_prefix)/lib
22
+ sharedstatedir = $(prefix)/com
23
+ oldincludedir = $(DESTDIR)/usr/include
24
+ sitearchdir = $(sitelibdir)/$(sitearch)
25
+ bindir = $(exec_prefix)/bin
26
+ localstatedir = $(prefix)/var
27
+ sitelibdir = $(sitedir)/$(ruby_version)
28
+ libexecdir = $(exec_prefix)/libexec
29
+
30
+ CC = gcc
31
+ LIBRUBY = $(LIBRUBY_A)
32
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
33
+ LIBRUBYARG_SHARED =
34
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
35
+
36
+ CFLAGS = -fno-common -g -O2 -pipe -fno-common
37
+ CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
38
+ CXXFLAGS = $(CFLAGS)
39
+ DLDFLAGS =
40
+ LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
41
+ AR = ar
42
+ EXEEXT =
43
+
44
+ RUBY_INSTALL_NAME = ruby
45
+ RUBY_SO_NAME = ruby
46
+ arch = i686-darwin8.6.1
47
+ sitearch = i686-darwin8.6.1
48
+ ruby_version = 1.8
49
+ ruby = /usr/local/bin/ruby
50
+ RUBY = $(ruby)
51
+ RM = rm -f
52
+ MAKEDIRS = mkdir -p
53
+ INSTALL = /usr/bin/install -c
54
+ INSTALL_PROG = $(INSTALL) -m 0755
55
+ INSTALL_DATA = $(INSTALL) -m 644
56
+ COPY = cp
57
+
58
+ #### End of system configuration section. ####
59
+
60
+ preload =
61
+
62
+ libpath = $(libdir)
63
+ LIBPATH = -L"$(libdir)"
64
+ DEFFILE =
65
+
66
+ CLEANFILES =
67
+ DISTCLEANFILES =
68
+
69
+ extout =
70
+ extout_prefix =
71
+ target_prefix =
72
+ LOCAL_LIBS =
73
+ LIBS = -lpthread -ldl -lobjc
74
+ SRCS = foo.c
75
+ OBJS = foo.o
76
+ TARGET = foo
77
+ DLLIB = $(TARGET).bundle
78
+ STATIC_LIB =
79
+
80
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
81
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
82
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
83
+
84
+ TARGET_SO = $(DLLIB)
85
+ CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
86
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
87
+
88
+ all: $(DLLIB)
89
+ static: $(STATIC_LIB)
90
+
91
+ clean:
92
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
93
+
94
+ distclean: clean
95
+ @-$(RM) Makefile extconf.h conftest.* mkmf.log
96
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
97
+
98
+ realclean: distclean
99
+ install: install-so install-rb
100
+
101
+ install-so: $(RUBYARCHDIR)
102
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
103
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
104
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
105
+ install-rb: pre-install-rb install-rb-default
106
+ install-rb-default: pre-install-rb-default
107
+ pre-install-rb: Makefile
108
+ pre-install-rb-default: Makefile
109
+ $(RUBYARCHDIR):
110
+ $(MAKEDIRS) $@
111
+
112
+ site-install: site-install-so site-install-rb
113
+ site-install-so: install-so
114
+ site-install-rb: install-rb
115
+
116
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
117
+
118
+ .cc.o:
119
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
120
+
121
+ .cxx.o:
122
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
123
+
124
+ .cpp.o:
125
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
126
+
127
+ .C.o:
128
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
129
+
130
+ .c.o:
131
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
132
+
133
+ $(DLLIB): $(OBJS)
134
+ @-$(RM) $@
135
+ $(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
136
+
137
+
138
+
139
+ $(OBJS): ruby.h defines.h
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+ create_makefile("foo")
3
+
@@ -0,0 +1 @@
1
+ will not compile
@@ -17,8 +17,8 @@ module Gem
17
17
  def self.configure(gem_pairs, options={})
18
18
  gem_pairs.each do |name, version|
19
19
  require 'rubygems'
20
- puts "Requiring gem #{name} (version #{version})" if options[:verbose]
21
- require_gem name, version
20
+ puts "Activating gem #{name} (version #{version})" if options[:verbose]
21
+ gem name, version
22
22
  end
23
23
  end
24
24
  end
@@ -49,16 +49,26 @@ module Kernel
49
49
  def gem(gem_name, *version_requirements)
50
50
  active_gem_with_options(gem_name, version_requirements)
51
51
  end
52
-
52
+
53
53
  # Same as the +gem+ command, but will also require a file if the gem
54
54
  # provides an auto-required file name.
55
55
  #
56
56
  # DEPRECATED! Use +gem+ instead.
57
57
  #
58
58
  def require_gem(gem_name, *version_requirements)
59
- active_gem_with_options(gem_name,
60
- version_requirements, :auto_require=>true)
59
+ file, lineno = location_of_caller
60
+ warn "#{file}:#{lineno}:Warning: require_gem is obsolete. Use gem instead."
61
+ active_gem_with_options(gem_name, version_requirements, :auto_require=>true)
62
+ end
63
+
64
+ # Return the file name (string) and line number (integer) of the caller of
65
+ # the caller of this method.
66
+ def location_of_caller
67
+ file, lineno = caller[1].split(':')
68
+ lineno = lineno.to_i
69
+ [file, lineno]
61
70
  end
71
+ private :location_of_caller
62
72
 
63
73
  def active_gem_with_options(gem_name, version_requirements, options={})
64
74
  skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
@@ -68,11 +78,13 @@ module Kernel
68
78
  private :active_gem_with_options
69
79
  end
70
80
 
71
-
72
81
  # Main module to hold all RubyGem classes/modules.
73
82
  #
74
83
  module Gem
75
84
  require 'rubygems/rubygems_version.rb'
85
+ require 'thread'
86
+
87
+ MUTEX = Mutex.new
76
88
 
77
89
  class Exception < RuntimeError
78
90
  end
@@ -85,8 +97,13 @@ module Gem
85
97
  DIRECTORIES = ['cache', 'doc', 'gems', 'specifications']
86
98
 
87
99
  @@source_index = nil
100
+
101
+ @configuration = nil
102
+ @loaded_specs = {}
88
103
 
89
104
  class << self
105
+
106
+ attr_reader :loaded_specs
90
107
 
91
108
  def manage_gems
92
109
  require 'rubygems/user_interaction'
@@ -122,6 +139,19 @@ module Gem
122
139
  @gem_home
123
140
  end
124
141
 
142
+ # The directory path where executables are to be installed.
143
+ #
144
+ def bindir(install_dir=Gem.dir)
145
+ return File.join(install_dir, 'bin') unless install_dir == Gem.default_dir
146
+
147
+ if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
148
+ File.join(File.dirname(Config::CONFIG["sitedir"]),
149
+ File.basename(Config::CONFIG["bindir"]))
150
+ else # generic install
151
+ Config::CONFIG['bindir']
152
+ end
153
+ end
154
+
125
155
  # List of directory paths to search for Gems.
126
156
  #
127
157
  # return:: [List<String>] List of directory paths.
@@ -144,7 +174,22 @@ module Gem
144
174
 
145
175
  # The standard configuration object for gems.
146
176
  def configuration
147
- @configuration ||= {}
177
+ return @configuration if @configuration
178
+
179
+ @configuration = {}
180
+ class << @configuration
181
+ undef_method :verbose # HACK RakeFileUtils pollution
182
+ end if @configuration.respond_to? :verbose
183
+
184
+ def @configuration.method_missing(sym, *args, &block)
185
+ if args.empty?
186
+ self[sym]
187
+ else
188
+ super
189
+ end
190
+ end
191
+
192
+ @configuration
148
193
  end
149
194
 
150
195
  # Use the given configuration object (which implements the
@@ -156,12 +201,18 @@ module Gem
156
201
  # Return the path the the data directory specified by the gem
157
202
  # name. If the package is not available as a gem, return nil.
158
203
  def datadir(gem_name)
159
- return nil if @loaded_specs.nil?
160
204
  spec = @loaded_specs[gem_name]
161
205
  return nil if spec.nil?
162
206
  File.join(spec.full_gem_path, 'data', gem_name)
163
207
  end
164
208
 
209
+ # Return the searcher object to search for matching gems.
210
+ def searcher
211
+ MUTEX.synchronize do
212
+ @searcher ||= Gem::GemPathSearcher.new
213
+ end
214
+ end
215
+
165
216
  # Return the Ruby command to use to execute the Ruby interpreter.
166
217
  def ruby
167
218
  "ruby"
@@ -176,7 +227,6 @@ module Gem
176
227
  # already loaded, or an exception otherwise.
177
228
  #
178
229
  def activate(gem, autorequire, *version_requirements)
179
- @loaded_specs ||= Hash.new
180
230
  unless version_requirements.size > 0
181
231
  version_requirements = [">= 0.0.0"]
182
232
  end
@@ -188,22 +238,22 @@ module Gem
188
238
  report_activate_error(gem) if matches.empty?
189
239
 
190
240
  if @loaded_specs[gem.name]
191
- # This gem is already loaded. If the currently loaded gem is
192
- # not in the list of candidate gems, then we have a version
193
- # conflict.
194
- existing_spec = @loaded_specs[gem.name]
195
- if ! matches.any? { |spec| spec.version == existing_spec.version }
196
- fail Gem::Exception, "can't activate #{gem}, already activated #{existing_spec.full_name}]"
197
- end
198
- return false
241
+ # This gem is already loaded. If the currently loaded gem is
242
+ # not in the list of candidate gems, then we have a version
243
+ # conflict.
244
+ existing_spec = @loaded_specs[gem.name]
245
+ if ! matches.any? { |spec| spec.version == existing_spec.version }
246
+ fail Gem::Exception, "can't activate #{gem}, already activated #{existing_spec.full_name}]"
247
+ end
248
+ return false
199
249
  end
200
250
 
201
251
  # new load
202
252
  spec = matches.last
203
253
  if spec.loaded?
204
- return false unless autorequire
205
- result = spec.autorequire ? require(spec.autorequire) : false
206
- return result || false
254
+ return false unless autorequire
255
+ result = spec.autorequire ? require(spec.autorequire) : false
256
+ return result || false
207
257
  end
208
258
 
209
259
  spec.loaded = true
@@ -211,17 +261,17 @@ module Gem
211
261
 
212
262
  # Load dependent gems first
213
263
  spec.dependencies.each do |dep_gem|
214
- activate(dep_gem, autorequire)
264
+ activate(dep_gem, autorequire)
215
265
  end
216
266
 
217
267
  # add bin dir to require_path
218
268
  if(spec.bindir) then
219
- spec.require_paths << spec.bindir
269
+ spec.require_paths << spec.bindir
220
270
  end
221
271
 
222
272
  # Now add the require_paths to the LOAD_PATH
223
273
  spec.require_paths.each do |path|
224
- $:.unshift File.join(spec.full_gem_path, path)
274
+ $:.unshift File.join(spec.full_gem_path, path)
225
275
  end
226
276
 
227
277
  if autorequire && spec.autorequire then
@@ -239,12 +289,12 @@ module Gem
239
289
  def report_activate_error(gem)
240
290
  matches = Gem.source_index.find_name(gem.name)
241
291
  if matches.size==0
242
- error = Gem::LoadError.new(
243
- "Could not find RubyGem #{gem.name} (#{gem.version_requirements})\n")
292
+ error = Gem::LoadError.new(
293
+ "Could not find RubyGem #{gem.name} (#{gem.version_requirements})\n")
244
294
  else
245
- error = Gem::LoadError.new(
246
- "RubyGem version error: " +
247
- "#{gem.name}(#{matches.first.version} not #{gem.version_requirements})\n")
295
+ error = Gem::LoadError.new(
296
+ "RubyGem version error: " +
297
+ "#{gem.name}(#{matches.first.version} not #{gem.version_requirements})\n")
248
298
  end
249
299
  error.name = gem.name
250
300
  error.version_requirement = gem.version_requirements
@@ -308,6 +358,13 @@ module Gem
308
358
  nil
309
359
  end
310
360
 
361
+ def suffixes
362
+ ['', '.rb', '.rbw', '.so', '.bundle', '.dll', '.sl', '.jar']
363
+ end
364
+
365
+ def suffix_pattern
366
+ @suffix_pattern ||= "{#{suffixes.join(',')}}"
367
+ end
311
368
 
312
369
  private
313
370
 
@@ -398,22 +455,6 @@ module Gem
398
455
  # Default home directory path to be used if an alternate value is
399
456
  # not specified in the environment.
400
457
  def default_dir
401
- ## rbconfig = Dir.glob("{#{($LOAD_PATH).join(',')}}/rbconfig.rb").first
402
- ## if rbconfig
403
- ## module_eval File.read(rbconfig) unless const_defined?("Config")
404
- ## else
405
- ## require 'rbconfig'
406
- ## end
407
- #
408
- # Note on above code: we have an issue if a Config class is
409
- # already defined and we load 'rbconfig'. The above code is
410
- # supposed to work around that but it's been commented out. In
411
- # any case, I moved "require 'rbconfig'" to the top of this
412
- # file, because there was a circular dependency between this
413
- # method and our custom require. In any case, rbconfig is a
414
- # fundamental RubyGems dependency, so it might as well be up the
415
- # top. -- Gavin Sinclair, 2004-12-12
416
- #
417
458
  if defined? RUBY_FRAMEWORK_VERSION
418
459
  return File.join(File.dirname(Config::CONFIG["sitedir"]), "Gems")
419
460
  else
@@ -429,7 +470,7 @@ module Gem
429
470
  def ensure_gem_subdirectories(gemdir)
430
471
  DIRECTORIES.each do |filename|
431
472
  fn = File.join(gemdir, filename)
432
- unless File.exists?(fn)
473
+ unless File.exist?(fn)
433
474
  require 'fileutils'
434
475
  FileUtils.mkdir_p(fn) rescue nil
435
476
  end
@@ -443,7 +484,7 @@ end
443
484
  # Modify the non-gem version of datadir to handle gem package names.
444
485
 
445
486
  require 'rbconfig/datadir'
446
- module Config
487
+ module Config # :nodoc:
447
488
  class << self
448
489
  alias gem_original_datadir datadir
449
490
 
@@ -457,11 +498,9 @@ module Config
457
498
  end
458
499
  end
459
500
 
460
-
461
501
  require 'rubygems/source_index'
462
502
  require 'rubygems/specification'
463
503
  require 'rubygems/security'
464
504
  require 'rubygems/version'
465
- #require 'rubygems/loadpath_manager' # custom_require replaces this
466
505
  require 'rubygems/custom_require'
467
506