rubygems-update 1.3.5 → 1.3.6

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 (146) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +8 -1
  3. data/ChangeLog +164 -0
  4. data/History.txt +52 -1
  5. data/Manifest.txt +8 -8
  6. data/README +3 -2
  7. data/Rakefile +49 -5
  8. data/bin/gem +2 -2
  9. data/bin/update_rubygems +9 -11
  10. data/cruise_config.rb +4 -3
  11. data/hide_lib_for_update/note.txt +5 -0
  12. data/lib/rbconfig/datadir.rb +10 -14
  13. data/lib/rubygems.rb +117 -140
  14. data/lib/rubygems/builder.rb +4 -2
  15. data/lib/rubygems/command.rb +51 -48
  16. data/lib/rubygems/command_manager.rb +2 -0
  17. data/lib/rubygems/commands/dependency_command.rb +10 -5
  18. data/lib/rubygems/commands/environment_command.rb +1 -1
  19. data/lib/rubygems/commands/fetch_command.rb +6 -5
  20. data/lib/rubygems/commands/install_command.rb +1 -0
  21. data/lib/rubygems/commands/mirror_command.rb +8 -8
  22. data/lib/rubygems/commands/owner_command.rb +75 -0
  23. data/lib/rubygems/commands/pristine_command.rb +1 -1
  24. data/lib/rubygems/commands/push_command.rb +45 -0
  25. data/lib/rubygems/commands/query_command.rb +4 -1
  26. data/lib/rubygems/commands/rdoc_command.rb +24 -9
  27. data/lib/rubygems/commands/server_command.rb +6 -0
  28. data/lib/rubygems/commands/setup_command.rb +14 -4
  29. data/lib/rubygems/commands/unpack_command.rb +2 -2
  30. data/lib/rubygems/commands/update_command.rb +2 -2
  31. data/lib/rubygems/commands/which_command.rb +7 -9
  32. data/lib/rubygems/config_file.rb +100 -26
  33. data/lib/rubygems/defaults.rb +1 -1
  34. data/lib/rubygems/dependency.rb +133 -75
  35. data/lib/rubygems/dependency_installer.rb +28 -10
  36. data/lib/rubygems/dependency_list.rb +41 -12
  37. data/lib/rubygems/doc_manager.rb +7 -0
  38. data/lib/rubygems/format.rb +16 -20
  39. data/lib/rubygems/gem_openssl.rb +1 -1
  40. data/lib/rubygems/gem_path_searcher.rb +10 -12
  41. data/lib/rubygems/gemcutter_utilities.rb +49 -0
  42. data/lib/rubygems/indexer.rb +2 -2
  43. data/lib/rubygems/install_update_options.rb +1 -9
  44. data/lib/rubygems/installer.rb +35 -76
  45. data/lib/rubygems/local_remote_options.rb +1 -2
  46. data/lib/rubygems/package.rb +0 -1
  47. data/lib/rubygems/package/tar_input.rb +3 -1
  48. data/lib/rubygems/package_task.rb +16 -11
  49. data/lib/rubygems/remote_fetcher.rb +22 -8
  50. data/lib/rubygems/requirement.rb +78 -100
  51. data/lib/rubygems/server.rb +41 -10
  52. data/lib/rubygems/source_index.rb +5 -5
  53. data/lib/rubygems/spec_fetcher.rb +2 -2
  54. data/lib/rubygems/specification.rb +66 -16
  55. data/lib/rubygems/test_utilities.rb +33 -4
  56. data/lib/rubygems/uninstaller.rb +3 -3
  57. data/lib/rubygems/user_interaction.rb +45 -0
  58. data/lib/rubygems/validator.rb +6 -7
  59. data/lib/rubygems/version.rb +206 -149
  60. data/lib/rubygems/version_option.rb +16 -0
  61. data/test/fake_certlib/openssl.rb +1 -1
  62. data/test/functional.rb +0 -7
  63. data/test/gem_installer_test_case.rb +4 -4
  64. data/test/gem_package_tar_test_case.rb +1 -1
  65. data/test/gemutilities.rb +35 -31
  66. data/test/insure_session.rb +0 -8
  67. data/test/mockgemui.rb +0 -8
  68. data/test/simple_gem.rb +2 -8
  69. data/test/test_config.rb +3 -10
  70. data/test/test_gem.rb +9 -14
  71. data/test/test_gem_builder.rb +1 -7
  72. data/test/test_gem_command.rb +1 -8
  73. data/test/test_gem_command_manager.rb +1 -7
  74. data/test/test_gem_commands_build_command.rb +4 -4
  75. data/test/test_gem_commands_cert_command.rb +1 -2
  76. data/test/test_gem_commands_check_command.rb +1 -7
  77. data/test/test_gem_commands_contents_command.rb +1 -1
  78. data/test/test_gem_commands_dependency_command.rb +17 -31
  79. data/test/test_gem_commands_environment_command.rb +1 -1
  80. data/test/test_gem_commands_fetch_command.rb +14 -12
  81. data/test/test_gem_commands_generate_index_command.rb +1 -1
  82. data/test/test_gem_commands_install_command.rb +22 -20
  83. data/test/test_gem_commands_list_command.rb +1 -1
  84. data/test/test_gem_commands_lock_command.rb +1 -1
  85. data/test/test_gem_commands_mirror_command.rb +5 -5
  86. data/test/test_gem_commands_outdated_command.rb +3 -5
  87. data/test/test_gem_commands_owner_command.rb +105 -0
  88. data/test/test_gem_commands_pristine_command.rb +2 -2
  89. data/test/test_gem_commands_push_command.rb +61 -0
  90. data/test/test_gem_commands_query_command.rb +23 -56
  91. data/test/test_gem_commands_server_command.rb +1 -1
  92. data/test/test_gem_commands_sources_command.rb +1 -70
  93. data/test/test_gem_commands_specification_command.rb +3 -4
  94. data/test/test_gem_commands_stale_command.rb +1 -1
  95. data/test/test_gem_commands_uninstall_command.rb +3 -4
  96. data/test/test_gem_commands_unpack_command.rb +1 -1
  97. data/test/test_gem_commands_update_command.rb +13 -13
  98. data/test/test_gem_commands_which_command.rb +66 -0
  99. data/test/test_gem_config_file.rb +13 -7
  100. data/test/test_gem_dependency.rb +82 -134
  101. data/test/test_gem_dependency_installer.rb +55 -30
  102. data/test/test_gem_dependency_list.rb +28 -7
  103. data/test/test_gem_doc_manager.rb +1 -7
  104. data/test/test_gem_ext_configure_builder.rb +2 -2
  105. data/test/test_gem_ext_ext_conf_builder.rb +1 -1
  106. data/test/test_gem_ext_rake_builder.rb +1 -1
  107. data/test/test_gem_format.rb +14 -11
  108. data/test/test_gem_gem_path_searcher.rb +12 -1
  109. data/test/test_gem_gem_runner.rb +1 -1
  110. data/test/test_gem_gemcutter_utilities.rb +103 -0
  111. data/test/test_gem_indexer.rb +44 -51
  112. data/test/test_gem_install_update_options.rb +1 -7
  113. data/test/test_gem_installer.rb +22 -82
  114. data/test/test_gem_local_remote_options.rb +1 -1
  115. data/test/test_gem_package_tar_header.rb +1 -8
  116. data/test/test_gem_package_tar_input.rb +1 -8
  117. data/test/test_gem_package_tar_output.rb +1 -8
  118. data/test/test_gem_package_tar_reader.rb +1 -8
  119. data/test/test_gem_package_tar_reader_entry.rb +1 -8
  120. data/test/test_gem_package_tar_writer.rb +1 -8
  121. data/test/test_gem_package_task.rb +1 -25
  122. data/test/test_gem_platform.rb +4 -4
  123. data/test/test_gem_remote_fetcher.rb +31 -21
  124. data/test/test_gem_requirement.rb +210 -140
  125. data/test/test_gem_server.rb +36 -1
  126. data/test/test_gem_source_index.rb +7 -13
  127. data/test/test_gem_spec_fetcher.rb +17 -47
  128. data/test/test_gem_specification.rb +7 -20
  129. data/test/test_gem_stream_ui.rb +21 -1
  130. data/test/test_gem_uninstaller.rb +1 -2
  131. data/test/test_gem_validator.rb +2 -8
  132. data/test/test_gem_version.rb +110 -254
  133. data/test/test_gem_version_option.rb +1 -1
  134. data/test/test_kernel.rb +1 -7
  135. data/util/CL2notes +1 -1
  136. data/util/gem_prelude.rb.template +64 -41
  137. metadata +33 -71
  138. metadata.gz.sig +0 -0
  139. data/lib/rubygems/digest/digest_adapter.rb +0 -49
  140. data/lib/rubygems/digest/md5.rb +0 -23
  141. data/lib/rubygems/digest/sha1.rb +0 -22
  142. data/lib/rubygems/digest/sha2.rb +0 -22
  143. data/lib/rubygems/timer.rb +0 -28
  144. data/test/test_gem_digest.rb +0 -46
  145. data/test/test_gem_source_info_cache.rb +0 -447
  146. data/test/test_gem_source_info_cache_entry.rb +0 -78
