rubygems-update 1.4.2 → 1.5.0

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 (150) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +4 -5
  3. data/{test/foo/discover.rb → .gemtest} +0 -0
  4. data/ChangeLog +13 -0
  5. data/History.txt +35 -1
  6. data/Manifest.txt +89 -88
  7. data/README.rdoc +21 -10
  8. data/Rakefile +31 -17
  9. data/UPGRADING.rdoc +81 -0
  10. data/ci_build.sh +27 -0
  11. data/cruise_config.rb +20 -13
  12. data/lib/rbconfig/datadir.rb +1 -1
  13. data/lib/rubygems.rb +102 -45
  14. data/lib/rubygems/builder.rb +5 -11
  15. data/lib/rubygems/command_manager.rb +0 -1
  16. data/lib/rubygems/commands/check_command.rb +2 -17
  17. data/lib/rubygems/commands/cleanup_command.rb +1 -1
  18. data/lib/rubygems/commands/dependency_command.rb +5 -18
  19. data/lib/rubygems/commands/environment_command.rb +5 -4
  20. data/lib/rubygems/commands/fetch_command.rb +0 -1
  21. data/lib/rubygems/commands/generate_index_command.rb +1 -10
  22. data/lib/rubygems/commands/help_command.rb +0 -5
  23. data/lib/rubygems/commands/query_command.rb +4 -24
  24. data/lib/rubygems/commands/setup_command.rb +4 -19
  25. data/lib/rubygems/commands/sources_command.rb +15 -37
  26. data/lib/rubygems/commands/specification_command.rb +1 -2
  27. data/lib/rubygems/commands/unpack_command.rb +19 -7
  28. data/lib/rubygems/commands/update_command.rb +29 -44
  29. data/lib/rubygems/config_file.rb +25 -19
  30. data/lib/rubygems/custom_require.rb +4 -6
  31. data/lib/rubygems/dependency.rb +1 -43
  32. data/lib/rubygems/dependency_installer.rb +1 -1
  33. data/lib/rubygems/doc_manager.rb +3 -1
  34. data/lib/rubygems/ext/builder.rb +3 -1
  35. data/lib/rubygems/ext/rake_builder.rb +10 -2
  36. data/lib/rubygems/format.rb +7 -4
  37. data/lib/rubygems/gem_runner.rb +1 -1
  38. data/lib/rubygems/indexer.rb +11 -74
  39. data/lib/rubygems/install_update_options.rb +13 -8
  40. data/lib/rubygems/installer.rb +139 -95
  41. data/{test/gem_installer_test_case.rb → lib/rubygems/installer_test_case.rb} +41 -2
  42. data/{test/mockgemui.rb → lib/rubygems/mock_gem_ui.rb} +8 -1
  43. data/lib/rubygems/old_format.rb +2 -1
  44. data/lib/rubygems/package.rb +17 -2
  45. data/lib/rubygems/package/tar_input.rb +7 -3
  46. data/lib/rubygems/package/tar_output.rb +2 -0
  47. data/lib/rubygems/package/tar_reader/entry.rb +4 -0
  48. data/{test/gem_package_tar_test_case.rb → lib/rubygems/package/tar_test_case.rb} +5 -2
  49. data/lib/rubygems/package_task.rb +6 -4
  50. data/lib/rubygems/remote_fetcher.rb +10 -2
  51. data/lib/rubygems/require_paths_builder.rb +2 -1
  52. data/lib/rubygems/server.rb +3 -44
  53. data/lib/rubygems/source_index.rb +3 -216
  54. data/lib/rubygems/spec_fetcher.rb +15 -63
  55. data/lib/rubygems/specification.rb +1 -1
  56. data/{test/gemutilities.rb → lib/rubygems/test_case.rb} +219 -90
  57. data/lib/rubygems/test_utilities.rb +7 -20
  58. data/lib/rubygems/uninstaller.rb +27 -28
  59. data/lib/rubygems/user_interaction.rb +81 -42
  60. data/lib/rubygems/validator.rb +0 -73
  61. data/test/{bogussources.rb → rubygems/bogussources.rb} +0 -0
  62. data/test/{data → rubygems/data}/gem-private_key.pem +0 -0
  63. data/test/{data → rubygems/data}/gem-public_cert.pem +0 -0
  64. data/test/{fake_certlib → rubygems/fake_certlib}/openssl.rb +0 -0
  65. data/test/rubygems/foo/discover.rb +0 -0
  66. data/test/{functional.rb → rubygems/functional.rb} +0 -0
  67. data/test/{insure_session.rb → rubygems/insure_session.rb} +0 -0
  68. data/test/{plugin → rubygems/plugin}/exception/rubygems_plugin.rb +0 -0
  69. data/test/{plugin → rubygems/plugin}/load/rubygems_plugin.rb +0 -0
  70. data/test/{plugin → rubygems/plugin}/standarderror/rubygems_plugin.rb +0 -0
  71. data/test/{private_key.pem → rubygems/private_key.pem} +0 -0
  72. data/test/{public_cert.pem → rubygems/public_cert.pem} +0 -0
  73. data/test/rubygems/{commands → rubygems/commands}/crash_command.rb +0 -0
  74. data/test/{rubygems_plugin.rb → rubygems/rubygems_plugin.rb} +0 -0
  75. data/test/rubygems/sff/discover.rb +0 -0
  76. data/test/{simple_gem.rb → rubygems/simple_gem.rb} +2 -2
  77. data/test/{test_config.rb → rubygems/test_config.rb} +2 -2
  78. data/test/{test_gem.rb → rubygems/test_gem.rb} +12 -2
  79. data/test/{test_gem_builder.rb → rubygems/test_gem_builder.rb} +2 -2
  80. data/test/{test_gem_command.rb → rubygems/test_gem_command.rb} +3 -3
  81. data/test/{test_gem_command_manager.rb → rubygems/test_gem_command_manager.rb} +15 -6
  82. data/test/{test_gem_commands_build_command.rb → rubygems/test_gem_commands_build_command.rb} +2 -2
  83. data/test/{test_gem_commands_cert_command.rb → rubygems/test_gem_commands_cert_command.rb} +2 -2
  84. data/test/{test_gem_commands_check_command.rb → rubygems/test_gem_commands_check_command.rb} +2 -2
  85. data/test/{test_gem_commands_contents_command.rb → rubygems/test_gem_commands_contents_command.rb} +3 -3
  86. data/test/{test_gem_commands_dependency_command.rb → rubygems/test_gem_commands_dependency_command.rb} +4 -4
  87. data/test/{test_gem_commands_environment_command.rb → rubygems/test_gem_commands_environment_command.rb} +12 -3
  88. data/test/{test_gem_commands_fetch_command.rb → rubygems/test_gem_commands_fetch_command.rb} +2 -2
  89. data/test/{test_gem_commands_generate_index_command.rb → rubygems/test_gem_commands_generate_index_command.rb} +7 -11
  90. data/test/{test_gem_commands_install_command.rb → rubygems/test_gem_commands_install_command.rb} +2 -2
  91. data/test/{test_gem_commands_list_command.rb → rubygems/test_gem_commands_list_command.rb} +2 -2
  92. data/test/{test_gem_commands_lock_command.rb → rubygems/test_gem_commands_lock_command.rb} +2 -2
  93. data/test/{test_gem_commands_outdated_command.rb → rubygems/test_gem_commands_outdated_command.rb} +2 -2
  94. data/test/{test_gem_commands_owner_command.rb → rubygems/test_gem_commands_owner_command.rb} +5 -5
  95. data/test/{test_gem_commands_pristine_command.rb → rubygems/test_gem_commands_pristine_command.rb} +2 -2
  96. data/test/{test_gem_commands_push_command.rb → rubygems/test_gem_commands_push_command.rb} +3 -3
  97. data/test/{test_gem_commands_query_command.rb → rubygems/test_gem_commands_query_command.rb} +2 -2
  98. data/test/{test_gem_commands_server_command.rb → rubygems/test_gem_commands_server_command.rb} +2 -2
  99. data/test/{test_gem_commands_sources_command.rb → rubygems/test_gem_commands_sources_command.rb} +8 -8
  100. data/test/{test_gem_commands_specification_command.rb → rubygems/test_gem_commands_specification_command.rb} +3 -3
  101. data/test/{test_gem_commands_stale_command.rb → rubygems/test_gem_commands_stale_command.rb} +2 -2
  102. data/test/{test_gem_commands_uninstall_command.rb → rubygems/test_gem_commands_uninstall_command.rb} +16 -10
  103. data/test/{test_gem_commands_unpack_command.rb → rubygems/test_gem_commands_unpack_command.rb} +42 -2
  104. data/test/{test_gem_commands_update_command.rb → rubygems/test_gem_commands_update_command.rb} +2 -2
  105. data/test/{test_gem_commands_which_command.rb → rubygems/test_gem_commands_which_command.rb} +3 -3
  106. data/test/{test_gem_config_file.rb → rubygems/test_gem_config_file.rb} +2 -2
  107. data/test/{test_gem_dependency.rb → rubygems/test_gem_dependency.rb} +3 -27
  108. data/test/{test_gem_dependency_installer.rb → rubygems/test_gem_dependency_installer.rb} +2 -2
  109. data/test/{test_gem_dependency_list.rb → rubygems/test_gem_dependency_list.rb} +3 -3
  110. data/test/{test_gem_doc_manager.rb → rubygems/test_gem_doc_manager.rb} +2 -2
  111. data/test/{test_gem_ext_configure_builder.rb → rubygems/test_gem_ext_configure_builder.rb} +4 -4
  112. data/test/{test_gem_ext_ext_conf_builder.rb → rubygems/test_gem_ext_ext_conf_builder.rb} +46 -2
  113. data/test/{test_gem_ext_rake_builder.rb → rubygems/test_gem_ext_rake_builder.rb} +2 -2
  114. data/test/{test_gem_format.rb → rubygems/test_gem_format.rb} +24 -6
  115. data/test/{test_gem_gem_path_searcher.rb → rubygems/test_gem_gem_path_searcher.rb} +2 -2
  116. data/test/{test_gem_gem_runner.rb → rubygems/test_gem_gem_runner.rb} +2 -2
  117. data/test/{test_gem_gemcutter_utilities.rb → rubygems/test_gem_gemcutter_utilities.rb} +4 -4
  118. data/test/{test_gem_indexer.rb → rubygems/test_gem_indexer.rb} +4 -121
  119. data/test/{test_gem_install_update_options.rb → rubygems/test_gem_install_update_options.rb} +3 -3
  120. data/test/{test_gem_installer.rb → rubygems/test_gem_installer.rb} +106 -13
  121. data/test/{test_gem_local_remote_options.rb → rubygems/test_gem_local_remote_options.rb} +2 -2
  122. data/test/{test_gem_package_tar_header.rb → rubygems/test_gem_package_tar_header.rb} +2 -2
  123. data/test/{test_gem_package_tar_input.rb → rubygems/test_gem_package_tar_input.rb} +21 -4
  124. data/test/{test_gem_package_tar_output.rb → rubygems/test_gem_package_tar_output.rb} +2 -2
  125. data/test/{test_gem_package_tar_reader.rb → rubygems/test_gem_package_tar_reader.rb} +2 -2
  126. data/test/{test_gem_package_tar_reader_entry.rb → rubygems/test_gem_package_tar_reader_entry.rb} +12 -2
  127. data/test/{test_gem_package_tar_writer.rb → rubygems/test_gem_package_tar_writer.rb} +2 -2
  128. data/test/{test_gem_package_task.rb → rubygems/test_gem_package_task.rb} +15 -2
  129. data/test/{test_gem_platform.rb → rubygems/test_gem_platform.rb} +2 -2
  130. data/test/{test_gem_remote_fetcher.rb → rubygems/test_gem_remote_fetcher.rb} +7 -7
  131. data/test/{test_gem_requirement.rb → rubygems/test_gem_requirement.rb} +2 -2
  132. data/test/{test_gem_security.rb → rubygems/test_gem_security.rb} +3 -4
  133. data/test/{test_gem_server.rb → rubygems/test_gem_server.rb} +2 -132
  134. data/test/rubygems/test_gem_silent_ui.rb +113 -0
  135. data/test/{test_gem_source_index.rb → rubygems/test_gem_source_index.rb} +2 -61
  136. data/test/{test_gem_spec_fetcher.rb → rubygems/test_gem_spec_fetcher.rb} +2 -2
  137. data/test/{test_gem_specification.rb → rubygems/test_gem_specification.rb} +4 -4
  138. data/test/{test_gem_stream_ui.rb → rubygems/test_gem_stream_ui.rb} +24 -2
  139. data/test/{test_gem_text.rb → rubygems/test_gem_text.rb} +2 -2
  140. data/test/{test_gem_uninstaller.rb → rubygems/test_gem_uninstaller.rb} +15 -12
  141. data/test/{test_gem_validator.rb → rubygems/test_gem_validator.rb} +3 -3
  142. data/test/{test_gem_version.rb → rubygems/test_gem_version.rb} +2 -2
  143. data/test/{test_gem_version_option.rb → rubygems/test_gem_version_option.rb} +2 -2
  144. data/test/{test_kernel.rb → rubygems/test_kernel.rb} +7 -10
  145. metadata +281 -177
  146. metadata.gz.sig +0 -0
  147. data/lib/rubygems/commands/mirror_command.rb +0 -111
  148. data/lib/rubygems/source_info_cache.rb +0 -394
  149. data/lib/rubygems/source_info_cache_entry.rb +0 -56
  150. data/test/test_gem_commands_mirror_command.rb +0 -60
