rubygems-update 1.3.6 → 1.3.7

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 (80) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +86 -0
  3. data/History.txt +34 -1
  4. data/Manifest.txt +6 -1
  5. data/Rakefile +79 -34
  6. data/lib/rubygems.rb +52 -30
  7. data/lib/rubygems/builder.rb +2 -0
  8. data/lib/rubygems/command.rb +12 -0
  9. data/lib/rubygems/command_manager.rb +17 -12
  10. data/lib/rubygems/commands/contents_command.rb +1 -1
  11. data/lib/rubygems/commands/dependency_command.rb +3 -1
  12. data/lib/rubygems/commands/environment_command.rb +3 -2
  13. data/lib/rubygems/commands/fetch_command.rb +7 -3
  14. data/lib/rubygems/commands/install_command.rb +2 -1
  15. data/lib/rubygems/commands/query_command.rb +16 -3
  16. data/lib/rubygems/commands/server_command.rb +5 -3
  17. data/lib/rubygems/commands/setup_command.rb +1 -1
  18. data/lib/rubygems/commands/unpack_command.rb +35 -23
  19. data/lib/rubygems/commands/update_command.rb +1 -1
  20. data/lib/rubygems/defaults.rb +4 -6
  21. data/lib/rubygems/dependency.rb +32 -6
  22. data/lib/rubygems/dependency_installer.rb +10 -3
  23. data/lib/rubygems/doc_manager.rb +5 -2
  24. data/lib/rubygems/errors.rb +35 -0
  25. data/lib/rubygems/exceptions.rb +10 -1
  26. data/lib/rubygems/indexer.rb +1 -1
  27. data/lib/rubygems/installer.rb +6 -5
  28. data/lib/rubygems/package.rb +6 -3
  29. data/lib/rubygems/package/f_sync_dir.rb +4 -3
  30. data/lib/rubygems/package/tar_header.rb +4 -3
  31. data/lib/rubygems/package/tar_output.rb +4 -3
  32. data/lib/rubygems/package/tar_reader.rb +4 -3
  33. data/lib/rubygems/package/tar_writer.rb +4 -3
  34. data/lib/rubygems/package_task.rb +4 -3
  35. data/lib/rubygems/platform.rb +4 -1
  36. data/lib/rubygems/remote_fetcher.rb +9 -3
  37. data/lib/rubygems/requirement.rb +5 -0
  38. data/lib/rubygems/security.rb +3 -3
  39. data/lib/rubygems/server.rb +33 -18
  40. data/lib/rubygems/source_index.rb +4 -4
  41. data/lib/rubygems/source_info_cache.rb +4 -2
  42. data/lib/rubygems/spec_fetcher.rb +33 -11
  43. data/lib/rubygems/specification.rb +40 -32
  44. data/lib/rubygems/test_utilities.rb +2 -2
  45. data/lib/rubygems/validator.rb +3 -4
  46. data/lib/rubygems/version.rb +1 -1
  47. data/test/gem_package_tar_test_case.rb +2 -2
  48. data/test/gemutilities.rb +15 -9
  49. data/test/insure_session.rb +1 -1
  50. data/test/plugin/exception/rubygems_plugin.rb +2 -0
  51. data/test/plugin/load/rubygems_plugin.rb +1 -0
  52. data/test/plugin/standarderror/rubygems_plugin.rb +2 -0
  53. data/test/rubygems/commands/crash_command.rb +5 -0
  54. data/test/rubygems_plugin.rb +5 -0
  55. data/test/simple_gem.rb +15 -15
  56. data/test/test_gem.rb +45 -2
  57. data/test/test_gem_command_manager.rb +14 -0
  58. data/test/test_gem_commands_contents_command.rb +7 -5
  59. data/test/test_gem_commands_environment_command.rb +3 -1
  60. data/test/test_gem_commands_fetch_command.rb +21 -1
  61. data/test/test_gem_commands_install_command.rb +2 -4
  62. data/test/test_gem_commands_query_command.rb +33 -6
  63. data/test/test_gem_commands_server_command.rb +9 -2
  64. data/test/test_gem_commands_uninstall_command.rb +4 -2
  65. data/test/test_gem_commands_unpack_command.rb +46 -2
  66. data/test/test_gem_config_file.rb +2 -0
  67. data/test/test_gem_dependency.rb +11 -0
  68. data/test/test_gem_doc_manager.rb +1 -1
  69. data/test/test_gem_indexer.rb +2 -2
  70. data/test/test_gem_installer.rb +1 -1
  71. data/test/test_gem_package_tar_input.rb +1 -1
  72. data/test/test_gem_package_tar_writer.rb +3 -3
  73. data/test/test_gem_platform.rb +19 -0
  74. data/test/test_gem_server.rb +11 -0
  75. data/test/test_gem_source_index.rb +2 -2
  76. data/test/test_gem_spec_fetcher.rb +42 -0
  77. data/test/test_gem_specification.rb +46 -7
  78. data/util/{gem_prelude.rb.template → gem_prelude.rb} +53 -23
  79. metadata +16 -6
  80. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,5 +1,91 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ 2010-05-13 Eric Hodel <drbrain@segment7.net>