data/bin/gem CHANGED
@@ -9,10 +9,10 @@ require 'rubygems'
9
9
  require 'rubygems/gem_runner'
10
10
  require 'rubygems/exceptions'
11
11
 
12
- required_version = Gem::Requirement.new "> 1.8.3"
12
+ required_version = Gem::Requirement.new ">= 1.8.6"
13
13
 
14
14
  unless required_version.satisfied_by? Gem.ruby_version then
15
- abort "Expected Ruby Version #{required_version}, was #{Gem.ruby_version}"
15
+ abort "Expected Ruby Version #{required_version}, is #{Gem.ruby_version}"
16
16
  end
17
17
 
18
18
  args = ARGV.clone
@@ -8,19 +8,19 @@
8
8
  require 'rubygems'
9
9
 
10
10
  if ARGV.include? '-h' or ARGV.include? '--help' then
11
- puts "rubygems_update [options]"
12
- puts
13
- puts "This will install the latest version of RubyGems."
14
- puts
15
- puts "\t--version=X.Y\tUpdate rubygems from the X.Y version."
11
+ $stderr.puts "rubygems_update [options]"
12
+ $stderr.puts
13
+ $stderr.puts "This will install the latest version of RubyGems."
14
+ $stderr.puts
15
+ $stderr.puts "\t--version=X.Y\tUpdate rubygems from the X.Y version."
16
16
  exit