@@ -0,0 +1,81 @@
1
+ = How to upgrade/downgrade Rubygems:
2
+
3
+ == On Ruby 1.9.x:
4
+
5
+ === From stock ruby shipping with 1.9:
6
+
7
+ Use the Normal Upgrade Method below. (finally!)
8
+
9
+ == On Ruby 1.8.x:
10
+
11
+ === From rubygems 1.3.x:
12
+
13
+ Use the Normal Upgrade Recipe below.
14
+
15
+ === From rubygems 1-1.x through 1.2.x:
16
+
17
+ RubyGems 1.1 and 1.2 have problems upgrading when there is no
18
+ rubygems-update installed. You will need to use the following
19
+ instructions if you see "Nothing to update".
20
+
21
+ Use the Manual Upgrade Recipe below.
22
+
23
+ === From rubygems < 1.1.x:
24
+
25
+ Use the Normal Upgrade Recipe below.
26
+
27
+ == Downgrade Recipe
28
+
29
+ === Normal Downgrade
30
+
31
+ Use sudo/su as appropriate:
32
+
33
+ $ gem install rubygems-update -v 1.3.7
34
+ $ update_rubygems
35
+
36
+ Replace 1.3.7 with whatever version you want to downgrade to. This
37
+ recipe can also be used to upgrade to a specific version instead of
38
+ the latest.
39
+
40
+ Do make sure that you don't have any other versions of rubygems-update
41
+ installed when you run the second command.
42
+
43
+ === 1.9.2 Downgrade from Rubygems 1.4.x+ to stock 1.9 rubygems:
44
+
45
+ Use sudo/su as appropriate:
46
+
47
+ $ ruby --disable-gems -S gem which rubygems
48
+ ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb
49
+ $ rm ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb
50
+ $ rm -rf ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems
51
+ $ gem -v
52
+ 1.3.7
53
+
54
+ == Upgrade Recipes
55
+
56
+ === Normal Upgrade
57
+
58
+ Use sudo/su as appropriate:
59
+
60
+ $ gem update --system
61
+
62
+ === Manual Upgrade
63
+
64
+ If you have an older version of RubyGems installed, then you can still
65
+ do it in two steps:
66
+
67
+ Use sudo/su as appropriate:
68
+
69
+ $ gem install rubygems-update
70
+ $ update_rubygems
71
+
72
+ === Manual Install
73
+
74
+ If you don't have any RubyGems install, there is still the pre-gem
75
+ approach to getting software, doing it manually:
76
+
77
+ Use sudo/su as appropriate:
78
+
79
+ * Download from: https://rubygems.org/pages/download
80
+ * Unpack into a directory and cd there
81
+ * Install with: ruby setup.rb
@@ -0,0 +1,27 @@
1
+ # You must ensure that rake, hoe, and minitest are already installed in specified RVM interpreter
2
+ export rvm_install_on_use_flag=1
3
+ export rvm_gemset_create_on_use_flag=1
4
+ rvm use $1
5
+ . "$HOME/.rvm/environments/ruby-$1" # There seems to be a bug where 'rvm use' from within a script doesn't override default interpreter, so we have to manually source the rvm environment file for the proper interpreter
6
+
7
+ # TODO: How can you make Hoe's check_extra_deps not use sudo?
8
+ #rake check_extra_deps default
9
+ # install gems manually for now
10
+ gem install 'rake' --no-ri --no-rdoc
11
+ gem install 'hoe' --no-ri --no-rdoc
12
+ gem install 'builder' -v '~> 2.1' --no-ri --no-rdoc
13
+ gem install 'hoe-seattlerb' -v '~> 1.2' --no-ri --no-rdoc
14
+ gem install 'minitest' -v '~> 1.4' --no-ri --no-rdoc
15
+ gem install 'session' -v '~> 2.4' --no-ri --no-rdoc
16
+ gem install 'rubyforge' --no-ri --no-rdoc
17
+
18
+ echo "----------------------------"
19
+ echo "Build environment:"
20
+ cat /etc/issue
21
+ uname -a
22
+ ruby -v
23
+ gem env
24
+ gem list
25
+ echo "----------------------------"
26
+
27
+ rake default
@@ -2,22 +2,29 @@
2
2
  require 'socket'