4
+
5
+ * lib/rubygems.rb: 1.3.7.
6
+
7
+ 2010-04-30 Eric Hodel <drbrain@segment7.net>
8
+
9
+ * lib/rubygems/server.rb: Use gem_dirs, not gem_dir.
10
+
11
+ 2010-04-21 Eric Hodel <drbrain@segment7.net>
12
+
13
+ * lib/rubygems.rb: 1.3.7.pre.1.
14
+ * lib/rubygems/commands/contents_command.rb: Make --prefix the
15
+ default as specified in --help. Bug #27211 by Mamoru Tasaka.
16
+ * lib/rubygems/commands/environment_command.rb: Hide gemcutter_key to
17
+ for security.
18
+ * lib/rubygems/commands/server_command.rb: Allow specification of
19
+ multiple gem dirs. Bug #27573 by Yuki Sonoda.
20
+ * lib/rubygems.rb: Require rubygems/custom_require if --disable-gem
21
+ was set. Bug #27700 by Roger Pack.
22
+
23
+ 2010-04-21 Evan Phoenix <evan@fallingsnow.net>
24
+
25
+ * lib, test: Add ability to install and fetch to report that the
26
+ reason they couldn't find a gem was because all available gems can't
27
+ be used on the current platform.
28
+
29
+ 2010-04-20 Eric Hodel <drbrain@segment7.net>
30
+
31
+ * lib/rubygems/specification.rb: Avoid deprecated API for YAML. Ruby
32
+ bug #3102 by Aaron Patterson.
33
+ * lib/rubygems/remote_fetcher.rb: Avoid deprecated API for URI. Ruby
34
+ bug #3103 by Aaron Patterson.
35
+ * lib/rubygems/platform.rb: Add platform support for IronRuby. Patch
36
+ #27951 by Will Green.
37
+ * lib/rubygems/commands/fetch_command.rb: Restore fetching of old
38
+ versions. Bug #27960 by Eric Hankins.
39
+ * lib/rubygems/command_manager.rb: Update documentation. Bug #28024
40
+ by Roger Pack.
41
+ * lib/rubygems/remote_fetcher.rb: Raise a better error when the host
42
+ is down. Bug #28092 by Eric Peterson.
43
+ * History.txt: Add reminder to include --user-install change in the
44
+ 1.3.7 release notes. Bug #27896 by Matt Patterson.
45
+ * lib/rubygems/commands/query_command.rb: --version is only for use
46
+ with --installed. Bug #27857 by Greg Hazel.
47
+ * lib/rubygems/commands/query_command.rb: Regular output now lists
48
+ platforms. Bug #27856 by Greg Hazel.
49
+
50
+ 2010-04-19 Eric Hodel <drbrain@segment7.net>
51
+
52
+ * lib, test: Stop using Gem::RubyGemsVersion
53
+
54
+ 2010-04-14 James Tucker <jftucker@gmail.com>
55
+
56
+ * lib/rubygems/command_manager.rb: Now catches errors caused by command
57
+ loading. (Protect against broken plugins)
58
+ * lib/rubygems.rb: Introduce and use Gem.load_plugins, RubyGems now
59
+ protects against exceptions being raised by plugins.
60
+
61
+ 2010-03-25 Eric Hodel <drbrain@segment7.net>
62
+
63
+ * lib/rubygems/builder.rb: Now requires user_interaction. Ruby
64
+ Bug #1040 by Phillip Toland.
65
+ * lib/rubygems/installer.rb: Make argument order match for
66
+ generate_windows_script. Ruby patch #825 by okkez.
67
+ * lib/rubygems/package_task.rb: Depend on the package dir like the
68
+ other package tasks.
69
+
70
+ 2010-03-08 James Tucker <jftucker@gmail.com>
71
+
72
+ * lib/rubygems/remote_fetcher.rb: fetcher now retries on a read timeout.
73
+ * lib/rubygems/specification.rb: specifications loaded from file are now
74
+ evaluated with their filename to aid debugging.
75
+
76
+ 2010-02-24 Eric Hodel <drbrain@segment7.net>
77
+
78
+ * lib/rubygems/commands/unpack_command.rb: `gem unpack` now unpacks
79
+ remote gems.
80
+
81
+ 2010-02-23 Eric Hodel <drbrain@segment7.net>
82
+
83
+ * lib/rubygems/dependency.rb: Support #version_requirements= with a
84
+ warning. Bug #27868 by Wei Jen Lu.
85
+ * lib/rubygems/installer.rb: Fix `gem unpack`. Bug #27872 by Timothy
86
+ Jones.
87
+ * lib, test: Import changes from ruby trunk.
88
+
3
89
  2010-02-20 Eric Hodel <drbrain@segment7.net>