17
17
  end
18
18
 
19
19
  unless ARGV.grep(/--version=([\d\.]*)/).empty? then
20
- exec "#{Gem.ruby} -S #{$PROGRAM_NAME} _#{$1}_"
20
+ exec Gem.ruby, '-S', $PROGRAM_NAME, "_#{$1}_"
21
21
  end
22
22
 
23
- update_dir = $LOAD_PATH.find { |fn| fn =~ /rubygems-update/ }
23
+ update_dir = $LOAD_PATH.find { |dir| dir =~ /rubygems-update/ }
24
24
 
25
25
  if update_dir.nil?
26
26
  puts "Error: Cannot find RubyGems Update Path!"
@@ -31,8 +31,6 @@ if update_dir.nil?
31
31
  else
32
32
  update_dir = File.dirname(update_dir)
33
33
  Dir.chdir update_dir
34
- update_dir =~ /([0-9.]*)$/
35
- RGVERSION = $1
36
- puts "Installing RubyGems #{RGVERSION}"
37
- system "#{Gem.ruby} setup.rb #{ARGV.join(' ')}"
34
+ system(Gem.ruby, 'setup.rb', *ARGV)
38
35
  end
36
+
@@ -1,9 +1,10 @@
1
1
  # Project-specific configuration for CruiseControl.rb