3
3
 
4
4
  Project.configure do |project|
5
-
6
- # Send email notifications about broken and fixed builds to email1@your.site, email2@your.site (default: send to nobody)
7
- project.email_notifier.emails = ['rubygems-developers@rubyforge.org'] if Socket.gethostname =~ /ci.pivotallabs.com/
5
+ # To add a build for a new interpreter (from ccrb root):
6
+ # ./cruise add RubyGems-x_y_z-pxxx -s git -r git://github.com/rubygems/rubygems.git
7
+ interpreter = Regexp.new(/RubyGems-(.*)$/i).match(project.name)[1]
8
+ interpreter.gsub!('_','.')
8
9
 
9
- # Set email 'from' field to john@doe.com:
10
- project.email_notifier.from = 'devnull+rubygems-ci@pivotallabs.com'
10
+ # only send notifications from the official ci box
11
+ if Socket.gethostname =~ /cibuilder.pivotallabs.com/
12
+ # explicitly enable dev list notification only for interpreters which should be green
13
+ interpreters_with_enabled_notification = [
14
+ '1.8.7-p302'
15
+ ]
16
+ if interpreters_with_enabled_notification.include?(interpreter)
17
+ project.email_notifier.emails = ['rubygems-developers@rubyforge.org']
18
+ end
11
19
 
