rubygems-update 0.9.4 → 0.9.5
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.
- data/ChangeLog +587 -0
- data/README +0 -1
- data/Rakefile +39 -12
- data/TODO +0 -5
- data/bin/gem +7 -7
- data/bin/update_rubygems +1 -1
- data/examples/application/an-app.gemspec +1 -1
- data/gemspecs/cgikit-1.1.0.gemspec +1 -2
- data/gemspecs/jabber4r.gemspec +1 -1
- data/gemspecs/linguistics.gemspec +1 -1
- data/gemspecs/ook.gemspec +1 -1
- data/gemspecs/progressbar.gemspec +1 -1
- data/gemspecs/redcloth.gemspec +1 -1
- data/gemspecs/rublog.gemspec +1 -1
- data/gemspecs/ruby-doom.gemspec +1 -1
- data/gemspecs/rubyjdwp.gemspec +1 -1
- data/gemspecs/statistics.gemspec +1 -1
- data/lib/rubygems.rb +167 -105
- data/lib/rubygems/builder.rb +12 -10
- data/lib/rubygems/command.rb +177 -60
- data/lib/rubygems/command_manager.rb +30 -38
- data/lib/rubygems/commands/build_command.rb +42 -46
- data/lib/rubygems/commands/cert_command.rb +72 -69
- data/lib/rubygems/commands/check_command.rb +63 -63
- data/lib/rubygems/commands/cleanup_command.rb +25 -7
- data/lib/rubygems/commands/contents_command.rb +70 -62
- data/lib/rubygems/commands/dependency_command.rb +131 -86
- data/lib/rubygems/commands/environment_command.rb +67 -46
- data/lib/rubygems/commands/fetch_command.rb +62 -0
- data/lib/rubygems/commands/generate_index_command.rb +57 -0
- data/lib/rubygems/commands/help_command.rb +163 -73
- data/lib/rubygems/commands/install_command.rb +114 -128
- data/lib/rubygems/commands/list_command.rb +10 -8
- data/lib/rubygems/commands/lock_command.rb +101 -0
- data/lib/rubygems/commands/mirror_command.rb +105 -0
- data/lib/rubygems/commands/outdated_command.rb +24 -15
- data/lib/rubygems/commands/pristine_command.rb +118 -88
- data/lib/rubygems/commands/query_command.rb +109 -77
- data/lib/rubygems/commands/rdoc_command.rb +13 -10
- data/lib/rubygems/commands/search_command.rb +10 -8
- data/lib/rubygems/commands/server_command.rb +48 -0
- data/lib/rubygems/commands/sources_command.rb +104 -83
- data/lib/rubygems/commands/specification_command.rb +65 -51
- data/lib/rubygems/commands/uninstall_command.rb +17 -12
- data/lib/rubygems/commands/unpack_command.rb +68 -68
- data/lib/rubygems/commands/update_command.rb +72 -25
- data/lib/rubygems/commands/which_command.rb +86 -0
- data/lib/rubygems/config_file.rb +202 -78
- data/lib/rubygems/custom_require.rb +7 -88
- data/lib/rubygems/dependency.rb +65 -0
- data/lib/rubygems/dependency_installer.rb +232 -0
- data/lib/rubygems/dependency_list.rb +133 -105
- data/lib/rubygems/digest/md5.rb +4 -1
- data/lib/rubygems/digest/sha2.rb +1 -1
- data/lib/rubygems/doc_manager.rb +41 -19
- data/lib/rubygems/exceptions.rb +63 -0
- data/lib/rubygems/ext.rb +18 -0
- data/lib/rubygems/ext/builder.rb +56 -0
- data/lib/rubygems/ext/configure_builder.rb +24 -0
- data/lib/rubygems/ext/ext_conf_builder.rb +23 -0
- data/lib/rubygems/ext/rake_builder.rb +27 -0
- data/lib/rubygems/format.rb +16 -6
- data/lib/rubygems/gem_openssl.rb +43 -6
- data/lib/rubygems/gem_path_searcher.rb +84 -0
- data/lib/rubygems/gem_runner.rb +20 -5
- data/lib/rubygems/indexer.rb +163 -0
- data/lib/rubygems/indexer/abstract_index_builder.rb +80 -0
- data/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
- data/lib/rubygems/indexer/master_index_builder.rb +53 -0
- data/lib/rubygems/indexer/quick_index_builder.rb +48 -0
- data/lib/rubygems/install_update_options.rb +87 -0
- data/lib/rubygems/installer.rb +316 -562
- data/lib/rubygems/local_remote_options.rb +106 -0
- data/lib/rubygems/old_format.rb +5 -13
- data/lib/rubygems/open-uri.rb +2 -0
- data/lib/rubygems/package.rb +28 -32
- data/lib/rubygems/platform.rb +187 -0
- data/lib/rubygems/remote_fetcher.rb +46 -29
- data/lib/rubygems/remote_installer.rb +11 -18
- data/lib/rubygems/requirement.rb +157 -0
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +715 -457
- data/lib/rubygems/server.rb +77 -59
- data/lib/rubygems/source_index.rb +154 -83
- data/lib/rubygems/source_info_cache.rb +73 -30
- data/lib/rubygems/source_info_cache_entry.rb +12 -3
- data/lib/rubygems/specification.rb +378 -145
- data/lib/rubygems/uninstaller.rb +183 -0
- data/lib/rubygems/user_interaction.rb +38 -9
- data/lib/rubygems/validator.rb +53 -24
- data/lib/rubygems/version.rb +126 -289
- data/lib/rubygems/version_option.rb +49 -0
- data/pkgs/sources/lib/sources.rb +1 -4
- data/pkgs/sources/sources.gemspec +3 -3
- data/scripts/gemdoc.rb +0 -1
- data/setup.rb +166 -1505
- data/test/bogussources.rb +0 -1
- data/test/data/gem-private_key.pem +27 -0
- data/test/data/gem-public_cert.pem +20 -0
- data/test/functional.rb +3 -105
- data/test/gemutilities.rb +145 -24
- data/test/insure_session.rb +0 -1
- data/test/{test_datadir.rb → test_config.rb} +7 -13
- data/test/test_gem.rb +360 -9
- data/test/test_gem_builder.rb +34 -0
- data/test/{test_command.rb → test_gem_command.rb} +119 -62
- data/test/{test_parse_commands.rb → test_gem_command_manager.rb} +64 -40
- data/test/test_gem_commands_build_command.rb +75 -0
- data/test/test_gem_commands_cert_command.rb +122 -0
- data/test/test_gem_commands_check_command.rb +25 -0
- data/test/test_gem_commands_contents_command.rb +92 -0
- data/test/test_gem_commands_dependency_command.rb +108 -0
- data/test/test_gem_commands_environment_command.rb +117 -0
- data/test/test_gem_commands_fetch_command.rb +34 -0
- data/test/test_gem_commands_generate_index_command.rb +32 -0
- data/test/test_gem_commands_install_command.rb +160 -0
- data/test/test_gem_commands_mirror_command.rb +56 -0
- data/test/test_gem_commands_pristine_command.rb +100 -0
- data/test/test_gem_commands_query_command.rb +82 -0
- data/test/test_gem_commands_sources_command.rb +147 -0
- data/test/test_gem_commands_specification_command.rb +93 -0
- data/test/test_gem_commands_unpack_command.rb +55 -0
- data/test/test_gem_config_file.rb +210 -0
- data/test/test_gem_dependency.rb +89 -0
- data/test/test_gem_dependency_installer.rb +542 -0
- data/test/test_gem_dependency_list.rb +212 -0
- data/test/test_gem_doc_manager.rb +32 -0
- data/test/test_gem_ext_configure_builder.rb +13 -17
- data/test/test_gem_ext_ext_conf_builder.rb +9 -9
- data/test/test_gem_ext_rake_builder.rb +23 -11
- data/test/test_gem_format.rb +69 -0
- data/test/test_gem_gem_path_searcher.rb +57 -0
- data/test/test_gem_gem_runner.rb +35 -0
- data/test/test_gem_indexer.rb +119 -0
- data/test/test_gem_install_update_options.rb +40 -0
- data/test/test_gem_installer.rb +796 -0
- data/test/test_gem_local_remote_options.rb +84 -0
- data/test/test_gem_outdated_command.rb +11 -9
- data/test/test_gem_platform.rb +240 -0
- data/test/{test_remote_fetcher.rb → test_gem_remote_fetcher.rb} +124 -55
- data/test/{test_remote_installer.rb → test_gem_remote_installer.rb} +3 -4
- data/test/test_gem_requirement.rb +223 -0
- data/test/test_gem_server.rb +71 -0
- data/test/test_gem_source_index.rb +429 -0
- data/test/test_gem_source_info_cache.rb +79 -17
- data/test/test_gem_source_info_cache_entry.rb +11 -9
- data/test/test_gem_specification.rb +738 -0
- data/test/test_gem_stream_ui.rb +117 -0
- data/test/test_gem_validator.rb +70 -0
- data/test/test_gem_version.rb +191 -0
- data/test/test_gem_version_option.rb +77 -0
- data/test/{test_require_gem.rb → test_kernel.rb} +19 -12
- data/test/test_open_uri.rb +1 -2
- data/test/test_package.rb +45 -34
- metadata +116 -141
- data/Releases +0 -127
- data/bin/gem_mirror +0 -73
- data/bin/gem_server +0 -6
- data/bin/gemlock +0 -127
- data/bin/gemri +0 -24
- data/bin/gemwhich +0 -89
- data/bin/index_gem_repository.rb +0 -302
- data/lib/gemconfigure.rb +0 -24
- data/lib/rubygems/gem_commands.rb +0 -273
- data/pkgs/sources/sources-0.0.1.gem +0 -0
- data/post-install.rb +0 -121
- data/test/brokenbuildgem.rb +0 -35
- data/test/data/PostMessage-0.0.1.gem +0 -0
- data/test/data/a-0.0.1.gem +0 -0
- data/test/data/a-0.0.2.gem +0 -0
- data/test/data/b-0.0.2.gem +0 -0
- data/test/data/broken-1.0.0.gem +0 -0
- data/test/data/broken_build/broken-build.gemspec +0 -20
- data/test/data/broken_build/ext/extconf.rb +0 -3
- data/test/data/broken_build/ext/foo.c +0 -1
- data/test/data/c-1.2.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/c-1.2.gem +0 -0
- data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +0 -1
- data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +0 -1
- data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +0 -1
- data/test/data/gemhome/gems/c-1.2/lib/code.rb +0 -1
- data/test/data/gemhome/specifications/a-0.0.1.gemspec +0 -8
- data/test/data/gemhome/specifications/a-0.0.2.gemspec +0 -8
- data/test/data/gemhome/specifications/b-0.0.2.gemspec +0 -8
- data/test/data/gemhome/specifications/c-1.2.gemspec +0 -8
- data/test/data/legacy/keyedlist-0.4.0.ruby +0 -11
- data/test/data/legacy/keyedlist-0.4.0.yaml +0 -16
- data/test/data/lib/code.rb +0 -1
- data/test/data/one/README.one +0 -1
- data/test/data/one/lib/one.rb +0 -9
- data/test/data/one/one-0.0.1.gem +0 -0
- data/test/data/one/one.gemspec +0 -17
- data/test/data/one/one.yaml +0 -40
- data/test/data/post_install.gemspec +0 -19
- data/test/functional_extension_gems.rb +0 -48
- data/test/functional_generate_yaml_index.rb +0 -104
- data/test/gemenvironment.rb +0 -59
- data/test/io_capture.rb +0 -33
- data/test/mock/gems/gems/sources-0.0.1/lib/sources.rb +0 -11
- data/test/mock/gems/specifications/sources-0.0.1.gemspec +0 -8
- data/test/onegem.rb +0 -35
- data/test/test_builder.rb +0 -34
- data/test/test_check_command.rb +0 -34
- data/test/test_configfile.rb +0 -42
- data/test/test_dependency_list.rb +0 -169
- data/test/test_file_list.rb +0 -101
- data/test/test_format.rb +0 -49
- data/test/test_gem_sources_command.rb +0 -135
- data/test/test_gemloadpaths.rb +0 -51
- data/test/test_gempaths.rb +0 -170
- data/test/test_installer.rb +0 -369
- data/test/test_loadmanager.rb +0 -48
- data/test/test_process_commands.rb +0 -52
- data/test/test_source_index.rb +0 -231
- data/test/test_specific_extras.rb +0 -46
- data/test/test_specification.rb +0 -565
- data/test/test_user_interaction.rb +0 -48
- data/test/test_validator.rb +0 -59
- data/test/test_version_comparison.rb +0 -321
- data/test/testgem.rc +0 -7
- data/test/user_capture.rb +0 -7
- data/test/yaml_data.rb +0 -63
data/README
CHANGED
data/Rakefile
CHANGED
@@ -192,14 +192,9 @@ end
|
|
192
192
|
|
193
193
|
# --------------------------------------------------------------------
|
194
194
|
|
195
|
-
begin
|
195
|
+
begin # rcov
|
196
196
|
require 'rcov/rcovtask'
|
197
|
-
HAVE_RCOV = true
|
198
|
-
rescue LoadError
|
199
|
-
HAVE_RCOV = false
|
200
|
-
end
|
201
197
|
|
202
|
-
if HAVE_RCOV
|
203
198
|
Rcov::RcovTask.new do |t|
|
204
199
|
t.libs << "test"
|
205
200
|
t.rcov_opts = ['-xRakefile', '-xrakefile', '-xpublish.rf', '--text-report']
|
@@ -208,6 +203,7 @@ if HAVE_RCOV
|
|
208
203
|
]
|
209
204
|
t.verbose = true
|
210
205
|
end
|
206
|
+
rescue LoadError
|
211
207
|
end
|
212
208
|
|
213
209
|
# --------------------------------------------------------------------
|
@@ -218,8 +214,9 @@ rd = Rake::RDocTask.new("rdoc") { |rdoc|
|
|
218
214
|
rdoc.rdoc_dir = 'html'
|
219
215
|
rdoc.title = "RubyGems"
|
220
216
|
rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
|
221
|
-
rdoc.rdoc_files.include('README', 'TODO', '
|
217
|
+
rdoc.rdoc_files.include('README', 'TODO', 'LICENSE.txt', 'GPL.txt')
|
222
218
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
219
|
+
rdoc.rdoc_files.include('doc/**/*.rdoc')
|
223
220
|
# rdoc.rdoc_files.include('test/**/*.rb')
|
224
221
|
}
|
225
222
|
|
@@ -260,10 +257,9 @@ end
|
|
260
257
|
# Package tasks
|
261
258
|
|
262
259
|
PKG_FILES = FileList[
|
263
|
-
"Rakefile", "ChangeLog", "
|
260
|
+
"Rakefile", "ChangeLog", "TODO", "README", "LICENSE.txt",
|
264
261
|
"GPL.txt",
|
265
262
|
"setup.rb",
|
266
|
-
"post-install.rb",
|
267
263
|
"bin/*",
|
268
264
|
"doc/*.css", "doc/*.rb",
|
269
265
|
"examples/**/*",
|
@@ -325,9 +321,7 @@ end
|
|
325
321
|
|
326
322
|
desc "Install RubyGems"
|
327
323
|
task :install do
|
328
|
-
ruby 'setup.rb
|
329
|
-
ruby 'setup.rb setup'
|
330
|
-
ruby 'setup.rb install'
|
324
|
+
ruby 'setup.rb'
|
331
325
|
end
|
332
326
|
|
333
327
|
# Run 'gem' (using local bin and lib directories).
|
@@ -373,3 +367,36 @@ task :rubyfiles do
|
|
373
367
|
end
|
374
368
|
|
375
369
|
task :rf => :rubyfiles
|
370
|
+
|
371
|
+
# These tasks expect to have the following directory structure:
|
372
|
+
#
|
373
|
+
# ruby/trunk # ruby subversion HEAD checkout
|
374
|
+
# rubygems/trunk # RubyGems subversion HEAD checkout
|
375
|
+
#
|
376
|
+
# If you don't have this directory structure, set RUBY_PATH.
|
377
|
+
|
378
|
+
desc "Updates Ruby HEAD with the currently checked-out copy of RubyGems."
|
379
|
+
task :update_ruby do
|
380
|
+
ruby_dir = ENV['RUBY_PATH'] || '../../ruby/trunk'
|
381
|
+
|
382
|
+
options = "-avP --exclude '*svn*' --exclude '*swp'"
|
383
|
+
|
384
|
+
sh "rsync #{options} bin/gem #{ruby_dir}/bin/gem"
|
385
|
+
sh "rsync #{options} lib/ #{ruby_dir}/lib"
|
386
|
+
sh "rsync #{options} test/ #{ruby_dir}/test/rubygems"
|
387
|
+
end
|
388
|
+
|
389
|
+
desc "Diffs Ruby HEAD with the currently checked-out copy of RubyGems."
|
390
|
+
task :diff_ruby do
|
391
|
+
ruby_dir = ENV['RUBY_PATH'] || '../../ruby/trunk'
|
392
|
+
|
393
|
+
options = "-urpN --exclude '*svn*' --exclude '*swp'"
|
394
|
+
|
395
|
+
sh "diff #{options} bin/gem #{ruby_dir}/bin/gem; true"
|
396
|
+
sh "diff #{options} lib/ubygems.rb #{ruby_dir}/lib/ubygems.rb; true"
|
397
|
+
sh "diff #{options} lib/rubygems.rb #{ruby_dir}/lib/rubygems.rb; true"
|
398
|
+
sh "diff #{options} lib/rubygems #{ruby_dir}/lib/rubygems; true"
|
399
|
+
sh "diff #{options} lib/rbconfig #{ruby_dir}/lib/rbconfig; true"
|
400
|
+
sh "diff #{options} test #{ruby_dir}/test/rubygems; true"
|
401
|
+
end
|
402
|
+
|
data/TODO
CHANGED
@@ -1,6 +1 @@
|
|
1
|
-
* support for installing binary (pre-compiled), platform-dependent gems. This already works as long as you pick the right gem manually, but I'd like the remote installer to intelligently select the right one and for the installer to throw an error (or a warning) if you attempt o install (e.g.) a Windows gem on a linux system. Requires a lot of data to be collected on platform dependency fulfillment.
|
2
|
-
* syncing gem repositories
|
3
1
|
* optional dependencies: "semitar can use REXML, but it works better if you have the ruby raptor library installed", or not so optional as in: "you need Ruby/RSS > = 1.0 OR rss > 0.91 for this library to work"
|
4
|
-
* Integration with platform-native packaging systems
|
5
|
-
* MD5 summing stuff doesn't work right on the new format (0.8.0+)
|
6
|
-
* Rethink testing strategy. May need to write a document describing how to avoid doing things in unit tests that won't work outside of `pwd`
|
data/bin/gem
CHANGED
@@ -5,14 +5,13 @@
|
|
5
5
|
# See LICENSE.txt for permissions.
|
6
6
|
#++
|
7
7
|
|
8
|
-
|
9
8
|
require 'rubygems'
|
10
|
-
|
9
|
+
require 'rubygems/gem_runner'
|
10
|
+
|
11
|
+
required_version = Gem::Requirement.new ">= 1.8.2"
|
11
12
|
|
12
|
-
required_version
|
13
|
-
|
14
|
-
puts "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"
|
15
|
-
exit(1)
|
13
|
+
unless required_version.satisfied_by? Gem::Version.new(RUBY_VERSION) then
|
14
|
+
abort "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"
|
16
15
|
end
|
17
16
|
|
18
17
|
# We need to preserve the original ARGV to use for passing gem options
|
@@ -20,4 +19,5 @@ end
|
|
20
19
|
# it...its for the source building process.
|
21
20
|
args = !ARGV.include?("--") ? ARGV.clone : ARGV[0...ARGV.index("--")]
|
22
21
|
|
23
|
-
Gem::GemRunner.new.run
|
22
|
+
Gem::GemRunner.new.run args
|
23
|
+
|
data/bin/update_rubygems
CHANGED
@@ -10,7 +10,7 @@ update_dir = $LOAD_PATH.find { |fn| fn =~ /rubygems-update/ }
|
|
10
10
|
|
11
11
|
if update_dir.nil?
|
12
12
|
puts "Error: Cannot find RubyGems Update Path!"
|
13
|
-
puts
|
13
|
+
puts
|
14
14
|
puts "RubyGems has already been updated."
|
15
15
|
puts "The rubygems-update gem may now be uninstalled."
|
16
16
|
puts "E.g. gem uninstall rubygems-update"
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
Gem::manage_gems
|
3
2
|
|
4
3
|
spec = Gem::Specification.new do |s|
|
5
4
|
s.name = 'cgikit'
|
@@ -13,6 +12,6 @@ spec = Gem::Specification.new do |s|
|
|
13
12
|
s.homepage = 'http://www.spice-of-life.net/download/cgikit/'
|
14
13
|
end
|
15
14
|
if $0==__FILE__
|
16
|
-
|
15
|
+
require 'rubygems/builder'
|
17
16
|
Gem::Builder.new(spec).build
|
18
17
|
end
|
data/gemspecs/jabber4r.gemspec
CHANGED
data/gemspecs/ook.gemspec
CHANGED
data/gemspecs/redcloth.gemspec
CHANGED
data/gemspecs/rublog.gemspec
CHANGED
data/gemspecs/ruby-doom.gemspec
CHANGED
data/gemspecs/rubyjdwp.gemspec
CHANGED
data/gemspecs/statistics.gemspec
CHANGED
data/lib/rubygems.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# -*- ruby -*-
|
3
|
-
|
4
2
|
#--
|
5
3
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
6
4
|
# All rights reserved.
|
@@ -8,6 +6,8 @@
|
|
8
6
|
#++
|
9
7
|
|
10
8
|
require 'rbconfig'
|
9
|
+
require 'rubygems/rubygems_version'
|
10
|
+
require 'thread'
|
11
11
|
|
12
12
|
module Gem
|
13
13
|
class LoadError < ::LoadError
|
@@ -38,13 +38,13 @@ module Kernel
|
|
38
38
|
# gem:: [String or Gem::Dependency] The gem name or dependency
|
39
39
|
# instance.
|
40
40
|
#
|
41
|
-
# version_requirement:: [default=">= 0
|
41
|
+
# version_requirement:: [default=">= 0"] The version
|
42
42
|
# requirement.
|
43
43
|
#
|
44
44
|
# return:: [Boolean] true if the Gem is loaded, otherwise false.
|
45
45
|
#
|
46
46
|
# raises:: [Gem::LoadError] if Gem cannot be found, is listed in
|
47
|
-
# GEM_SKIP, or version requirement not met.
|
47
|
+
# GEM_SKIP, or version requirement not met.
|
48
48
|
#
|
49
49
|
def gem(gem_name, *version_requirements)
|
50
50
|
active_gem_with_options(gem_name, version_requirements)
|
@@ -81,54 +81,127 @@ end
|
|
81
81
|
# Main module to hold all RubyGem classes/modules.
|
82
82
|
#
|
83
83
|
module Gem
|
84
|
-
require 'rubygems/rubygems_version.rb'
|
85
|
-
require 'thread'
|
86
84
|
|
87
85
|
MUTEX = Mutex.new
|
88
86
|
|
89
|
-
|
87
|
+
RubyGemsPackageVersion = RubyGemsVersion
|
88
|
+
|
89
|
+
DIRECTORIES = %w[cache doc gems specifications]
|
90
|
+
|
91
|
+
@@source_index = nil
|
92
|
+
@@win_platform = nil
|
93
|
+
|
94
|
+
@configuration = nil
|
95
|
+
@loaded_specs = {}
|
96
|
+
@platforms = nil
|
97
|
+
@ruby = nil
|
98
|
+
@sources = []
|
99
|
+
|
100
|
+
# Reset the +dir+ and +path+ values. The next time +dir+ or +path+
|
101
|
+
# is requested, the values will be calculated from scratch. This is
|
102
|
+
# mainly used by the unit tests to provide test isolation.
|
103
|
+
#
|
104
|
+
def self.clear_paths
|
105
|
+
@gem_home = nil
|
106
|
+
@gem_path = nil
|
107
|
+
@@source_index = nil
|
108
|
+
MUTEX.synchronize do
|
109
|
+
@searcher = nil
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# The version of the Marshal format for your Ruby.
|
114
|
+
def self.marshal_version
|
115
|
+
"#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# The directory prefix this RubyGems was installed at.
|
120
|
+
|
121
|
+
def self.prefix
|
122
|
+
prefix = File.dirname File.expand_path(__FILE__)
|
123
|
+
if prefix == Config::CONFIG['sitelibdir'] then
|
124
|
+
nil
|
125
|
+
else
|
126
|
+
File.dirname prefix
|
127
|
+
end
|
90
128
|
end
|
91
129
|
|
92
|
-
|
130
|
+
# Returns an Cache of specifications that are in the Gem.path
|
131
|
+
#
|
132
|
+
# return:: [Gem::SourceIndex] Index of installed Gem::Specifications
|
133
|
+
#
|
134
|
+
def self.source_index
|
135
|
+
@@source_index ||= SourceIndex.from_installed_gems
|
93
136
|
end
|
94
137
|
|
95
|
-
|
138
|
+
##
|
139
|
+
# An Array of Regexps that match windows ruby platforms.
|
96
140
|
|
97
|
-
|
98
|
-
|
99
|
-
|
141
|
+
WIN_PATTERNS = [
|
142
|
+
/bccwin/i,
|
143
|
+
/cygwin/i,
|
144
|
+
/djgpp/i,
|
145
|
+
/mingw/i,
|
146
|
+
/mswin/i,
|
147
|
+
/wince/i,
|
148
|
+
]
|
149
|
+
|
150
|
+
##
|
151
|
+
# Is this a windows platform?
|
152
|
+
|
153
|
+
def self.win_platform?
|
154
|
+
if @@win_platform.nil? then
|
155
|
+
@@win_platform = !!WIN_PATTERNS.find { |r| RUBY_PLATFORM =~ r }
|
156
|
+
end
|
157
|
+
|
158
|
+
@@win_platform
|
159
|
+
end
|
100
160
|
|
101
|
-
@configuration = nil
|
102
|
-
@loaded_specs = {}
|
103
|
-
|
104
161
|
class << self
|
105
162
|
|
106
163
|
attr_reader :loaded_specs
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
require '
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
require 'rubygems/config_file'
|
164
|
+
|
165
|
+
# Quietly ensure the named Gem directory contains all the proper
|
166
|
+
# subdirectories. If we can't create a directory due to a permission
|
167
|
+
# problem, then we will silently continue.
|
168
|
+
def ensure_gem_subdirectories(gemdir)
|
169
|
+
require 'fileutils'
|
170
|
+
|
171
|
+
Gem::DIRECTORIES.each do |filename|
|
172
|
+
fn = File.join gemdir, filename
|
173
|
+
FileUtils.mkdir_p fn rescue nil unless File.exist? fn
|
174
|
+
end
|
119
175
|
end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
176
|
+
|
177
|
+
def platforms
|
178
|
+
@platforms ||= [Gem::Platform::RUBY, Gem::Platform.local]
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns an Array of sources to fetch remote gems from. If the sources
|
182
|
+
# list is empty, attempts to load the "sources" gem, then uses
|
183
|
+
# default_sources if it is not installed.
|
184
|
+
def sources
|
185
|
+
if @sources.empty? then
|
186
|
+
begin
|
187
|
+
gem 'sources', '> 0.0.1'
|
188
|
+
require 'sources'
|
189
|
+
rescue LoadError
|
190
|
+
@sources = default_sources
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
@sources
|
195
|
+
end
|
196
|
+
|
197
|
+
# An Array of the default sources that come with RubyGems.
|
198
|
+
def default_sources
|
199
|
+
%w[http://gems.rubyforge.org]
|
127
200
|
end
|
128
201
|
|
129
202
|
# Provide an alias for the old name.
|
130
203
|
alias cache source_index
|
131
|
-
|
204
|
+
|
132
205
|
# The directory path where Gems are to be installed.
|
133
206
|
#
|
134
207
|
# return:: [String] The directory path
|
@@ -138,15 +211,15 @@ module Gem
|
|
138
211
|
set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
|
139
212
|
@gem_home
|
140
213
|
end
|
141
|
-
|
214
|
+
|
142
215
|
# The directory path where executables are to be installed.
|
143
216
|
#
|
144
217
|
def bindir(install_dir=Gem.dir)
|
145
|
-
return File.join(install_dir, 'bin') unless
|
218
|
+
return File.join(install_dir, 'bin') unless
|
219
|
+
install_dir.to_s == Gem.default_dir
|
146
220
|
|
147
221
|
if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
|
148
|
-
|
149
|
-
File.basename(Config::CONFIG["bindir"]))
|
222
|
+
'/usr/bin'
|
150
223
|
else # generic install
|
151
224
|
Config::CONFIG['bindir']
|
152
225
|
end
|
@@ -158,7 +231,11 @@ module Gem
|
|
158
231
|
#
|
159
232
|
def path
|
160
233
|
@gem_path ||= nil
|
161
|
-
|
234
|
+
unless @gem_path
|
235
|
+
paths = [ENV['GEM_PATH']]
|
236
|
+
paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
|
237
|
+
set_paths(paths.compact.join(File::PATH_SEPARATOR))
|
238
|
+
end
|
162
239
|
@gem_path
|
163
240
|
end
|
164
241
|
|
@@ -175,21 +252,8 @@ module Gem
|
|
175
252
|
# The standard configuration object for gems.
|
176
253
|
def configuration
|
177
254
|
return @configuration if @configuration
|
178
|
-
|
179
|
-
@configuration =
|
180
|
-
class << @configuration
|
181
|
-
undef_method :verbose # HACK RakeFileUtils pollution
|
182
|
-
end if @configuration.respond_to? :verbose
|
183
|
-
|
184
|
-
def @configuration.method_missing(sym, *args, &block)
|
185
|
-
if args.empty?
|
186
|
-
self[sym]
|
187
|
-
else
|
188
|
-
super
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
@configuration
|
255
|
+
require 'rubygems/config_file'
|
256
|
+
@configuration = Gem::ConfigFile.new []
|
193
257
|
end
|
194
258
|
|
195
259
|
# Use the given configuration object (which implements the
|
@@ -206,7 +270,7 @@ module Gem
|
|
206
270
|
File.join(spec.full_gem_path, 'data', gem_name)
|
207
271
|
end
|
208
272
|
|
209
|
-
# Return the searcher object to search for matching gems.
|
273
|
+
# Return the searcher object to search for matching gems.
|
210
274
|
def searcher
|
211
275
|
MUTEX.synchronize do
|
212
276
|
@searcher ||= Gem::GemPathSearcher.new
|
@@ -215,7 +279,13 @@ module Gem
|
|
215
279
|
|
216
280
|
# Return the Ruby command to use to execute the Ruby interpreter.
|
217
281
|
def ruby
|
218
|
-
|
282
|
+
if @ruby.nil? then
|
283
|
+
@ruby = File.join(Config::CONFIG['bindir'],
|
284
|
+
Config::CONFIG['ruby_install_name'])
|
285
|
+
@ruby << Config::CONFIG['EXEEXT']
|
286
|
+
end
|
287
|
+
|
288
|
+
@ruby
|
219
289
|
end
|
220
290
|
|
221
291
|
# Activate a gem (i.e. add it to the Ruby load path). The gem
|
@@ -227,9 +297,10 @@ module Gem
|
|
227
297
|
# already loaded, or an exception otherwise.
|
228
298
|
#
|
229
299
|
def activate(gem, autorequire, *version_requirements)
|
230
|
-
|
231
|
-
version_requirements =
|
300
|
+
if version_requirements.empty? then
|
301
|
+
version_requirements = Gem::Requirement.default
|
232
302
|
end
|
303
|
+
|
233
304
|
unless gem.respond_to?(:name) && gem.respond_to?(:version_requirements)
|
234
305
|
gem = Gem::Dependency.new(gem, version_requirements)
|
235
306
|
end
|
@@ -291,7 +362,8 @@ module Gem
|
|
291
362
|
# are not gems of any version by the requested name.
|
292
363
|
def report_activate_error(gem)
|
293
364
|
matches = Gem.source_index.find_name(gem.name)
|
294
|
-
|
365
|
+
|
366
|
+
if matches.empty? then
|
295
367
|
error = Gem::LoadError.new(
|
296
368
|
"Could not find RubyGem #{gem.name} (#{gem.version_requirements})\n")
|
297
369
|
else
|
@@ -299,22 +371,13 @@ module Gem
|
|
299
371
|
"RubyGem version error: " +
|
300
372
|
"#{gem.name}(#{matches.first.version} not #{gem.version_requirements})\n")
|
301
373
|
end
|
374
|
+
|
302
375
|
error.name = gem.name
|
303
376
|
error.version_requirement = gem.version_requirements
|
304
377
|
raise error
|
305
378
|
end
|
306
379
|
private :report_activate_error
|
307
380
|
|
308
|
-
# Reset the +dir+ and +path+ values. The next time +dir+ or +path+
|
309
|
-
# is requested, the values will be calculated from scratch. This is
|
310
|
-
# mainly used by the unit tests to provide test isolation.
|
311
|
-
#
|
312
|
-
def clear_paths
|
313
|
-
@gem_home = nil
|
314
|
-
@gem_path = nil
|
315
|
-
@@source_index = nil
|
316
|
-
end
|
317
|
-
|
318
381
|
# Use the +home+ and (optional) +paths+ values for +dir+ and +path+.
|
319
382
|
# Used mainly by the unit tests to provide environment isolation.
|
320
383
|
#
|
@@ -323,7 +386,7 @@ module Gem
|
|
323
386
|
set_home(home) if home
|
324
387
|
set_paths(paths.join(File::PATH_SEPARATOR)) if paths
|
325
388
|
end
|
326
|
-
|
389
|
+
|
327
390
|
# Return a list of all possible load paths for all versions for
|
328
391
|
# all gems in the Gem installation.
|
329
392
|
#
|
@@ -350,13 +413,13 @@ module Gem
|
|
350
413
|
end
|
351
414
|
|
352
415
|
def required_location(gemname, libfile, *version_constraints)
|
353
|
-
version_constraints =
|
416
|
+
version_constraints = Gem::Requirement.default if version_constraints.empty?
|
354
417
|
matches = Gem.source_index.find_name(gemname, version_constraints)
|
355
418
|
return nil if matches.empty?
|
356
419
|
spec = matches.last
|
357
420
|
spec.require_paths.each do |path|
|
358
421
|
result = File.join(spec.full_gem_path, path, libfile)
|
359
|
-
return result if File.
|
422
|
+
return result if File.exist?(result)
|
360
423
|
end
|
361
424
|
nil
|
362
425
|
end
|
@@ -369,8 +432,14 @@ module Gem
|
|
369
432
|
@suffix_pattern ||= "{#{suffixes.join(',')}}"
|
370
433
|
end
|
371
434
|
|
435
|
+
# manage_gems is useless and deprecated. Don't call it anymore. This
|
436
|
+
# will warn in two releases.
|
437
|
+
def manage_gems
|
438
|
+
# do nothing
|
439
|
+
end
|
440
|
+
|
372
441
|
private
|
373
|
-
|
442
|
+
|
374
443
|
# Return all the partial paths in the given +gemdir+.
|
375
444
|
def all_partials(gemdir)
|
376
445
|
Dir[File.join(gemdir, 'gems/*')]
|
@@ -381,11 +450,12 @@ module Gem
|
|
381
450
|
latest = {}
|
382
451
|
all_partials(gemdir).each do |gp|
|
383
452
|
base = File.basename(gp)
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
453
|
+
if base =~ /(.*)-((\d+\.)*\d+)/ then
|
454
|
+
name, version = $1, $2
|
455
|
+
ver = Gem::Version.new(version)
|
456
|
+
if latest[name].nil? || ver > latest[name][0]
|
457
|
+
latest[name] = [ver, gp]
|
458
|
+
end
|
389
459
|
end
|
390
460
|
end
|
391
461
|
latest.collect { |k,v| v[1] }
|
@@ -393,7 +463,7 @@ module Gem
|
|
393
463
|
|
394
464
|
# Expand each partial gem path with each of the required paths
|
395
465
|
# specified in the Gem spec. Each expanded path is yielded.
|
396
|
-
def each_load_path(partials)
|
466
|
+
def each_load_path(partials)
|
397
467
|
partials.each do |gp|
|
398
468
|
base = File.basename(gp)
|
399
469
|
specfn = File.join(dir, "specifications", base + ".gemspec")
|
@@ -414,7 +484,7 @@ module Gem
|
|
414
484
|
@gem_home = home
|
415
485
|
ensure_gem_subdirectories(@gem_home)
|
416
486
|
end
|
417
|
-
|
487
|
+
|
418
488
|
# Set the Gem search path (as reported by +path+).
|
419
489
|
def set_paths(gpaths)
|
420
490
|
if gpaths
|
@@ -422,11 +492,11 @@ module Gem
|
|
422
492
|
@gem_path << Gem.dir
|
423
493
|
else
|
424
494
|
@gem_path = [Gem.dir]
|
425
|
-
end
|
495
|
+
end
|
426
496
|
@gem_path.uniq!
|
427
497
|
@gem_path.each do |gp| ensure_gem_subdirectories(gp) end
|
428
498
|
end
|
429
|
-
|
499
|
+
|
430
500
|
# Some comments from the ruby-talk list regarding finding the home
|
431
501
|
# directory:
|
432
502
|
#
|
@@ -452,37 +522,22 @@ module Gem
|
|
452
522
|
end
|
453
523
|
end
|
454
524
|
end
|
455
|
-
|
525
|
+
|
456
526
|
public
|
457
527
|
|
458
528
|
# Default home directory path to be used if an alternate value is
|
459
529
|
# not specified in the environment.
|
460
530
|
def default_dir
|
461
531
|
if defined? RUBY_FRAMEWORK_VERSION
|
462
|
-
return File.join(File.dirname(Config::CONFIG["sitedir"]), "Gems")
|
532
|
+
return File.join(File.dirname(Config::CONFIG["sitedir"]), "Gems", Config::CONFIG['ruby_version'])
|
463
533
|
else
|
464
534
|
File.join(Config::CONFIG['libdir'], 'ruby', 'gems', Config::CONFIG['ruby_version'])
|
465
535
|
end
|
466
536
|
end
|
467
537
|
|
468
|
-
private
|
469
|
-
|
470
|
-
# Quietly ensure the named Gem directory contains all the proper
|
471
|
-
# subdirectories. If we can't create a directory due to a
|
472
|
-
# permission problem, then we will silently continue.
|
473
|
-
def ensure_gem_subdirectories(gemdir)
|
474
|
-
DIRECTORIES.each do |filename|
|
475
|
-
fn = File.join(gemdir, filename)
|
476
|
-
unless File.exist?(fn)
|
477
|
-
require 'fileutils'
|
478
|
-
FileUtils.mkdir_p(fn) rescue nil
|
479
|
-
end
|
480
|
-
end
|
481
|
-
end
|
482
|
-
|
483
538
|
end
|
484
|
-
end
|
485
539
|
|
540
|
+
end
|
486
541
|
|
487
542
|
# Modify the non-gem version of datadir to handle gem package names.
|
488
543
|
|
@@ -501,9 +556,16 @@ module Config # :nodoc:
|
|
501
556
|
end
|
502
557
|
end
|
503
558
|
|
504
|
-
require 'rubygems/
|
505
|
-
require 'rubygems/specification'
|
506
|
-
require 'rubygems/security'
|
559
|
+
require 'rubygems/exceptions'
|
507
560
|
require 'rubygems/version'
|
508
|
-
require 'rubygems/
|
561
|
+
require 'rubygems/requirement'
|
562
|
+
require 'rubygems/dependency'
|
563
|
+
require 'rubygems/gem_path_searcher' # Needed for Kernel#gem
|
564
|
+
require 'rubygems/source_index' # Needed for Kernel#gem
|
565
|
+
require 'rubygems/platform'
|
566
|
+
require 'rubygems/builder' # HACK: Needed for rake's package task.
|
567
|
+
|
568
|
+
if RUBY_VERSION < '1.9' then
|
569
|
+
require 'rubygems/custom_require'
|
570
|
+
end
|
509
571
|
|