2
+ require 'socket'
2
3
 
3
4
  Project.configure do |project|
4
5
 
5
6
  # Send email notifications about broken and fixed builds to email1@your.site, email2@your.site (default: send to nobody)
6
- project.email_notifier.emails = ['rubygems-developers@rubyforge.org']
7
+ project.email_notifier.emails = ['rubygems-developers@rubyforge.org'] if Socket.gethostname =~ /ci.pivotallabs.com/
7
8
 
8
9
  # Set email 'from' field to john@doe.com:
9
10
  project.email_notifier.from = 'devnull+rubygems-ci@pivotallabs.com'
@@ -14,9 +15,9 @@ Project.configure do |project|
14
15
  # Build the project by invoking shell script "build_my_app.sh". Keep in mind that when the script is invoked,
15
16
  # current working directory is <em>[cruise&nbsp;data]</em>/projects/your_project/work, so if you do not keep build_my_app.sh
16
17
  # in version control, it should be '../build_my_app.sh' instead
17
- # project.build_command = 'build_my_app.sh'
18
+ project.build_command = 'rake check_extra_deps default'
18
19
 
19
20
  # Ping Subversion for new revisions every 5 minutes (default: 30 seconds)
20
21
  project.scheduler.polling_interval = 5.minutes
21
22
 
22
- end
23
+ end
@@ -0,0 +1,5 @@
1
+ This directory exists to prevent rubygems-update from being used as real code.
2
+
3
+ If you haven't, you probably want to run `update_rubygems`.
4
+
5
+ You can gem uninstall rubygems-update after doing that.
@@ -1,24 +1,20 @@
1
- #!/usr/bin/env ruby
2
1
  #--
3
2
  # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
4
3
  # All rights reserved.
5
4
  # See LICENSE.txt for permissions.
6
5
  #++
7
6
 
7
+ module RbConfig
8
8
 
9
- module Config
9
+ ##
10
+ # Return the path to the data directory associated with the given package
11
+ # name. Normally this is just
12
+ # "#{RbConfig::CONFIG['datadir']}/#{package_name}", but may be modified by
13
+ # packages like RubyGems to handle versioned data directories.
10
14
 
11
- # Only define datadir if it doesn't already exist.
12
- unless Config.respond_to?(:datadir)
13
-
14
- # Return the path to the data directory associated with the given
15
- # package name. Normally this is just
16
- # "#{Config::CONFIG['datadir']}/#{package_name}", but may be
17
- # modified by packages like RubyGems to handle versioned data
18
- # directories.
19
- def Config.datadir(package_name)
20
- File.join(CONFIG['datadir'], package_name)
21
- end
15
+ def self.datadir(package_name)
16
+ File.join(CONFIG['datadir'], package_name)
17
+ end unless RbConfig.respond_to?(:datadir)
22
18
 
23
- end
24
19
  end
20
+
@@ -9,69 +9,6 @@ require 'rubygems/defaults'
9
9
  require 'thread'
10
10
  require 'etc'
11
11
 