12
- # Build the project by invoking rake task 'custom'
13
- # project.rake_task = 'custom'
20
+ # Always notify the following for all interpreters:
21
+ project.email_notifier.emails.concat([
22
+ 'thewoolleyman+rubygems-ci@gmail.com'
23
+ ])
24
+ end
14
25
 
15
- # Build the project by invoking shell script "build_my_app.sh". Keep in mind that when the script is invoked,
16
- # current working directory is <em>[cruise&nbsp;data]</em>/projects/your_project/work, so if you do not keep build_my_app.sh
17
- # in version control, it should be '../build_my_app.sh' instead
18
- project.build_command = 'rake check_extra_deps default'
26
+ project.build_command = "./ci_build.sh '#{interpreter}@rubygems'"
19
27
 
20
- # Ping Subversion for new revisions every 5 minutes (default: 30 seconds)
28
+ project.email_notifier.from = 'thewoolleyman+rubygems-ci@gmail.com'
21
29
  project.scheduler.polling_interval = 5.minutes
22
-
23
30
  end
@@ -9,5 +9,5 @@
9
9
  # once.
10
10
 
11
11
  warn 'rbconfig/datadir.rb and {Rb}Config.datadir is being deprecated from '\
12
- 'RubyGems. It will be removed completely on or after January 2011. If you '\
12
+ 'RubyGems. It will be removed completely on or after June 2011. If you '\
13
13
  'wish to rely on a datadir, please use Gem.datadir.'