4
90
 
5
91
  * lib/rubygems.rb: 1.3.6.
data/History.txt CHANGED
@@ -1,4 +1,4 @@
1
- === 1.3.6 / 2010-02-17
1
+ === 1.3.7 / 2010-05-13
2
2
 
3
3
  NOTE:
4
4
 
@@ -11,6 +11,39 @@ http://gems.rubyforge.org will continue to work for the forseeable future.
11
11
 
12
12
  New features:
13
13
 
14
+ * `gem` commands
15
+ * `gem install` and `gem fetch` now report alternate platforms when a
16
+ matching one couldn't be found.
17
+ * `gem contents` --prefix is now the default as specified in --help. Bug
18
+ #27211 by Mamoru Tasaka.
19
+ * `gem fetch` can fetch of old versions again. Bug #27960 by Eric Hankins.
20
+ * `gem query` and friends output now lists platforms. Bug #27856 by Greg
21
+ Hazel.
22
+ * `gem server` now allows specification of multiple gem dirs for
23
+ documentation. Bug #27573 by Yuki Sonoda.
24
+ * `gem unpack` can unpack gems again. Bug #27872 by Timothy Jones.
25
+ * `gem unpack` now unpacks remote gems.
26
+ * --user-install is no longer the default. If you really liked it, see
27
+ Gem::ConfigFile to learn how to set it by default. (This change was made
28
+ in 1.3.6)
29
+ * RubyGems now has platform support for IronRuby. Patch #27951 by Will Green.
30
+
31
+ Bug fixes:
32
+
33
+ * Require rubygems/custom_require if --disable-gem was set. Bug #27700 by
34
+ Roger Pack.
35
+ * RubyGems now protects against exceptions being raised by plugins.
36
+ * rubygems/builder now requires user_interaction. Ruby Bug #1040 by Phillip
37
+ Toland.
38
+ * Gem::Dependency support #version_requirements= with a warning. Fix for old
39
+ Rails versions. Bug #27868 by Wei Jen Lu.
40
+ * Gem::PackageTask depends on the package dir like the other rake package
41
+ tasks so dependencies can be hooked up correctly.
42
+
43
+ === 1.3.6 / 2010-02-17
44
+
45
+ New features:
46
+
14
47
  * `gem` commands
15
48
  * Added `gem push` and `gem owner` for interacting with modern/Gemcutter
16
49
  sources