12
- module Gem
13
-
14
- RubyGemsVersion = VERSION = '1.3.5'
15
-
16
- ##
17
- # Raised when RubyGems is unable to load or activate a gem. Contains the
18
- # name and version requirements of the gem that either conflicts with
19
- # already activated gems or that RubyGems is otherwise unable to activate.
20
-
21
- class LoadError < ::LoadError
22
-
23
- ##
24
- # Name of gem
25
-
26
- attr_accessor :name
27
-
28
- ##
29
- # Version requirement of gem
30
-
31
- attr_accessor :version_requirement
32
-
33
- end
34
-
35
- end
36
-
37
- module Kernel
38
-
39
- ##
40
- # Use Kernel#gem to activate a specific version of +gem_name+.
41
- #
42
- # +version_requirements+ is a list of version requirements that the
43
- # specified gem must match, most commonly "= example.version.number". See
44
- # Gem::Requirement for how to specify a version requirement.
45
- #
46
- # If you will be activating the latest version of a gem, there is no need to
47
- # call Kernel#gem, Kernel#require will do the right thing for you.
48
- #
49
- # Kernel#gem returns true if the gem was activated, otherwise false. If the
50
- # gem could not be found, didn't match the version requirements, or a
51
- # different version was already activated, an exception will be raised.
52
- #
53
- # Kernel#gem should be called *before* any require statements (otherwise
54
- # RubyGems may load a conflicting library version).
55
- #
56
- # In older RubyGems versions, the environment variable GEM_SKIP could be
57
- # used to skip activation of specified gems, for example to test out changes
58
- # that haven't been installed yet. Now RubyGems defers to -I and the
59
- # RUBYLIB environment variable to skip activation of a gem.
60
- #
61
- # Example:
62
- #
63
- # GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
64
-
65
- def gem(gem_name, *version_requirements) # :doc:
66
- skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
67
- raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
68
- Gem.activate(gem_name, *version_requirements)
69
- end
70
-
71
- private :gem
72
-
73
- end
74
-
75
12
  ##
76
13
  # RubyGems is the Ruby standard for publishing and managing third party
77
14
  # libraries.
@@ -86,6 +23,7 @@ end
86
23
  #
87
24
  # * {Creating Gems}[http://docs.rubygems.org/read/chapter/5]
88
25
  # * Gem::Specification
26
+ # * Gem::Version for version dependency notes
89
27
  #
90
28
  # Further RubyGems documentation can be found at:
91
29
  #
@@ -96,7 +34,8 @@ end
96
34
  # == RubyGems Plugins
97
35
  #
98
36
  # As of RubyGems 1.3.2, RubyGems will load plugins installed in gems or
99
- # $LOAD_PATH. Plugins must be named 'rubygems_plugin' are discovered via
37
+ # $LOAD_PATH. Plugins must be named 'rubygems_plugin' (.rb, .so, etc) and
38
+ # placed at the root of your gem's #require_path. Plugins are discovered via
100
39
  # Gem::find_files then loaded. Take care when implementing a plugin as your
101
40
  # plugin file may be loaded multiple times if multiple versions of your gem
102
41
  # are installed.
@@ -122,7 +61,7 @@ end
122
61
  # == Bugs
123
62
  #
124
63
  # You can submit bugs to the
125
- # {RubyGems bug tracker}[http://rubyforge.org/tracker/?atid=575&group_id=126&func=browse]
64
+ # {RubyGems bug tracker}[http://rubyforge.org/tracker/?atid=575&group_id=126]
126
65
  # on RubyForge
127
66
  #
128
67
  # == Credits
@@ -131,26 +70,26 @@ end
131
70
  #
132
71
  # RubyGems was originally developed at RubyConf 2003 by:
133
72
  #
134
- # * Rich Kilmer -- rich(at)infoether.com
135
- # * Chad Fowler -- chad(at)chadfowler.com
136
- # * David Black -- dblack(at)wobblini.net
73
+ # * Rich Kilmer -- rich(at)infoether.com
74
+ # * Chad Fowler -- chad(at)chadfowler.com
75
+ # * David Black -- dblack(at)wobblini.net
137
76
  # * Paul Brannan -- paul(at)atdesk.com
138
- # * Jim Weirch -- {jim(at)weirichhouse.org}[mailto:jim@weirichhouse.org]
77
+ # * Jim Weirch -- jim(at)weirichhouse.org
139
78
  #
140
79
  # Contributors:
141
80
  #
142
- # * Gavin Sinclair -- gsinclair(at)soyabean.com.au
143
- # * George Marrows -- george.marrows(at)ntlworld.com
144
- # * Dick Davies -- rasputnik(at)hellooperator.net
81
+ # * Gavin Sinclair -- gsinclair(at)soyabean.com.au
82
+ # * George Marrows -- george.marrows(at)ntlworld.com
83
+ # * Dick Davies -- rasputnik(at)hellooperator.net
145
84
  # * Mauricio Fernandez -- batsman.geo(at)yahoo.com