@@ -5,7 +5,25 @@
5
5
  # See LICENSE.txt for permissions.
6
6
  #++
7
7
 
8
- gem_disabled = !defined? Gem
8
+ module Gem
9
+ QUICKLOADER_SUCKAGE = RUBY_VERSION =~ /^1\.9\.1/
10
+ GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/
11
+ end
12
+
13
+ if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
14
+ Gem::QuickLoader.remove
15
+
16
+ $LOADED_FEATURES.delete Gem::QuickLoader.path_to_full_rubygems_library
17
+
18
+ if $LOADED_FEATURES.any? do |path| path.end_with? '/rubygems.rb' end then
19
+ # TODO path does not exist here
20
+ raise LoadError, "another rubygems is already loaded from #{path}"
21
+ end
22
+
23
+ class << Gem
24
+ remove_method :try_activate if Gem.respond_to?(:try_activate, true)
25
+ end
26
+ end
9
27
 
10
28
  require 'rubygems/defaults'
11
29
  require 'rbconfig'
@@ -100,7 +118,7 @@ require 'thread' # HACK: remove me for 1.5 - this is here just for rails
100
118
  # -The RubyGems Team
101
119
 
102
120
  module Gem
103
- RubyGemsVersion = VERSION = '1.4.2'
121
+ RubyGemsVersion = VERSION = '1.5.0'
104
122
 
