rubygems-update 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (65) hide show
  1. data.tar.gz.sig +2 -4
  2. data/ChangeLog +155 -0
  3. data/Rakefile +20 -5
  4. data/doc/release_notes/rel_1_3_0.rdoc +125 -0
  5. data/lib/rubygems.rb +107 -15
  6. data/lib/rubygems/commands/contents_command.rb +1 -1
  7. data/lib/rubygems/commands/environment_command.rb +40 -0
  8. data/lib/rubygems/commands/help_command.rb +2 -2
  9. data/lib/rubygems/commands/install_command.rb +15 -0
  10. data/lib/rubygems/commands/lock_command.rb +15 -6
  11. data/lib/rubygems/commands/outdated_command.rb +1 -1
  12. data/lib/rubygems/commands/pristine_command.rb +1 -1
  13. data/lib/rubygems/commands/query_command.rb +14 -9
  14. data/lib/rubygems/commands/rdoc_command.rb +5 -1
  15. data/lib/rubygems/commands/specification_command.rb +2 -2
  16. data/lib/rubygems/commands/unpack_command.rb +1 -1
  17. data/lib/rubygems/commands/update_command.rb +23 -14
  18. data/lib/rubygems/commands/which_command.rb +4 -3
  19. data/lib/rubygems/config_file.rb +25 -3
  20. data/lib/rubygems/defaults.rb +42 -11
  21. data/lib/rubygems/dependency_installer.rb +19 -15
  22. data/lib/rubygems/doc_manager.rb +162 -115
  23. data/lib/rubygems/ext/builder.rb +2 -2
  24. data/lib/rubygems/ext/rake_builder.rb +1 -1
  25. data/lib/rubygems/gem_path_searcher.rb +35 -19
  26. data/lib/rubygems/indexer.rb +15 -6
  27. data/lib/rubygems/install_update_options.rb +7 -0
  28. data/lib/rubygems/installer.rb +85 -9
  29. data/lib/rubygems/local_remote_options.rb +7 -0
  30. data/lib/rubygems/package/tar_reader.rb +7 -7
  31. data/lib/rubygems/platform.rb +1 -18
  32. data/lib/rubygems/remote_fetcher.rb +45 -54
  33. data/lib/rubygems/rubygems_version.rb +1 -1
  34. data/lib/rubygems/source_index.rb +22 -7
  35. data/lib/rubygems/source_info_cache.rb +9 -0
  36. data/lib/rubygems/spec_fetcher.rb +18 -20
  37. data/lib/rubygems/specification.rb +502 -293
  38. data/lib/rubygems/test_utilities.rb +19 -8
  39. data/lib/rubygems/uninstaller.rb +60 -26
  40. data/setup.rb +15 -7
  41. data/test/gemutilities.rb +84 -0
  42. data/test/mockgemui.rb +22 -2
  43. data/test/test_gem.rb +118 -13
  44. data/test/test_gem_commands_dependency_command.rb +1 -1
  45. data/test/test_gem_commands_list_command.rb +37 -0
  46. data/test/test_gem_commands_lock_command.rb +69 -0
  47. data/test/test_gem_commands_query_command.rb +40 -1
  48. data/test/test_gem_commands_uninstall_command.rb +60 -0
  49. data/test/test_gem_config_file.rb +51 -17
  50. data/test/test_gem_ext_configure_builder.rb +9 -9
  51. data/test/test_gem_ext_rake_builder.rb +21 -12
  52. data/test/test_gem_gem_path_searcher.rb +15 -7
  53. data/test/test_gem_indexer.rb +35 -1
  54. data/test/test_gem_install_update_options.rb +26 -5
  55. data/test/test_gem_installer.rb +93 -21
  56. data/test/test_gem_local_remote_options.rb +12 -0
  57. data/test/test_gem_platform.rb +6 -13
  58. data/test/test_gem_remote_fetcher.rb +121 -31
  59. data/test/test_gem_source_index.rb +74 -21
  60. data/test/test_gem_source_info_cache.rb +2 -1
  61. data/test/test_gem_spec_fetcher.rb +13 -3
  62. data/test/test_gem_specification.rb +13 -7
  63. data/test/test_gem_uninstaller.rb +25 -2
  64. metadata +6 -2
  65. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- a����wJe��?P��ۦ��)�!�bwe:4)5:حg 3#|UU!N���='�:��sY�!=�C2*9����8F.��S��A�>R��xŘ>#X4^��c��/�w@�.�5��(�^�f"#J�� 5���&����.�_��C`-��
2
- ��
3
- ��Xh�*�dj��j������=�fm.v���M+�T�x��g��]]P_���ڦ�
4
- ,��Ecl�b�4��(�Si���yn'���G��0
1
+ s�����/��AM��=��?]?Z-�Ң{_C�u$��Q�`�U`�E��r��Zo=��4@���\+��pP�%�N�8`�wV���[]r܃���S�դ�r����M�ikL��0`�΃� �m
2
+ ��wFw캋�C ��M''�7��j���2Dy�H9ƒ��I+�� �*�q�-���or�EH=�ȋhWF$�<�@P�Q4Ӽ-5 {Y��ÿ�;��E���H��
data/ChangeLog CHANGED
@@ -1,3 +1,158 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ 2008-09-24 Eric Hodel <drbrain@segment7.net>
4
+
5
+ * doc/release_notes/rel_1_3_0.rdoc: Final release notes for 1.3.0.
6
+ * lib/rubygems/rubygems_version.rb: 1.3.0.
7
+ * lib/rubygems/builder.rb: Examine process status correctly. Patch
8
+ by Nobu.
9
+ * test/test_gem_ext_rake_builder.rb: Override Gem.ruby and
10
+ ENV['rake'] for 1.9 integration. Patch by Nobu.
11
+
12
+ 2008-09-16 Eric Hodel <drbrain@segment7.net>
13
+
14
+ * lib/rubygems.rb: Only create ~/.gem by user owning ~. Bug #21561
15
+ by Neil Wilson.
16
+
17
+ 2008-09-15 Eric Hodel <drbrain@segment7.net>
18
+
19
+ * lib/rubygems/source_index.rb: Autoload SpecFetcher to improve load
20
+ time. Patch #21577 by Simon Chiang.
21
+ * lib/rubygems/commands/lock_command.rb: Modernize. Fix --strict.
22
+ Patch #21814 by Sven Engelhardt.
23
+ * lib/rubygems/platform.rb: Fix for solaris platform. Patch #21911
24
+ by Bob Remeika.
25
+
26
+ 2008-09-10 Eric Hodel <drbrain@segment7.net>
27
+
28
+ * lib/rubygems/commands/install_command.rb: Describe _version_ in `gem
29
+ help install`.
30
+ * lib/rubygems/commands/environment_command.rb: Describe environment
31
+ variables and gemrc in `gem help env`.
32
+ * lib/rubygems.rb: Warn when executing Gem::manage_gems.
33
+ * lib/rubygems/doc_manager.rb: Have RubyGems update the ri cache.
34
+ * lib/rubygems/source_index.rb: Ensure specs are read as UTF-8.
35
+ * lib/rubygems/specification.rb: Add magic comment to .gemspec files
36
+ so they are read in as UTF-8.
37
+
38
+ 2008-08-22 Luis Lavena <luislavena@gmail.com>
39
+
40
+ * lib/rubygems.rb: Corrected usage of HOMEDRIVE and HOMEPATH on Windows.
41
+ Escape Gem.ruby if spaces in the path are present. Solves bug related to
42
+ extensions compile process.
43
+ * test/test_gem.rb: Added test to verify both conditions.
44
+
45
+ 2008-08-17 Eric Hodel <drbrain@segment7.net>
46
+
47
+ * doc/release_notes/rel_1_3_0.rdoc: Initial release notes for 1.3.0.
48
+ * util/CL2notes: Release note creation helper script.
49
+
50
+ 2008-08-16 Eric Hodel <drbrain@segment7.net>
51
+
52
+ * lib/rubygems/local_remote_options.rb: Added #both? to complement
53
+ #local? and #remote?.
54
+ * lib/rubygems/commands/query_command.rb: Print out LOCAL/REMOTE with
55
+ --both, even without a TTY.
56
+ * lib/rubygems.rb: Add Gem.find_files, allows a gem to discover
57
+ features provided by other gems.
58
+
59
+ 2008-08-14 Wilson Bilkovich <wilson@supremetyrant.com>
60
+
61
+ * lib/rubygems/source_index.rb: Deprecate options to 'search' other than
62
+ Gem::Dependency instances and issue warning until November 2008.
63
+ * lib/rubygems/platform.rb: Remove deprecated constant warnings
64
+ and really deprecate them.
65
+ * Rakefile: If the SETUP_OPTIONS environment variable is set, pass its
66
+ contents as arguments to setup.rb
67
+ * test/test_gem_commands_uninstall_command.rb: Added
68
+
69
+ 2008-08-13 Wilson Bilkovich <wilson@supremetyrant.com>
70
+
71
+ * lib/rubygems/uninstaller.rb: Fix binary script uninstallation.
72
+ Bug #21234 by Neil Wilson.
73
+ * test/test_gem_commands_uninstall_command.rb: Added
74
+
75
+ 2008-08-12 Eric Hodel <drbrain@segment7.net>
76
+
77
+ * lib/rubygems/installer.rb: Try to create directory before diverting
78
+ to ~/.gems.
79
+ * lib/rubygems/uninstaller.rb: Fix uninstallation with -i. Bug
80
+ #20812 by John Clayton. Have #remove_all call #uninstall_gem so hooks
81
+ get called. Bug #21242 by Neil Wilson.
82
+ * lib/rubygems/commands/update_command.rb: Fix updating RubyGems when
83
+ no previous rubygems-update is installed. Bug #20775 by Hemant Kumar.
84
+
85
+ 2008-08-11 Eric Hodel <drbrain@segment7.net>
86
+
87
+ * lib/rubygems/remote_fetcher.rb: Fix HTTPS support. Patch #21072 by
88
+ Alex Arnell. Fix Not Modified handling. Bug #21310 by Gordon
89
+ Thiesfeld.
90
+
91
+ 2008-07-11 Luis Lavena <luislavena@gmail.com>
92
+
93
+ * setup.rb: Properly build --destdir folder structure using Pathname.
94
+ * test/mockgemui.rb: Fix warnings about instance variables in a module.
95
+
96
+ 2008-07-02 Phil Hagelberg <technomancy@gmail.com>
97
+
98
+ * lib/rubygems/defaults.rb: Add Gem.user_dir to use paths like
99
+ ~/.gem/ruby/1.8/gems and the like instead of just ~/.gem. Update
100
+ remote fetcher and installer to use it.
101
+
102
+ 2008-07-01 Eric Hodel <drbrain@segment7.net>
103
+
104
+ * lib/rubygems/installer.rb: Add #gem_home, #bin_dir for hooks. Use
105
+ DependencyInstaller's source_index so reinstallation via -i does not
106
+ fail.
107
+ * lib/rubygems/uninstaller.rb: Add #gem_home, #bin_dir for hooks.
108
+ * lib/rubygems/commands/query_command.rb: Don't print LOCAL/REMOTE
109
+ gems if stdout is not a TTY.
110
+ * lib/rubygems/commands/query_command.rb: Use the regexp we already
111
+ have for `gem list --installed`. Bug #20876 by Nick Hoffman.
112
+ * lib/rubygems/commands/which_command.rb: Clarify what `gem which` is
113
+ for.
114
+
115
+ 2008-06-30 Eric Hodel <drbrain@segment7.net>
116
+
117
+ * test/test_ext_configure_builder.rb: Locale-free patch by Yusuke
118
+ Endoh [ruby-core:17444].
119
+ * lib/rubygems.rb: Add pre/post (un)install hooks.
120
+ * lib/rubygems/installer.rb: Call pre/post install hooks as
121
+ appropriate.
122
+ * lib/rubygems/uninstaller.rb: Call pre/post uninstall hooks as
123
+ appropriate. Minor refactoring of #uninstall.
124
+ * lib/rubygems/package/tar_reader.rb: Some OSs raise EINVAL on seek.
125
+ Based on patch in bug #20791 by Neil Wilson.
126
+ * lib/rubygems/specification.rb: Correctly check for support of
127
+ development dependencies for #to_ruby. Bug #20778 by Evan Weaver.
128
+ * lib/rubygems/spec_fetcher.rb: Correctly load all cache file even if
129
+ latest has been loaded. Bug #20776 by Uwe Kubosch.
130
+
131
+ 2008-06-25 Eric Hodel <drbrain@segment7.net>
132
+
133
+ * lib/rubygems/config_file.rb: Add Gem::ConfigFile constants for
134
+ packagers and implementors to override defaults.
135
+ * test/*: Fixes to run tests when under test/rubygems/. Patch by
136
+ Yusuke ENDOH [ruby-core:17353].
137
+
138
+ 2008-06-24 Eric Hodel <drbrain@segment7.net>
139
+
140
+ * lib/rubygems/remote_fetcher.rb: Cleanup to support
141
+ if-modified-since requests. pair: Ryan Davis
142
+ * lib/rubygems/indexer: Force platform to Gem::Platform::RUBY when
143
+ nil or blank. Fixes various uninstallable gems.
144
+
145
+ 2008-06-24 Phil Hagelberg <technomancy@gmail.com>
146
+
147
+ * lib/rubygems/installer.rb: Fall back on ~/.gem if GEM_HOME is
148
+ not writable.
149
+ * lib/rubygems/install_update_options.rb: Allow --user-install or
150
+ --no-user-install command-line switch to explicitly force whether
151
+ or not ~/.gem should be used.
152
+ * lib/rubygems/remote_fetcher.rb: Use ~/.gem/cache if cache dir is
153
+ not writable.
154
+ * test/gemutilities.rb: Use MockGemUi for all tests.
155
+
1
156
  2008-06-21 Eric Hodel <drbrain@segment7.net>
2
157
 
3
158
  * lib/rubygems/specification.rb: Load specifications from the future.
data/Rakefile CHANGED
@@ -298,6 +298,8 @@ Rake::PackageTask.new("package") do |p|
298
298
  p.package_files = PKG_FILES
299
299
  end
300
300
 
301
+ warn_unsigned = true
302
+
301
303
  Spec = Gem::Specification.new do |s|
302
304
  s.name = PKG_NAME + "-update"
303
305
  s.version = PKG_VERSION
@@ -316,15 +318,27 @@ installation of RubyGems before this update can be applied.
316
318
  s.bindir = "bin" # Use these for applications.
317
319
  s.executables = ["update_rubygems"]
318
320
  certdir = ENV['CERT_DIR']
319
- if certdir
320
- s.signing_key = File.join(certdir, 'gem-private_key.pem')
321
- s.cert_chain = [File.join(certdir, 'gem-public_cert.pem')]
321
+ if certdir then
322
+ key = File.join certdir, 'gem-private_key.pem'
323
+ cert = File.join certdir, 'gem-public_cert.pem'
324
+
325
+ if File.exist? key and File.exist? cert then
326
+ s.signing_key = File.join(certdir, 'gem-private_key.pem')
327
+ s.cert_chain = [File.join(certdir, 'gem-public_cert.pem')]
328
+ warn_unsigned = false
329
+ else
330
+ warn_unsigned = true
331
+ end
322
332
  end
323
333
  end
324
334
 
325
335
  # Add console output about signing the Gem
326
336
  file "pkg/#{Spec.full_name}.gem" do
327
- puts "Signed with certificates in '#{ENV['CERT_DIR']}'" if ENV['CERT_DIR']
337
+ if warn_unsigned then
338
+ warn "WARNING: gem will not be signed, no key or certificate found in #{ENV['CERT_DIR']}"
339
+ else
340
+ puts "Signed with certificates in '#{ENV['CERT_DIR']}'"
341
+ end
328
342
  end
329
343
 
330
344
  Rake::GemPackageTask.new(Spec) do |p| end
@@ -337,7 +351,8 @@ end
337
351
 
338
352
  desc "Install RubyGems"
339
353
  task :install do
340
- ruby 'setup.rb'
354
+ opts = ENV['SETUP_OPTIONS']
355
+ ruby "setup.rb #{opts}".strip
341
356
 
342
357
  svnversion = `svnversion`.split(':').last.sub(/[^\d]/, '').strip
343
358
 
@@ -0,0 +1,125 @@
1
+ = Announce: RubyGems Release 1.3.0
2
+
3
+ Release 1.3.0 adds new features and fixes some bugs.
4
+
5
+ New features:
6
+
7
+ * RubyGems doesn't print LOCAL/REMOTE titles for `gem query` and friends if
8
+ stdout is not a TTY, except with --both.
9
+ * Added Gem.find_files, allows a gem to discover features provided by other
10
+ gems.
11
+ * Added pre/post (un)install hooks for packagers of RubyGems. (Not for gems
12
+ themselves).
13
+ * RubyGems now installs gems into ~/.gem if GEM_HOME is not writable. Use
14
+ --no-user-install command-line switch to disable this behavior.
15
+ * Fetching specs for update now uses If-Modified-Since requests.
16
+ * RubyGems now updates the ri cache when the rdoc gem is installed and
17
+ documentation is generated.
18
+
19
+ Deprecation Notices:
20
+
21
+ * Gem::manage_gems now warns when called. It will be removed on or after March
22
+ 2009.
23
+
24
+ Bugs Fixed:
25
+
26
+ * RubyGems 1.3.0+ now updates when no previous rubygems-update is installed.
27
+ Bug #20775 by Hemant Kumar.
28
+ * RubyGems now uses the regexp we already have for `gem list --installed`. Bug
29
+ #20876 by Nick Hoffman.
30
+ * Platform is now forced to Gem::Platform::RUBY when nil or blank in the
31
+ indexer. Fixes various uninstallable gems.
32
+ * Handle EINVAL on seek. Based on patch in bug #20791 by Neil Wilson.
33
+ * Fix HTTPS support. Patch #21072 by Alex Arnell.
34
+ * RubyGems now loads all cache files even if latest has been loaded. Bug
35
+ #20776 by Uwe Kubosch.
36
+ * RubyGems checks for support of development dependencies for #to_ruby. Bug
37
+ #20778 by Evan Weaver.
38
+ * Now specifications from the future can be loaded.
39
+ * Binary script uninstallation fixed. Bug #21234 by Neil Wilson.
40
+ * Uninstallation with -i fixed. Bug #20812 by John Clayton.
41
+ * Gem::Uninstaller#remove_all now calls Gem::Uninstaller#uninstall_gem so hooks
42
+ get called. Bug #21242 by Neil Wilson.
43
+ * Gem.ruby now properly escaped on windows. Fixes problem with extension
44
+ compilation.
45
+ * `gem lock --strict` works again. Patch #21814 by Sven Engelhardt.
46
+ * Platform detection for Solaris was improved. Patch #21911 by Bob Remeika.
47
+
48
+ Other Changes Include:
49
+
50
+ * `gem help install` now describes _version_ argument to executable stubs
51
+ * `gem help environment` describes environment variables and ~/.gemrc and
52
+ /etc/gemrc
53
+ * On-disk gemspecs are now read in UTF-8 and written with a UTF-8 magic comment
54
+ * Rakefile
55
+ * If the SETUP_OPTIONS environment variable is set, pass its contents as
56
+ arguments to setup.rb
57
+ * lib/rubygems/platform.rb
58
+ * Remove deprecated constant warnings and really deprecate them. (WIN32,
59
+ etc).
60
+ * lib/rubygems/remote_fetcher.rb
61
+ * Now uses ~/.gem/cache if the cache dir in GEM_HOME is not writable.
62
+ * lib/rubygems/source_index.rb
63
+ * Deprecate options to 'search' other than Gem::Dependency instances and
64
+ issue warning until November 2008.
65
+ * setup.rb
66
+ * --destdir folder structure now built using Pathname, so it works for
67
+ Windows platforms.
68
+ * test/*
69
+ * Fixes to run tests when under test/rubygems/. Patch by Yusuke ENDOH
70
+ [ruby-core:17353].
71
+ * test/test_ext_configure_builder.rb
72
+ * Locale-free patch by Yusuke Endoh [ruby-core:17444].
73
+
74
+ For a full list of changes to RubyGems and the contributor for each change, see
75
+ the ChangeLog file.
76
+
77
+ Special thanks to Chad Wooley for backwards compatibility testing and Luis
78
+ Lavena for continuing windows support.
79
+
80
+ == How can I get RubyGems?
81
+
82
+ NOTE: If you have installed RubyGems using a package system you may want to
83
+ install a new RubyGems through the same packaging system.
84
+
85
+ If you have a recent version of RubyGems (0.8.5 or later), then all
86
+ you need to do is:
87
+
88
+ $ gem update --system (you might need to be admin/root)
89
+
90
+ NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no
91
+ rubygems-update installed. You will need to follow the second set of update
92
+ instructions if you see "Nothing to update".
93
+
94
+ NOTE: You may have to run the command twice if you have any previosly
95
+ installed rubygems-update gems.
96
+
97
+ If you have an older version of RubyGems installed, then you can still
98
+ do it in two steps:
99
+
100
+ $ gem install rubygems-update (again, might need to be admin/root)
101
+ $ update_rubygems (... here too)
102
+
103
+ If you don't have any gems install, there is still the pre-gem
104
+ approach to getting software ... doing it manually:
105
+
106
+ 1. DOWNLOAD FROM: http://rubyforge.org/frs/?group_id=126
107
+ 2. UNPACK INTO A DIRECTORY AND CD THERE
108
+ 3. INSTALL WITH: ruby setup.rb (you may need admin/root privilege)
109
+
110
+ == To File Bugs
111
+
112
+ The RubyGems bug tracker can be found on RubyForge at:
113
+ http://rubyforge.org/tracker/?func=add&group_id=126&atid=575
114
+
115
+ When filing a bug, `gem env` output will be helpful in diagnosing the issue.
116
+
117
+ If you find a bug where RubyGems crashes, please provide debug output. You can
118
+ do that with `gem --debug the_command`.
119
+
120
+ == Thanks
121
+
122
+ Keep those gems coming!
123
+
124
+ -- Jim & Chad & Eric (for the RubyGems team)
125
+
data/lib/rubygems.rb CHANGED
@@ -104,6 +104,11 @@ module Gem
104
104
  @ruby = nil
105
105
  @sources = []
106
106
 
107
+ @post_install_hooks = []
108
+ @post_uninstall_hooks = []
109
+ @pre_uninstall_hooks = []
110
+ @pre_install_hooks = []
111
+
107
112
  ##
108
113
  # Activates an installed gem matching +gem+. The gem must satisfy
109
114
  # +version_requirements+.
@@ -244,7 +249,10 @@ module Gem
244
249
  def self.clear_paths
245
250
  @gem_home = nil
246
251
  @gem_path = nil
252
+ @user_home = nil
253
+
247
254
  @@source_index = nil
255
+
248
256
  MUTEX.synchronize do
249
257
  @searcher = nil
250
258
  end
@@ -261,9 +269,7 @@ module Gem
261
269
  # The standard configuration object for gems.
262
270
 
263
271
  def self.configuration
264
- return @configuration if @configuration
265
- require 'rubygems/config_file'
266
- @configuration = Gem::ConfigFile.new []
272
+ @configuration ||= Gem::ConfigFile.new []
267
273
  end
268
274
 
269
275
  ##
@@ -336,6 +342,22 @@ module Gem
336
342
  end
337
343
  end
338
344
 
345
+ ##
346
+ # Returns a list of paths matching +file+ that can be used by a gem to pick
347
+ # up features from other gems. For example:
348
+ #
349
+ # Gem.find_files('rdoc/discover').each do |path| load path end
350
+ #
351
+ # find_files does not search $LOAD_PATH for files, only gems.
352
+
353
+ def self.find_files(path)
354
+ specs = searcher.find_all path
355
+
356
+ specs.map do |spec|
357
+ searcher.matching_files spec, path
358
+ end.flatten
359
+ end
360
+
339
361
  ##
340
362
  # Finds the user's home directory.
341
363
  #--
@@ -353,7 +375,7 @@ module Gem
353
375
  end
354
376
 
355
377
  if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then
356
- return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
378
+ return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}"
357
379
  end
358
380
 
359
381
  begin
@@ -466,13 +488,11 @@ module Gem
466
488
 
467
489
  ##
468
490
  # manage_gems is useless and deprecated. Don't call it anymore.
469
- #--
470
- # TODO warn w/ RubyGems 1.2.x release.
471
491
 
472
- def self.manage_gems
473
- #file, lineno = location_of_caller
492
+ def self.manage_gems # :nodoc:
493
+ file, lineno = location_of_caller
474
494
 
475
- #warn "#{file}:#{lineno}:Warning: Gem#manage_gems is deprecated and will be removed on or after September 2008."
495
+ warn "#{file}:#{lineno}:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009."
476
496
  end
477
497
 
478
498
  ##
@@ -489,11 +509,7 @@ module Gem
489
509
  @gem_path ||= nil
490
510
 
491
511
  unless @gem_path then
492
- paths = if ENV['GEM_PATH'] then
493
- [ENV['GEM_PATH']]
494
- else
495
- [default_path]
496
- end
512
+ paths = [ENV['GEM_PATH'] || Gem.configuration.path || default_path]
497
513
 
498
514
  if defined?(APPLE_GEM_HOME) and not ENV['GEM_PATH'] then
499
515
  paths << APPLE_GEM_HOME
@@ -523,6 +539,40 @@ module Gem
523
539
  @platforms
524
540
  end
525
541
 
542
+ ##
543
+ # Adds a post-install hook that will be passed an Gem::Installer instance
544
+ # when Gem::Installer#install is called
545
+
546
+ def self.post_install(&hook)
547
+ @post_install_hooks << hook
548
+ end
549
+
550
+ ##
551
+ # Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance
552
+ # and the spec that was uninstalled when Gem::Uninstaller#uninstall is
553
+ # called
554
+
555
+ def self.post_uninstall(&hook)
556
+ @post_uninstall_hooks << hook
557
+ end
558
+
559
+ ##
560
+ # Adds a pre-install hook that will be passed an Gem::Installer instance
561
+ # when Gem::Installer#install is called
562
+
563
+ def self.pre_install(&hook)
564
+ @pre_install_hooks << hook
565
+ end
566
+
567
+ ##
568
+ # Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance
569
+ # and the spec that will be uninstalled when Gem::Uninstaller#uninstall is
570
+ # called
571
+
572
+ def self.pre_uninstall(&hook)
573
+ @pre_uninstall_hooks << hook
574
+ end
575
+
526
576
  ##
527
577
  # The directory prefix this RubyGems was installed at.
528
578
 
@@ -600,6 +650,9 @@ module Gem
600
650
  @ruby = File.join(ConfigMap[:bindir],
601
651
  ConfigMap[:ruby_install_name])
602
652
  @ruby << ConfigMap[:EXEEXT]
653
+
654
+ # escape string in case path to ruby executable contain spaces.
655
+ @ruby.sub!(/.*\s.*/m, '"\&"')
603
656
  end
604
657
 
605
658
  @ruby
@@ -650,11 +703,18 @@ module Gem
650
703
 
651
704
  @gem_path << Gem.dir
652
705
  else
706
+ # TODO: should this be Gem.default_path instead?
653
707
  @gem_path = [Gem.dir]
654
708
  end
655
709
 
656
710
  @gem_path.uniq!
657
- @gem_path.each do |gp| ensure_gem_subdirectories(gp) end
711
+ @gem_path.each do |path|
712
+ if 0 == File.expand_path(path).index(Gem.user_home) and
713
+ Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid then
714
+ next # only create by matching user
715
+ end
716
+ ensure_gem_subdirectories path
717
+ end
658
718
  end
659
719
 
660
720
  private_class_method :set_paths
@@ -684,6 +744,14 @@ module Gem
684
744
  @sources
685
745
  end
686
746
 
747
+ ##
748
+ # Need to be able to set the sources without calling
749
+ # Gem.sources.replace since that would cause an infinite loop.
750
+
751
+ def self.sources=(new_sources)
752
+ @sources = new_sources
753
+ end
754
+
687
755
  ##
688
756
  # Glob pattern for require-able path suffixes.
689
757
 
@@ -730,6 +798,27 @@ module Gem
730
798
 
731
799
  attr_reader :loaded_specs
732
800
 
801
+ ##
802
+ # The list of hooks to be run before Gem::Install#install does any work
803
+
804
+ attr_reader :post_install_hooks
805
+
806
+ ##
807
+ # The list of hooks to be run before Gem::Uninstall#uninstall does any
808
+ # work
809
+
810
+ attr_reader :post_uninstall_hooks
811
+
812
+ ##
813
+ # The list of hooks to be run after Gem::Install#install is finished
814
+
815
+ attr_reader :pre_install_hooks
816
+
817
+ ##
818
+ # The list of hooks to be run after Gem::Uninstall#uninstall is finished
819
+
820
+ attr_reader :pre_uninstall_hooks
821
+
733
822
  # :stopdoc:
734
823
 
735
824
  alias cache source_index # an alias for the old name
@@ -780,7 +869,10 @@ if defined?(RUBY_ENGINE) then
780
869
  end
781
870
  end
782
871
 
872
+ require 'rubygems/config_file'
873
+
783
874
  if RUBY_VERSION < '1.9' then
784
875
  require 'rubygems/custom_require'
785
876
  end
786
877
 
878
+ Gem.clear_paths