146
- # * Simon Strandgaard -- neoneye(at)adslhome.dk
147
- # * Dave Glasser -- glasser(at)mit.edu
148
- # * Paul Duncan -- pabs(at)pablotron.org
149
- # * Ville Aine -- vaine(at)cs.helsinki.fi
150
- # * Eric Hodel -- drbrain(at)segment7.net
151
- # * Daniel Berger -- djberg96(at)gmail.com
152
- # * Phil Hagelberg -- technomancy(at)gmail.com
153
- # * Ryan Davis
85
+ # * Simon Strandgaard -- neoneye(at)adslhome.dk
86
+ # * Dave Glasser -- glasser(at)mit.edu
87
+ # * Paul Duncan -- pabs(at)pablotron.org
88
+ # * Ville Aine -- vaine(at)cs.helsinki.fi
89
+ # * Eric Hodel -- drbrain(at)segment7.net
90
+ # * Daniel Berger -- djberg96(at)gmail.com
91
+ # * Phil Hagelberg -- technomancy(at)gmail.com
92
+ # * Ryan Davis -- ryand-ruby(at)zenspider.com
154
93
  #
155
94
  # (If your name is missing, PLEASE let us know!)
156
95
  #
@@ -159,6 +98,20 @@ end
159
98
  # -The RubyGems Team
160
99
 
161
100
  module Gem
101
+ RubyGemsVersion = VERSION = '1.3.6'
102
+
103
+ ##
104
+ # Raised when RubyGems is unable to load or activate a gem. Contains the
105
+ # name and version requirements of the gem that either conflicts with
106
+ # already activated gems or that RubyGems is otherwise unable to activate.
107
+
108
+ class LoadError < ::LoadError
109
+ # Name of gem
110
+ attr_accessor :name
111
+
112
+ # Version requirement of gem
113
+ attr_accessor :version_requirement
114
+ end
162
115
 
163
116
  ##
164
117
  # Configuration settings from ::RbConfig
@@ -166,23 +119,20 @@ module Gem
166
119
  ConfigMap = {} unless defined?(ConfigMap)
167
120
 
168
121
  require 'rbconfig'
169
- # :stopdoc:
170
- RbConfig = Config unless defined? ::RbConfig
171
- # :startdoc:
172
122
 
173
123
  ConfigMap.merge!(
174
- :EXEEXT => RbConfig::CONFIG["EXEEXT"],
175
- :RUBY_SO_NAME => RbConfig::CONFIG["RUBY_SO_NAME"],
176
- :arch => RbConfig::CONFIG["arch"],
177
- :bindir => RbConfig::CONFIG["bindir"],
178
- :datadir => RbConfig::CONFIG["datadir"],
179
- :libdir => RbConfig::CONFIG["libdir"],
124
+ :EXEEXT => RbConfig::CONFIG["EXEEXT"],
125
+ :RUBY_SO_NAME => RbConfig::CONFIG["RUBY_SO_NAME"],
126
+ :arch => RbConfig::CONFIG["arch"],
127
+ :bindir => RbConfig::CONFIG["bindir"],
128
+ :datadir => RbConfig::CONFIG["datadir"],
129
+ :libdir => RbConfig::CONFIG["libdir"],
180
130
  :ruby_install_name => RbConfig::CONFIG["ruby_install_name"],
181
- :ruby_version => RbConfig::CONFIG["ruby_version"],
182
- :sitedir => RbConfig::CONFIG["sitedir"],
183
- :sitelibdir => RbConfig::CONFIG["sitelibdir"],
184
- :vendordir => RbConfig::CONFIG["vendordir"] ,
185
- :vendorlibdir => RbConfig::CONFIG["vendorlibdir"]
131
+ :ruby_version => RbConfig::CONFIG["ruby_version"],
132
+ :sitedir => RbConfig::CONFIG["sitedir"],
133
+ :sitelibdir => RbConfig::CONFIG["sitelibdir"],
134
+ :vendordir => RbConfig::CONFIG["vendordir"] ,
135
+ :vendorlibdir => RbConfig::CONFIG["vendorlibdir"]
186
136
  )