105
123
  ##
106
124
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -180,11 +198,25 @@ module Gem
180
198
  @ruby = nil
181
199
  @sources = []
182
200
 
201
+ @post_build_hooks ||= []
183
202
  @post_install_hooks ||= []
184
203
  @post_uninstall_hooks ||= []
185
204
  @pre_uninstall_hooks ||= []
186
205
  @pre_install_hooks ||= []
187
206
 
207
+ ##
208
+ # Try to activate a gem containing +path+. Returns true if
209
+ # activation succeeded or wasn't needed because it was already
210
+ # activated. Returns false if it can't find the path in a gem.
211
+
212
+ def self.try_activate path
213
+ spec = Gem.searcher.find path
214
+ return false unless spec
215
+
216
+ Gem.activate spec.name, "= #{spec.version}"
217
+ return true
218
+ end
219
+
188
220
  ##
189
221
  # Activates an installed gem matching +gem+. The gem must satisfy
190
222
  # +requirements+.
@@ -258,9 +290,6 @@ module Gem
258
290
  activate dep_gem, :sources => [spec, *sources]
259
291
  end
260
292
 
261
- # bin directory must come before library directories
262
- spec.require_paths.unshift spec.bindir if spec.bindir
263
-
264
293
  require_paths = spec.require_paths.map do |path|
265
294
  File.join spec.full_gem_path, path
266
295
  end
@@ -427,7 +456,7 @@ module Gem
427
456
 
428
457
  def self.dir
429
458
  @gem_home ||= nil
430
- set_home(ENV['GEM_HOME'] || Gem.configuration.home || default_dir) unless @gem_home
459
+ set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
431
460
  @gem_home
432
461
  end
433
462
 
@@ -483,13 +512,9 @@ module Gem
483
512
  files = []
484
513
 
485
514
  if check_load_path
486
- $LOAD_PATH.each do |load_path|
487
- globbed = Dir["#{File.expand_path glob, load_path}#{Gem.suffix_pattern}"]
488
-
489
- globbed.each do |load_path_file|
490
- files << load_path_file if File.file?(load_path_file.untaint)
491
- end
492
- end
515
+ files = $LOAD_PATH.map { |load_path|
516
+ Dir["#{File.expand_path glob, load_path}#{Gem.suffix_pattern}"]
517
+ }.flatten.select { |file| File.file? file.untaint }
493
518
  end
494
519
 
495
520
  specs = searcher.find_all glob
@@ -631,17 +656,29 @@ module Gem
631
656
  def self.load_path_insert_index
632
657
  index = $LOAD_PATH.index ConfigMap[:sitelibdir]
633
658
 
634
- $LOAD_PATH.each_with_index do |path, i|
635
- if path.instance_variables.include?(:@gem_prelude_index) or
636
- path.instance_variables.include?('@gem_prelude_index') then
637
- index = i
638
- break
659
+ if QUICKLOADER_SUCKAGE then
660
+ $LOAD_PATH.each_with_index do |path, i|
661
+ if path.instance_variables.include?(:@gem_prelude_index) or
662
+ path.instance_variables.include?('@gem_prelude_index') then
663
+ index = i
664
+ break
665
+ end
639
666
  end