data/Manifest.txt CHANGED
@@ -54,6 +54,7 @@ lib/rubygems/dependency.rb
54
54
  lib/rubygems/dependency_installer.rb
55
55
  lib/rubygems/dependency_list.rb
56
56
  lib/rubygems/doc_manager.rb
57
+ lib/rubygems/errors.rb
57
58
  lib/rubygems/exceptions.rb
58
59
  lib/rubygems/ext.rb
59
60
  lib/rubygems/ext/builder.rb
@@ -112,8 +113,12 @@ test/gem_package_tar_test_case.rb
112
113
  test/gemutilities.rb
113
114
  test/insure_session.rb
114
115
  test/mockgemui.rb
116
+ test/plugin/exception/rubygems_plugin.rb
117
+ test/plugin/load/rubygems_plugin.rb
118
+ test/plugin/standarderror/rubygems_plugin.rb
115
119
  test/private_key.pem
116
120
  test/public_cert.pem
121
+ test/rubygems/commands/crash_command.rb
117
122
  test/rubygems_plugin.rb
118
123
  test/simple_gem.rb
119
124
  test/test_config.rb
@@ -183,4 +188,4 @@ test/test_gem_version.rb
183
188
  test/test_gem_version_option.rb
184
189
  test/test_kernel.rb
185
190
  util/CL2notes
186
- util/gem_prelude.rb.template
191
+ util/gem_prelude.rb
data/Rakefile CHANGED
@@ -27,9 +27,9 @@ hoe = Hoe.spec 'rubygems-update' do
27
27
  'data__',
28
28
  'html',
29
29
  'logs',
30
+ 'graph.dot',
30
31
  'pkgs/sources/sources*.gem',
31
- 'scripts/*.hieraki',
32
- 'util/gem_prelude.rb')
32
+ 'scripts/*.hieraki')
33
33
 
34
34
  extra_dev_deps << ['builder', '~> 2.1']
35
35
  extra_dev_deps << ['hoe-seattlerb', '~> 1.2']
@@ -64,10 +64,18 @@ task :scrub_dev_deps do
64
64
  hoe.spec.dependencies.reject! { |d| :development == d.type }
65
65
  end
66
66
 
67
- task :release => [:clobber, :sanity_check, :test_functional,
68
- :test, :package, :tag]
67
+ task :prerelease => [:clobber, :sanity_check, :test, :test_functional]
69
68
 
70
- Rake::Task[:release_to_rubyforge].clear
69
+ task :postrelease => [:tag, :publish_docs]
70
+
71
+ Rake::Task[:release_to_rubyforge].clear_actions
72
+
73
+ task :release_to_rubyforge do
74
+ files = Dir["pkg/rubygems-update*.gem"]
75
+ rf = RubyForge.new.configure
76
+ rf.login
77
+ rf.add_file hoe.rubyforge_name, hoe.rubyforge_name, hoe.version, files.first
78
+ end
71
79
 
72
80
  pkg_dir_path = "pkg/rubygems-update-#{hoe.version}"
73
81
  task pkg_dir_path do
@@ -85,38 +93,50 @@ task :sanity_check do
85
93
  abort "svn status dirty. commit or revert them" unless `svn st`.empty?
86
94
  end
87
95
 
88
- task :tag => [:sanity_check] do
89
- reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
96
+ task :tag => :sanity_check do
97
+ reltag = "REL_#{Gem::VERSION.gsub(/\./, '_')}"
90
98
  svn_url = "svn+ssh://rubyforge.org/var/svn/rubygems"