187
137
 
188
138
  ##
@@ -253,11 +203,11 @@ module Gem
253
203
  end
254
204
 
255
205
  unless gem.respond_to?(:name) and
256
- gem.respond_to?(:version_requirements) then
206
+ gem.respond_to?(:requirement) then
257
207
  gem = Gem::Dependency.new(gem, version_requirements)
258
208
  end
259
209
 
260
- matches = Gem.source_index.find_name(gem.name, gem.version_requirements)
210
+ matches = Gem.source_index.find_name(gem.name, gem.requirement)
261
211
  report_activate_error(gem) if matches.empty?
262
212
 
263
213
  if @loaded_specs[gem.name] then
@@ -275,7 +225,7 @@ module Gem
275
225
 
276
226
  e = Gem::LoadError.new msg
277
227
  e.name = gem.name
278
- e.version_requirement = gem.version_requirements
228
+ e.version_requirement = gem.requirement
279
229
 
280
230
  raise e
281
231
  end
@@ -351,7 +301,7 @@ module Gem
351
301
  requirements = Gem::Requirement.default if requirements.empty?
352
302
 
353
303
  unless gem.respond_to?(:name) and
354
- gem.respond_to?(:version_requirements) then
304
+ gem.respond_to?(:requirement) then
355
305
  gem = Gem::Dependency.new gem, requirements
356
306
  end
357
307
 
@@ -546,22 +496,22 @@ module Gem
546
496
  # least on Win32).
547
497
 
548
498
  def self.find_home
549
- ['HOME', 'USERPROFILE'].each do |homekey|
550
- return ENV[homekey] if ENV[homekey]
551
- end
499
+ unless RUBY_VERSION > '1.9' then
500
+ ['HOME', 'USERPROFILE'].each do |homekey|
501
+ return ENV[homekey] if ENV[homekey]
502
+ end
552
503
 
553
- if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then
554
- return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}"
504
+ if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then
505
+ return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}"
506
+ end
555
507
  end
556
508
 
557
- begin
558
- File.expand_path("~")
559
- rescue
560
- if File::ALT_SEPARATOR then
561
- "C:/"
562
- else
563
- "/"
564
- end
509
+ File.expand_path "~"
510
+ rescue
511
+ if File::ALT_SEPARATOR then
512
+ "C:/"
513
+ else
514
+ "/"
565
515
  end
566
516
  end
567
517
 
@@ -815,15 +765,15 @@ module Gem
815
765
 
816
766
  if matches.empty? then
817
767
  error = Gem::LoadError.new(
818
- "Could not find RubyGem #{gem.name} (#{gem.version_requirements})\n")
768
+ "Could not find RubyGem #{gem.name} (#{gem.requirement})\n")
819
769
  else
820
770
  error = Gem::LoadError.new(
821
771
  "RubyGem version error: " +
822
- "#{gem.name}(#{matches.first.version} not #{gem.version_requirements})\n")
772
+ "#{gem.name}(#{matches.first.version} not #{gem.requirement})\n")
823
773
  end
824
774
 
825
775
  error.name = gem.name
826
- error.version_requirement = gem.version_requirements
776
+ error.version_requirement = gem.requirement
827
777
  raise error
828
778
  end
829
779
 
@@ -894,9 +844,8 @@ module Gem
894
844
  # Set the Gem home directory (as reported by Gem.dir).
895
845
 
896
846
  def self.set_home(home)
897
- home = home.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
847
+ home = home.gsub File::ALT_SEPARATOR, File::SEPARATOR if File::ALT_SEPARATOR
898
848
  @gem_home = home
899
- ensure_gem_subdirectories(@gem_home)
900
849
  end