640
667
  end
641
668
 
642
669
  index
643
670
  end
644
671
 
672
+ ##
673
+ # Loads YAML, preferring Psych
674
+
675
+ def self.load_yaml
676
+ require 'psych'
677
+ rescue ::LoadError
678
+ ensure
679
+ require 'yaml'
680
+ end
681
+
645
682
  ##
646
683
  # The file name and line number of the caller of the caller of this method.
647
684
 
@@ -667,7 +704,7 @@ module Gem
667
704
  @gem_path ||= nil
668
705
 
669
706
  unless @gem_path then
670
- paths = [ENV['GEM_PATH'] || Gem.configuration.path || default_path]
707
+ paths = [ENV['GEM_PATH'] || default_path]
671
708
 
672
709
  if defined?(APPLE_GEM_HOME) and not ENV['GEM_PATH'] then
673
710
  paths << APPLE_GEM_HOME
@@ -697,6 +734,17 @@ module Gem
697
734
  @platforms
698
735
  end
699
736
 
737
+ ##
738
+ # Adds a post-build hook that will be passed an Gem::Installer instance
739
+ # when Gem::Installer#install is called. The hook is called after the gem
740
+ # has been extracted and extensions have been built but before the
741
+ # executables or gemspec has been written. If the hook returns +false+ then
742
+ # the gem's files will be removed and the install will be aborted.
743
+
744
+ def self.post_build(&hook)
745
+ @post_build_hooks << hook
746
+ end
747
+
700
748
  ##
701
749
  # Adds a post-install hook that will be passed an Gem::Installer instance
702
750
  # when Gem::Installer#install is called
@@ -716,7 +764,8 @@ module Gem
716
764
 
717
765
  ##
718
766
  # Adds a pre-install hook that will be passed an Gem::Installer instance
719
- # when Gem::Installer#install is called
767
+ # when Gem::Installer#install is called. If the hook returns +false+ then
768
+ # the install will be aborted.
720
769
 
721
770
  def self.pre_install(&hook)
722
771
  @pre_install_hooks << hook
@@ -951,7 +1000,14 @@ module Gem
951
1000
  # Suffixes for require-able paths.
952
1001
 
953
1002
  def self.suffixes
954
- ['', '.rb', '.rbw', '.so', '.bundle', '.dll', '.sl', '.jar']
1003
+ @suffixes ||= ['',
1004
+ '.rb',
1005
+ *%w(DLEXT DLEXT2).map { |key|
1006
+ val = RbConfig::CONFIG[key]
1007
+ next unless val and not val.empty?
1008
+ ".#{val}"
1009
+ }
1010
+ ].compact.uniq
955
1011
  end
956
1012
 
957
1013
  ##
@@ -1059,6 +1115,12 @@ module Gem
1059
1115
 
1060
1116
  attr_reader :loaded_specs
1061
1117
 
1118
+ ##
1119
+ # The list of hooks to be run before Gem::Install#install finishes
1120
+ # installation
1121
+
1122
+ attr_reader :post_build_hooks
1123
+
1062
1124
  ##
1063
1125
  # The list of hooks to be run before Gem::Install#install does any work
1064
1126
 
@@ -1093,11 +1155,6 @@ module Gem
1093
1155
 
1094
1156
  MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
1095
1157
 
1096
- ##
1097
- # Location of legacy YAML quick gemspecs on remote repositories
1098
-
1099
- YAML_SPEC_DIR = 'quick/'
1100
-
1101
1158
  autoload :Version, 'rubygems/version'
1102
1159
  autoload :Requirement, 'rubygems/requirement'
1103
1160
  autoload :Dependency, 'rubygems/dependency'
@@ -1108,11 +1165,12 @@ module Gem
1108
1165
  autoload :SourceIndex, 'rubygems/source_index'
1109
1166
  autoload :Platform, 'rubygems/platform'
1110
1167
  autoload :Builder, 'rubygems/builder'
1168
+ autoload :ConfigFile, 'rubygems/config_file'
1111
1169
  end
1112
1170
 
1113
1171
  module Kernel
1114
1172
 
1115
- undef gem if respond_to? :gem # defined in gem_prelude.rb on 1.9
1173
+ remove_method :gem if 'method' == defined? gem # from gem_prelude.rb on 1.9
1116
1174
 