91
99
  sh %{svn copy #{svn_url}/trunk #{svn_url}/tags/#{reltag}}
92
100
  end
93
101
 
94
102
  # Misc Tasks ---------------------------------------------------------
95
103
 
96
- desc "build util/gem_prelude.rb from the template and defaults.rb"
97
- file 'util/gem_prelude.rb' =>
98
- %w[util/gem_prelude.rb.template lib/rubygems/defaults.rb Rakefile] do
99
- gem_prelude = File.read 'util/gem_prelude.rb.template'
100
- defaults = File.read 'lib/rubygems/defaults.rb'
101
-
102
- raise 'template error' unless defaults.sub!(/^module Gem\n/, '')
103
- raise 'template error' unless defaults.sub!(/^end\n/, '')
104
+ # Git mirror support. You probably don't need to care about
105
+ # these. Don't run 'em unless you have a John-style git-svn setup
106
+ # pointed at a valid, pushable Git remote called "origin".
104
107
 
105
- defaults[0, 0] = " # begin rubygems/defaults\n"
106
- defaults << " # end rubygems/defaults\n"
107
- defaults.gsub!(/^/, ' ')
108
-
109
- raise 'template error' unless
110
- gem_prelude.sub!(/^# WARN\n/,
111
- "# THIS FILE WAS AUTOGENERATED, DO NOT EDIT\n")
112
- raise 'template error' unless
113
- gem_prelude.sub!(/^ # INCLUDE rubygems\/defaults\n/, defaults)
114
-
115
- rm_f 'util/gem_prelude.rb'
108
+ namespace :git do
109
+ namespace :svn do
110
+ task(:fetch) { sh "git svn fetch" }
111
+ end
116
112
 
117
- open 'util/gem_prelude.rb', 'w' do |io|
118
- io.write gem_prelude
119
- io.chmod 0444
113
+ task :sync => %w(svn:fetch sync:branches sync:tags)
114
+
115
+ namespace :sync do
116
+ task :branches do
117
+ {
118
+ "trunk" => "master",
119
+ }.each do |svn, git|
120
+ sh "git push origin svn/#{svn}:#{git}"
121
+ end
122
+ end
123
+
124
+ task :tags do
125
+ old = `git tag`
126
+ tags = `git for-each-ref refs/remotes/svn/tags`.split "\n"
127
+ tagged = false
128
+
129
+ tags.each do |tag|
130
+ next unless /(REL_.*)$/ =~ tag
131
+ name, sha, _, sym = $1, *tag.split(/\s/)
132
+
133
+ next if /#{name}/ =~ old
134
+ sh "git tag -f '#{name}' #{sha}"
135
+ tagged = true
136
+ end
137
+
138
+ sh "git push --tags" if tagged
139
+ end
120
140
  end
121
141
  end
122
142
 
@@ -131,7 +151,7 @@ end
131
151
 
132
152
  def rsync_with dir
133
153
  rsync_options = "-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc'" +
134
- "--exclude '*.rej' --exclude '*.orig' --exclude 'lib/rubygems/defaults/*'"
154
+ " --exclude '*.rej' --exclude '*.orig' --exclude 'lib/rubygems/defaults/*'"
135
155
  sh "rsync #{rsync_options} bin/gem #{dir}/bin/gem"
136
156
  sh "rsync #{rsync_options} lib/ #{dir}/lib"
137
157
  sh "rsync #{rsync_options} test/ #{dir}/test/rubygems"
@@ -153,22 +173,22 @@ rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code'
153
173
  ruby_dir = ENV['RUBY_PATH'] || '../../ruby/trunk'
154
174
 
155
175
  desc "Updates Ruby HEAD with the currently checked-out copy of RubyGems."
156
- task :update_ruby => 'util/gem_prelude.rb' do
176
+ task :update_ruby do
157
177
  rsync_with ruby_dir
158
178
  end
159
179
 
160
180
  desc "Updates Rubinius HEAD with the currently checked-out copy of RubyGems."
161
- task :update_rubinius => 'util/gem_prelude.rb' do
181
+ task :update_rubinius do
162
182
  rsync_with rubinius_dir
163
183
  end
164
184
 
165
185
  desc "Diffs Ruby HEAD with the currently checked-out copy of RubyGems."
166
- task :diff_ruby => 'util/gem_prelude.rb' do
186
+ task :diff_ruby do
167
187
  diff_with ruby_dir
168
188
  end
169
189
 
170
190
  desc "Diffs Rubinius HEAD with the currently checked-out copy of RubyGems."
171
- task :diff_rubinius => 'util/gem_prelude.rb' do
191
+ task :diff_rubinius do
172
192
  diff_with rubinius_dir
173
193
  end
174
194
 
@@ -193,3 +213,28 @@ task "rcov:for", [:test] do |task, args|
193
213
 
194
214
  ruby "#{flags.join ' '} #{rcov} #{rflags.join ' '} #{args[:test]}"
195
215
  end
216
+
217
+ task :graph do
218
+ $: << File.expand_path("~/Work/p4/zss/src/graph/dev/lib")
219
+ require 'graph'
220
+ deps = Graph.new
221
+ deps.rotate
222
+
223
+ current = nil
224
+ `rake -P -s`.each_line do |line|
225
+ case line
226
+ when /^rake (.+)/
227
+ current = $1
228
+ deps[current] if current # force the node to exist, in case of a leaf
229
+ when /^\s+(.+)/
230
+ deps[current] << $1 if current
231
+ else
232
+ warn "unparsed: #{line.chomp}"
233
+ end
234
+ end
235
+
236
+
237
+ deps.boxes
238
+ deps.save "graph", nil
239
+ end
240
+
data/lib/rubygems.rb CHANGED
@@ -5,6 +5,8 @@
5
5
  # See LICENSE.txt for permissions.
6
6
  #++
7
7
 
8
+ gem_disabled = !defined? Gem
9
+
8
10
  require 'rubygems/defaults'
9
11
  require 'thread'
10
12
  require 'etc'
@@ -98,7 +100,7 @@ require 'etc'
98
100
  # -The RubyGems Team
99
101
 
100
102
  module Gem
101
- RubyGemsVersion = VERSION = '1.3.6'
103
+ RubyGemsVersion = VERSION = '1.3.7'
102
104
 
103
105
  ##
104
106
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -129,6 +131,7 @@ module Gem
129
131
  :libdir => RbConfig::CONFIG["libdir"],
130
132
  :ruby_install_name => RbConfig::CONFIG["ruby_install_name"],
131
133
  :ruby_version => RbConfig::CONFIG["ruby_version"],
134
+ :rubylibprefix => RbConfig::CONFIG["rubylibprefix"],
132
135
  :sitedir => RbConfig::CONFIG["sitedir"],
133
136
  :sitelibdir => RbConfig::CONFIG["sitelibdir"],
134
137
  :vendordir => RbConfig::CONFIG["vendordir"] ,
@@ -143,7 +146,7 @@ module Gem
143
146
  # :stopdoc:
144
147
  MUTEX = Mutex.new
145
148
 
146
- RubyGemsPackageVersion = RubyGemsVersion
149
+ RubyGemsPackageVersion = VERSION
147
150
  # :startdoc:
148
151
 
149
152
  ##
@@ -253,8 +256,6 @@ module Gem
253
256
  File.join spec.full_gem_path, path
254
257
  end
255
258
 
256
- sitelibdir = ConfigMap[:sitelibdir]
257
-
258
259
  # gem directories must come after -I and ENV['RUBYLIB']
259
260
  insert_index = load_path_insert_index
260
261
 
@@ -311,8 +312,8 @@ module Gem
311
312
  ##
312
313
  # Find the full path to the executable for gem +name+. If the +exec_name+
313
314
  # is not given, the gem's default_executable is chosen, otherwise the
314
- # specifed executable's path is returned. +version_requirements+ allows you
315
- # to specify specific gem versions.
315
+ # specified executable's path is returned. +version_requirements+ allows
316
+ # you to specify specific gem versions.
316
317
 
317
318
  def self.bin_path(name, exec_name = nil, *version_requirements)
318
319
  version_requirements = Gem::Requirement.default if
@@ -341,7 +342,7 @@ module Gem
341
342
  # The mode needed to read a file as straight binary.
342
343
 
343
344
  def self.binary_mode
344
- @binary_mode ||= RUBY_VERSION > '1.9' ? 'rb:ascii-8bit' : 'rb'
345
+ 'rb'
345
346
  end
346
347
 
347
348
  ##
@@ -699,14 +700,15 @@ module Gem
699
700
  # The directory prefix this RubyGems was installed at.
700
701
 
701
702
  def self.prefix
702
- prefix = File.dirname File.expand_path(__FILE__)
703
+ dir = File.dirname File.expand_path(__FILE__)
704
+ prefix = File.dirname dir
703
705
 
704
- if File.dirname(prefix) == File.expand_path(ConfigMap[:sitelibdir]) or
705
- File.dirname(prefix) == File.expand_path(ConfigMap[:libdir]) or
706
- 'lib' != File.basename(prefix) then
706
+ if prefix == File.expand_path(ConfigMap[:sitelibdir]) or
707
+ prefix == File.expand_path(ConfigMap[:libdir]) or
708
+ 'lib' != File.basename(dir) then
707
709
  nil
708
710
  else
709
- File.dirname prefix
711
+ prefix
710
712
  end
711
713
  end
712
714
 
@@ -974,6 +976,28 @@ module Gem
974
976
  @@win_platform
975
977
  end
976
978
 
979
+ ##
980
+ # Find all 'rubygems_plugin' files and load them
981
+
982
+ def self.load_plugins
983
+ plugins = Gem.find_files 'rubygems_plugin'
984
+
985
+ plugins.each do |plugin|
986
+
987
+ # Skip older versions of the GemCutter plugin: Its commands are in
988
+ # RubyGems proper now.
989
+
990
+ next if plugin =~ /gemcutter-0\.[0-3]/
991
+
992
+ begin
993
+ load plugin
994
+ rescue ::Exception => e
995
+ details = "#{plugin.inspect}: #{e.message} (#{e.class})"
996
+ warn "Error loading RubyGems plugin #{details}"
997
+ end
998
+ end
999
+ end
1000
+
977
1001
  class << self
978
1002
 
979
1003
  ##
@@ -1024,6 +1048,8 @@ end
1024
1048
 
1025
1049
  module Kernel
1026
1050
 
1051
+ undef gem if respond_to? :gem # defined in gem_prelude.rb on 1.9
1052
+
1027
1053
  ##
1028
1054
  # Use Kernel#gem to activate a specific version of +gem_name+.
1029
1055
  #
@@ -1081,12 +1107,18 @@ require 'rubygems/platform'
1081
1107
  require 'rubygems/builder' # HACK: Needed for rake's package task.
1082
1108
 
1083
1109
  begin
1110
+ ##
1111
+ # Defaults the operating system (or packager) wants to provide for RubyGems.
1112
+
1084
1113
  require 'rubygems/defaults/operating_system'
1085
1114
  rescue LoadError
1086
1115
  end
1087
1116
 
1088
1117
  if defined?(RUBY_ENGINE) then
1089
1118
  begin
1119
+ ##
1120
+ # Defaults the ruby implementation wants to provide for RubyGems
1121
+
1090
1122
  require "rubygems/defaults/#{RUBY_ENGINE}"
1091
1123
  rescue LoadError
1092
1124
  end
@@ -1094,25 +1126,15 @@ end
1094
1126
 
1095
1127
  require 'rubygems/config_file'
1096
1128
 
1097
- if RUBY_VERSION < '1.9' then
1098
- require 'rubygems/custom_require'
1099
- end
1100
-
1101
- Gem.clear_paths
1102
-
1103
- plugins = Gem.find_files 'rubygems_plugin'
1104
-
1105
- plugins.each do |plugin|
1129
+ ##
1130
+ # Enables the require hook for RubyGems.
1131
+ #
1132
+ # Ruby 1.9 allows --disable-gems, so we require it when we didn't detect a Gem
1133
+ # constant at rubygems.rb load time.
1106
1134
 
1107
- # Skip older versions of the GemCutter plugin: Its commands are in
1108
- # RubyGems proper now.
1135
+ require 'rubygems/custom_require' if gem_disabled or RUBY_VERSION < '1.9'
1109
1136
 
1110
- next if plugin =~ /gemcutter-0\.[0-3]/
1137
+ Gem.clear_paths
1111
1138
 
1112
- begin
1113
- load plugin
1114
- rescue => e
1115
- warn "error loading #{plugin.inspect}: #{e.message} (#{e.class})"
1116
- end
1117
- end
1139
+ Gem.load_plugins
1118
1140