901
850
 
902
851
  private_class_method :set_home
@@ -921,18 +870,6 @@ module Gem
921
870
  end
922
871
 
923
872
  @gem_path.uniq!
924
- @gem_path.each do |path|
925
- if 0 == File.expand_path(path).index(Gem.user_home)
926
- next unless File.directory? Gem.user_home
927
- unless win_platform? then
928
- # only create by matching user
929
- if Etc.getpwuid.nil? || Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid
930
- next
931
- end
932
- end
933
- end
934
- ensure_gem_subdirectories path
935
- end
936
873
  end
937
874
 
938
875
  private_class_method :set_paths
@@ -1085,19 +1022,53 @@ module Gem
1085
1022
 
1086
1023
  end
1087
1024
 
1088
- module Config
1089
- # :stopdoc:
1090
- class << self
1091
- # Return the path to the data directory associated with the named
1092
- # package. If the package is loaded as a gem, return the gem
1093
- # specific data directory. Otherwise return a path to the share
1094
- # area as define by "#{ConfigMap[:datadir]}/#{package_name}".
1095
- def datadir(package_name)
1096
- Gem.datadir(package_name) ||
1097
- File.join(Gem::ConfigMap[:datadir], package_name)
1098
- end
1025
+ module Kernel
1026
+
1027
+ ##
1028
+ # Use Kernel#gem to activate a specific version of +gem_name+.
1029
+ #
1030
+ # +version_requirements+ is a list of version requirements that the
1031
+ # specified gem must match, most commonly "= example.version.number". See
1032
+ # Gem::Requirement for how to specify a version requirement.
1033
+ #
1034
+ # If you will be activating the latest version of a gem, there is no need to
1035
+ # call Kernel#gem, Kernel#require will do the right thing for you.
1036
+ #
1037
+ # Kernel#gem returns true if the gem was activated, otherwise false. If the
1038
+ # gem could not be found, didn't match the version requirements, or a
1039
+ # different version was already activated, an exception will be raised.
1040
+ #
1041
+ # Kernel#gem should be called *before* any require statements (otherwise
1042
+ # RubyGems may load a conflicting library version).
1043
+ #
1044
+ # In older RubyGems versions, the environment variable GEM_SKIP could be
1045
+ # used to skip activation of specified gems, for example to test out changes
1046
+ # that haven't been installed yet. Now RubyGems defers to -I and the
1047
+ # RUBYLIB environment variable to skip activation of a gem.
1048
+ #
1049
+ # Example:
1050
+ #
1051
+ # GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
1052
+
1053
+ def gem(gem_name, *version_requirements) # :doc:
1054
+ skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
1055
+ raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
1056
+ Gem.activate(gem_name, *version_requirements)
1099
1057
  end
1100
- # :startdoc:
1058
+
1059
+ private :gem
1060
+
1061
+ end
1062
+
1063
+ ##
1064
+ # Return the path to the data directory associated with the named package. If
1065
+ # the package is loaded as a gem, return the gem specific data directory.
1066
+ # Otherwise return a path to the share area as define by
1067
+ # "#{ConfigMap[:datadir]}/#{package_name}".
1068
+
1069
+ def RbConfig.datadir(package_name)
1070
+ Gem.datadir(package_name) ||
1071
+ File.join(Gem::ConfigMap[:datadir], package_name)
1101
1072
  end
1102
1073
 
1103
1074
  require 'rubygems/exceptions'
@@ -1132,6 +1103,12 @@ Gem.clear_paths
1132
1103
  plugins = Gem.find_files 'rubygems_plugin'
1133
1104
 
1134
1105
  plugins.each do |plugin|
1106
+
1107
+ # Skip older versions of the GemCutter plugin: Its commands are in
1108
+ # RubyGems proper now.
1109
+
1110
+ next if plugin =~ /gemcutter-0\.[0-3]/
1111
+
1135
1112
  begin
1136
1113
  load plugin
1137
1114
  rescue => e