1117
1175
  ##
1118
1176
  # Use Kernel#gem to activate a specific version of +gem_name+.
@@ -1157,39 +1215,38 @@ end
1157
1215
  # "#{ConfigMap[:datadir]}/#{package_name}".
1158
1216
 
1159
1217
  def RbConfig.datadir(package_name)
1160
- require 'rbconfig/datadir' # TODO Deprecate after January 2010.
1218
+ require 'rbconfig/datadir' # TODO Deprecate after June 2010.
1161
1219
  Gem.datadir(package_name) ||
1162
1220
  File.join(Gem::ConfigMap[:datadir], package_name)
1163
1221
  end
1164
1222
 
1165
1223
  require 'rubygems/exceptions'
1166
1224
 
1167
- begin
1168
- ##
1169
- # Defaults the operating system (or packager) wants to provide for RubyGems.
1170
-
1171
- require 'rubygems/defaults/operating_system'
1172
- rescue LoadError
1173
- end
1174
-
1175
- if defined?(RUBY_ENGINE) then
1225
+ gem_preluded = Gem::GEM_PRELUDE_SUCKAGE and defined? Gem
1226
+ unless gem_preluded then # TODO: remove guard after 1.9.2 dropped
1176
1227
  begin
1177
1228
  ##
1178
- # Defaults the ruby implementation wants to provide for RubyGems
1229
+ # Defaults the operating system (or packager) wants to provide for RubyGems.
1179
1230
 
1180
- require "rubygems/defaults/#{RUBY_ENGINE}"
1231
+ require 'rubygems/defaults/operating_system'
1181
1232
  rescue LoadError
1182
1233
  end
1183
- end
1184
1234
 
1185
- require 'rubygems/config_file'
1235
+ if defined?(RUBY_ENGINE) then
1236
+ begin
1237
+ ##
1238
+ # Defaults the ruby implementation wants to provide for RubyGems
1239
+
1240
+ require "rubygems/defaults/#{RUBY_ENGINE}"
1241
+ rescue LoadError
1242
+ end
1243
+ end
1244
+ end
1186
1245
 
1187
1246
  ##
1188
1247
  # Enables the require hook for RubyGems.
1189
- #
1190
- # Ruby 1.9 allows --disable-gems, so we require it when we didn't detect a Gem
1191
- # constant at rubygems.rb load time.
1192
1248
 
1193
- require 'rubygems/custom_require' if gem_disabled or RUBY_VERSION < '1.9'
1249
+ require 'rubygems/custom_require' unless Gem::GEM_PRELUDE_SUCKAGE
1194
1250
 
1195
1251
  Gem.clear_paths
1252
+
@@ -4,16 +4,12 @@
4
4
  # See LICENSE.txt for permissions.
5
5
  #++
6
6
 
7
+ require 'rubygems'
7
8
  require 'rubygems/user_interaction'
8
9
 
9
- begin
10
- require 'psych'
11
- rescue LoadError
12
- end
10
+ Gem.load_yaml
13
11
 
14
- require 'yaml'
15
12
  require 'rubygems/package'
16
- require 'rubygems/security'
17
13
 
18
14
  ##
19
15
  # The Builder class processes RubyGem specification files
@@ -66,6 +62,8 @@ EOM
66
62
  signer = nil
67
63
 
68
64
  if @spec.respond_to?(:signing_key) and @spec.signing_key then
65
+ require 'rubygems/security'
66
+
69
67
  signer = Gem::Security::Signer.new @spec.signing_key, @spec.cert_chain
70
68
  @spec.signing_key = nil
71
69
  @spec.cert_chain = signer.cert_chain.map { |cert| cert.to_s }
@@ -77,11 +75,7 @@ EOM
77
75
  def write_package
78
76
  open @spec.file_name, 'wb' do |gem_io|
79
77
  Gem::Package.open gem_io, 'w', @signer do |pkg|
80
- yaml = if defined?(Psych) then
81
- Psych.dump(@spec)
82
- else
83
- YAML.dump(@spec)
84
- end
78
+ yaml = @spec.to_yaml
85
79
  pkg.metadata = yaml
86
80
 
87
81
  @spec.files.each do |file|