rubygems-update 1.3.6 → 1.3.7
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.
- data.tar.gz.sig +0 -0
- data/ChangeLog +86 -0
- data/History.txt +34 -1
- data/Manifest.txt +6 -1
- data/Rakefile +79 -34
- data/lib/rubygems.rb +52 -30
- data/lib/rubygems/builder.rb +2 -0
- data/lib/rubygems/command.rb +12 -0
- data/lib/rubygems/command_manager.rb +17 -12
- data/lib/rubygems/commands/contents_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +3 -1
- data/lib/rubygems/commands/environment_command.rb +3 -2
- data/lib/rubygems/commands/fetch_command.rb +7 -3
- data/lib/rubygems/commands/install_command.rb +2 -1
- data/lib/rubygems/commands/query_command.rb +16 -3
- data/lib/rubygems/commands/server_command.rb +5 -3
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/commands/unpack_command.rb +35 -23
- data/lib/rubygems/commands/update_command.rb +1 -1
- data/lib/rubygems/defaults.rb +4 -6
- data/lib/rubygems/dependency.rb +32 -6
- data/lib/rubygems/dependency_installer.rb +10 -3
- data/lib/rubygems/doc_manager.rb +5 -2
- data/lib/rubygems/errors.rb +35 -0
- data/lib/rubygems/exceptions.rb +10 -1
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/installer.rb +6 -5
- data/lib/rubygems/package.rb +6 -3
- data/lib/rubygems/package/f_sync_dir.rb +4 -3
- data/lib/rubygems/package/tar_header.rb +4 -3
- data/lib/rubygems/package/tar_output.rb +4 -3
- data/lib/rubygems/package/tar_reader.rb +4 -3
- data/lib/rubygems/package/tar_writer.rb +4 -3
- data/lib/rubygems/package_task.rb +4 -3
- data/lib/rubygems/platform.rb +4 -1
- data/lib/rubygems/remote_fetcher.rb +9 -3
- data/lib/rubygems/requirement.rb +5 -0
- data/lib/rubygems/security.rb +3 -3
- data/lib/rubygems/server.rb +33 -18
- data/lib/rubygems/source_index.rb +4 -4
- data/lib/rubygems/source_info_cache.rb +4 -2
- data/lib/rubygems/spec_fetcher.rb +33 -11
- data/lib/rubygems/specification.rb +40 -32
- data/lib/rubygems/test_utilities.rb +2 -2
- data/lib/rubygems/validator.rb +3 -4
- data/lib/rubygems/version.rb +1 -1
- data/test/gem_package_tar_test_case.rb +2 -2
- data/test/gemutilities.rb +15 -9
- data/test/insure_session.rb +1 -1
- data/test/plugin/exception/rubygems_plugin.rb +2 -0
- data/test/plugin/load/rubygems_plugin.rb +1 -0
- data/test/plugin/standarderror/rubygems_plugin.rb +2 -0
- data/test/rubygems/commands/crash_command.rb +5 -0
- data/test/rubygems_plugin.rb +5 -0
- data/test/simple_gem.rb +15 -15
- data/test/test_gem.rb +45 -2
- data/test/test_gem_command_manager.rb +14 -0
- data/test/test_gem_commands_contents_command.rb +7 -5
- data/test/test_gem_commands_environment_command.rb +3 -1
- data/test/test_gem_commands_fetch_command.rb +21 -1
- data/test/test_gem_commands_install_command.rb +2 -4
- data/test/test_gem_commands_query_command.rb +33 -6
- data/test/test_gem_commands_server_command.rb +9 -2
- data/test/test_gem_commands_uninstall_command.rb +4 -2
- data/test/test_gem_commands_unpack_command.rb +46 -2
- data/test/test_gem_config_file.rb +2 -0
- data/test/test_gem_dependency.rb +11 -0
- data/test/test_gem_doc_manager.rb +1 -1
- data/test/test_gem_indexer.rb +2 -2
- data/test/test_gem_installer.rb +1 -1
- data/test/test_gem_package_tar_input.rb +1 -1
- data/test/test_gem_package_tar_writer.rb +3 -3
- data/test/test_gem_platform.rb +19 -0
- data/test/test_gem_server.rb +11 -0
- data/test/test_gem_source_index.rb +2 -2
- data/test/test_gem_spec_fetcher.rb +42 -0
- data/test/test_gem_specification.rb +46 -7
- data/util/{gem_prelude.rb.template → gem_prelude.rb} +53 -23
- metadata +16 -6
- metadata.gz.sig +0 -0
data/test/test_gem_indexer.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path('../gemutilities', __FILE__)
|
|
2
2
|
require 'rubygems/indexer'
|
3
3
|
|
4
4
|
unless ''.respond_to? :to_xs then
|
5
|
-
warn "Gem::Indexer tests are being skipped. Install builder gem."
|
5
|
+
warn "Gem::Indexer tests are being skipped. Install builder gem." if $VERBOSE
|
6
6
|
end
|
7
7
|
|
8
8
|
class TestGemIndexer < RubyGemTestCase
|
@@ -165,7 +165,7 @@ pl-1-i386-linux
|
|
165
165
|
<title>ExampleForge gems</title>
|
166
166
|
<link>http://example.com</link>
|
167
167
|
<description>Recently released gems from http://example.com</description>
|
168
|
-
<generator>RubyGems v#{Gem::
|
168
|
+
<generator>RubyGems v#{Gem::VERSION}</generator>
|
169
169
|
<docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
|
170
170
|
<item>
|
171
171
|
<title>a-2</title>
|
data/test/test_gem_installer.rb
CHANGED
@@ -63,7 +63,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
63
63
|
#{Gem.ruby}: No such file or directory -- extconf.rb (LoadError)
|
64
64
|
EOF
|
65
65
|
|
66
|
-
assert_match %r%#{Regexp.escape Gem.ruby} extconf
|
66
|
+
assert_match %r%#{Regexp.escape Gem.ruby} extconf\.rb%,
|
67
67
|
File.read(gem_make_out)
|
68
68
|
assert_match %r%#{Regexp.escape Gem.ruby}: No such file%,
|
69
69
|
File.read(gem_make_out)
|
@@ -39,7 +39,7 @@ class TestTarWriter < TarTestCase
|
|
39
39
|
def test_add_file_simple_padding
|
40
40
|
@tar_writer.add_file_simple 'x', 0, 100
|
41
41
|
|
42
|
-
assert_headers_equal tar_file_header('x', '', 0, 100),
|
42
|
+
assert_headers_equal tar_file_header('x', '', 0, 100),
|
43
43
|
@io.string[0, 512]
|
44
44
|
|
45
45
|
assert_equal "\0" * 512, @io.string[512, 512]
|
@@ -54,7 +54,7 @@ class TestTarWriter < TarTestCase
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_add_file_simple_size
|
57
|
-
assert_raises Gem::Package::TarWriter::FileOverflow do
|
57
|
+
assert_raises Gem::Package::TarWriter::FileOverflow do
|
58
58
|
@tar_writer.add_file_simple("lib/foo/bar", 0, 10) do |io|
|
59
59
|
io.write "1" * 11
|
60
60
|
end
|
@@ -62,7 +62,7 @@ class TestTarWriter < TarTestCase
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def test_add_file_unseekable
|
65
|
-
assert_raises Gem::Package::NonSeekableIO do
|
65
|
+
assert_raises Gem::Package::NonSeekableIO do
|
66
66
|
Gem::Package::TarWriter.new(Object.new).add_file 'x', 0
|
67
67
|
end
|
68
68
|
end
|
data/test/test_gem_platform.rb
CHANGED
@@ -30,6 +30,9 @@ class TestGemPlatform < RubyGemTestCase
|
|
30
30
|
'hppa2.0w-hpux11.31' => ['hppa2.0w', 'hpux', '11'],
|
31
31
|
'java' => [nil, 'java', nil],
|
32
32
|
'jruby' => [nil, 'java', nil],
|
33
|
+
'universal-dotnet' => ['universal', 'dotnet', nil],
|
34
|
+
'universal-dotnet2.0' => ['universal', 'dotnet', '2.0'],
|
35
|
+
'universal-dotnet4.0' => ['universal', 'dotnet', '4.0'],
|
33
36
|
'powerpc-aix5.3.0.0' => ['powerpc', 'aix', '5'],
|
34
37
|
'powerpc-darwin7' => ['powerpc', 'darwin', '7'],
|
35
38
|
'powerpc-darwin8' => ['powerpc', 'darwin', '8'],
|
@@ -227,6 +230,22 @@ class TestGemPlatform < RubyGemTestCase
|
|
227
230
|
util_set_arch 'java'
|
228
231
|
assert_match 'java', Gem::Platform.local
|
229
232
|
assert_match 'jruby', Gem::Platform.local
|
233
|
+
|
234
|
+
util_set_arch 'universal-dotnet2.0'
|
235
|
+
assert_match 'universal-dotnet', Gem::Platform.local
|
236
|
+
assert_match 'universal-dotnet-2.0', Gem::Platform.local
|
237
|
+
refute_match 'universal-dotnet-4.0', Gem::Platform.local
|
238
|
+
assert_match 'dotnet', Gem::Platform.local
|
239
|
+
assert_match 'dotnet-2.0', Gem::Platform.local
|
240
|
+
refute_match 'dotnet-4.0', Gem::Platform.local
|
241
|
+
|
242
|
+
util_set_arch 'universal-dotnet4.0'
|
243
|
+
assert_match 'universal-dotnet', Gem::Platform.local
|
244
|
+
refute_match 'universal-dotnet-2.0', Gem::Platform.local
|
245
|
+
assert_match 'universal-dotnet-4.0', Gem::Platform.local
|
246
|
+
assert_match 'dotnet', Gem::Platform.local
|
247
|
+
refute_match 'dotnet-2.0', Gem::Platform.local
|
248
|
+
assert_match 'dotnet-4.0', Gem::Platform.local
|
230
249
|
|
231
250
|
util_set_arch 'powerpc-darwin'
|
232
251
|
assert_match 'powerpc-darwin', Gem::Platform.local
|
data/test/test_gem_server.rb
CHANGED
@@ -20,6 +20,17 @@ class TestGemServer < RubyGemTestCase
|
|
20
20
|
@res = WEBrick::HTTPResponse.new :HTTPVersion => '1.0'
|
21
21
|
end
|
22
22
|
|
23
|
+
def test_spec_dirs
|
24
|
+
s = Gem::Server.new Gem.dir, process_based_port, false
|
25
|
+
|
26
|
+
assert_equal [File.join(Gem.dir, 'specifications')], s.spec_dirs
|
27
|
+
|
28
|
+
s = Gem::Server.new [Gem.dir, Gem.dir], process_based_port, false
|
29
|
+
|
30
|
+
assert_equal [File.join(Gem.dir, 'specifications'),
|
31
|
+
File.join(Gem.dir, 'specifications')], s.spec_dirs
|
32
|
+
end
|
33
|
+
|
23
34
|
def test_Marshal
|
24
35
|
data = StringIO.new "GET /Marshal.#{Gem.marshal_version} HTTP/1.0\r\n\r\n"
|
25
36
|
@req.parse data
|
@@ -85,7 +85,7 @@ Gem::Specification.new do |s|
|
|
85
85
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
86
86
|
s.specification_version = 2
|
87
87
|
|
88
|
-
if Gem::Version.new(Gem::
|
88
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
89
89
|
else
|
90
90
|
end
|
91
91
|
else
|
@@ -334,7 +334,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
334
334
|
end
|
335
335
|
|
336
336
|
def test_refresh_bang
|
337
|
-
a1_spec = File.join @gemhome, "specifications", @a1.spec_name
|
337
|
+
a1_spec = File.join @gemhome, "specifications", @a1.spec_name
|
338
338
|
|
339
339
|
FileUtils.mv a1_spec, @tempdir
|
340
340
|
|
@@ -115,6 +115,21 @@ class TestGemSpecFetcher < RubyGemTestCase
|
|
115
115
|
assert_equal [[@pl1.full_name, @gem_repo]], spec_names
|
116
116
|
end
|
117
117
|
|
118
|
+
def test_fetch_with_errors_mismatched_platform
|
119
|
+
util_set_arch 'hrpa-989'
|
120
|
+
|
121
|
+
@fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@pl1.original_name}.gemspec.rz"] =
|
122
|
+
util_zip(Marshal.dump(@pl1))
|
123
|
+
|
124
|
+
dep = Gem::Dependency.new 'pl', 1
|
125
|
+
specs_and_sources, errors = @sf.fetch_with_errors dep
|
126
|
+
|
127
|
+
assert_equal 0, specs_and_sources.size
|
128
|
+
assert_equal 1, errors.size
|
129
|
+
|
130
|
+
assert_equal "i386-linux", errors[0].platforms.first
|
131
|
+
end
|
132
|
+
|
118
133
|
def test_fetch_spec
|
119
134
|
spec_uri = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}"
|
120
135
|
@fetcher.data["#{spec_uri}.rz"] = util_zip(Marshal.dump(@a1))
|
@@ -220,6 +235,33 @@ class TestGemSpecFetcher < RubyGemTestCase
|
|
220
235
|
assert_equal [], specs
|
221
236
|
end
|
222
237
|
|
238
|
+
def test_find_matching_with_errors_matched_platform
|
239
|
+
util_set_arch 'i386-linux'
|
240
|
+
|
241
|
+
dep = Gem::Dependency.new 'pl', 1
|
242
|
+
specs, errors = @sf.find_matching_with_errors dep
|
243
|
+
|
244
|
+
expected = [
|
245
|
+
[['pl', Gem::Version.new(1), 'i386-linux'], @gem_repo],
|
246
|
+
]
|
247
|
+
|
248
|
+
assert_equal expected, specs
|
249
|
+
assert_equal 0, errors.size
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_find_matching_with_errors_invalid_platform
|
253
|
+
util_set_arch 'hrpa-899'
|
254
|
+
|
255
|
+
dep = Gem::Dependency.new 'pl', 1
|
256
|
+
specs, errors = @sf.find_matching_with_errors dep
|
257
|
+
|
258
|
+
assert_equal 0, specs.size
|
259
|
+
|
260
|
+
assert_equal 1, errors.size
|
261
|
+
|
262
|
+
assert_equal "i386-linux", errors[0].platforms.first
|
263
|
+
end
|
264
|
+
|
223
265
|
def test_find_all_platforms
|
224
266
|
util_set_arch 'i386-freebsd6'
|
225
267
|
|
@@ -473,6 +473,31 @@ end
|
|
473
473
|
assert_equal expected, @a1.files.sort
|
474
474
|
end
|
475
475
|
|
476
|
+
def test_files_append
|
477
|
+
@a1.files = %w(files bin/common)
|
478
|
+
@a1.test_files = %w(test_files bin/common)
|
479
|
+
@a1.executables = %w(executables common)
|
480
|
+
@a1.extra_rdoc_files = %w(extra_rdoc_files bin/common)
|
481
|
+
@a1.extensions = %w(extensions bin/common)
|
482
|
+
|
483
|
+
expected = %w[
|
484
|
+
bin/common
|
485
|
+
bin/executables
|
486
|
+
extensions
|
487
|
+
extra_rdoc_files
|
488
|
+
files
|
489
|
+
test_files
|
490
|
+
]
|
491
|
+
assert_equal expected, @a1.files.sort
|
492
|
+
|
493
|
+
@a1.files << "generated_file.c"
|
494
|
+
|
495
|
+
expected << "generated_file.c"
|
496
|
+
expected.sort!
|
497
|
+
|
498
|
+
assert_equal expected, @a1.files.sort
|
499
|
+
end
|
500
|
+
|
476
501
|
def test_files_duplicate
|
477
502
|
@a2.files = %w[a b c d b]
|
478
503
|
@a2.extra_rdoc_files = %w[x y z x]
|
@@ -549,7 +574,7 @@ end
|
|
549
574
|
'i386-mswin32_80' => 'a-1-x86-mswin32-80',
|
550
575
|
'i386-mingw32' => 'a-1-x86-mingw32'
|
551
576
|
}
|
552
|
-
|
577
|
+
|
553
578
|
test_cases.each do |arch, expected|
|
554
579
|
util_set_arch arch
|
555
580
|
@a1.platform = 'current'
|
@@ -748,14 +773,14 @@ Gem::Specification.new do |s|
|
|
748
773
|
s.files = [\"lib/code.rb\"]
|
749
774
|
s.homepage = %q{http://example.com}
|
750
775
|
s.require_paths = [\"lib\"]
|
751
|
-
s.rubygems_version = %q{#{Gem::
|
776
|
+
s.rubygems_version = %q{#{Gem::VERSION}}
|
752
777
|
s.summary = %q{this is a summary}
|
753
778
|
|
754
779
|
if s.respond_to? :specification_version then
|
755
780
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
756
781
|
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
757
782
|
|
758
|
-
if Gem::Version.new(Gem::
|
783
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
759
784
|
s.add_runtime_dependency(%q<b>, [\"= 1\"])
|
760
785
|
else
|
761
786
|
s.add_dependency(%q<b>, [\"= 1\"])
|
@@ -802,7 +827,7 @@ Gem::Specification.new do |s|
|
|
802
827
|
s.require_paths = [\"lib\"]
|
803
828
|
s.requirements = [\"A working computer\"]
|
804
829
|
s.rubyforge_project = %q{example}
|
805
|
-
s.rubygems_version = %q{#{Gem::
|
830
|
+
s.rubygems_version = %q{#{Gem::VERSION}}
|
806
831
|
s.summary = %q{this is a summary}
|
807
832
|
s.test_files = [\"test/suite.rb\"]
|
808
833
|
|
@@ -810,7 +835,7 @@ Gem::Specification.new do |s|
|
|
810
835
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
811
836
|
s.specification_version = 3
|
812
837
|
|
813
|
-
if Gem::Version.new(Gem::
|
838
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
814
839
|
s.add_runtime_dependency(%q<rake>, [\"> 0.4\"])
|
815
840
|
s.add_runtime_dependency(%q<jabber4r>, [\"> 0.0.0\"])
|
816
841
|
s.add_runtime_dependency(%q<pqa>, [\"> 0.4\", \"<= 0.6\"])
|
@@ -883,7 +908,7 @@ end
|
|
883
908
|
|
884
909
|
yaml_str = @a1.to_yaml
|
885
910
|
|
886
|
-
same_spec = YAML.load
|
911
|
+
same_spec = YAML.load yaml_str
|
887
912
|
|
888
913
|
assert_equal Gem::Platform.new('powerpc-darwin7'), same_spec.platform
|
889
914
|
assert_equal 'powerpc-darwin7.9.0', same_spec.original_platform
|
@@ -1173,7 +1198,7 @@ end
|
|
1173
1198
|
@a1.validate
|
1174
1199
|
end
|
1175
1200
|
|
1176
|
-
assert_equal "expected RubyGems version #{Gem::
|
1201
|
+
assert_equal "expected RubyGems version #{Gem::VERSION}, was 3",
|
1177
1202
|
e.message
|
1178
1203
|
end
|
1179
1204
|
|
@@ -1228,6 +1253,20 @@ end
|
|
1228
1253
|
assert_equal Gem::Version.new('1'), @a1.version
|
1229
1254
|
end
|
1230
1255
|
|
1256
|
+
def test_load_errors_contain_filename
|
1257
|
+
specfile = Tempfile.new(self.class.name.downcase)
|
1258
|
+
specfile.write "raise 'boom'"
|
1259
|
+
specfile.close
|
1260
|
+
begin
|
1261
|
+
Gem::Specification.load(specfile.path)
|
1262
|
+
rescue => e
|
1263
|
+
name_rexp = Regexp.new(Regexp.escape(specfile.path))
|
1264
|
+
assert e.backtrace.grep(name_rexp).any?
|
1265
|
+
end
|
1266
|
+
ensure
|
1267
|
+
specfile.delete
|
1268
|
+
end
|
1269
|
+
|
1231
1270
|
def util_setup_validate
|
1232
1271
|
Dir.chdir @tempdir do
|
1233
1272
|
FileUtils.mkdir_p File.join('ext', 'a')
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# depends on: array.rb dir.rb env.rb file.rb hash.rb module.rb regexp.rb
|
2
2
|
# vim: filetype=ruby
|
3
|
-
# WARN
|
4
3
|
|
5
4
|
# NOTICE: Ruby is during initialization here.
|
6
5
|
# * Encoding.default_external does not reflects -E.
|
@@ -16,7 +15,7 @@ if defined?(Gem) then
|
|
16
15
|
def gem(gem_name, *version_requirements)
|
17
16
|
Gem.push_gem_version_on_load_path(gem_name, *version_requirements)
|
18
17
|
end
|
19
|
-
|
18
|
+
private :gem
|
20
19
|
end
|
21
20
|
|
22
21
|
module Gem
|
@@ -43,7 +42,7 @@ if defined?(Gem) then
|
|
43
42
|
def self.path
|
44
43
|
@gem_path ||= nil
|
45
44
|
unless @gem_path
|
46
|
-
paths = [ENV['GEM_PATH']]
|
45
|
+
paths = [ENV['GEM_PATH'] || default_path]
|
47
46
|
paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
|
48
47
|
set_paths(paths.compact.join(File::PATH_SEPARATOR))
|
49
48
|
end
|
@@ -67,7 +66,8 @@ if defined?(Gem) then
|
|
67
66
|
end
|
68
67
|
|
69
68
|
def self.set_home(home)
|
70
|
-
home = home.
|
69
|
+
home = home.dup.force_encoding(Encoding.find('filesystem'))
|
70
|
+
home.gsub!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
|
71
71
|
@gem_home = home
|
72
72
|
end
|
73
73
|
|
@@ -88,9 +88,24 @@ if defined?(Gem) then
|
|
88
88
|
end
|
89
89
|
|
90
90
|
@gem_path.uniq!
|
91
|
+
@gem_path.map!{|x|x.force_encoding(Encoding.find('filesystem'))}
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.user_home
|
95
|
+
@user_home ||= File.expand_path("~").force_encoding(Encoding.find('filesystem'))
|
96
|
+
rescue
|
97
|
+
if File::ALT_SEPARATOR then
|
98
|
+
"C:/"
|
99
|
+
else
|
100
|
+
"/"
|
101
|
+
end
|
91
102
|
end
|
92
103
|
|
93
|
-
#
|
104
|
+
# begin rubygems/defaults
|
105
|
+
# NOTE: this require will be replaced with in-place eval before compilation.
|
106
|
+
require 'lib/rubygems/defaults.rb'
|
107
|
+
# end rubygems/defaults
|
108
|
+
|
94
109
|
|
95
110
|
##
|
96
111
|
# Methods before this line will be removed when QuickLoader is replaced
|
@@ -130,18 +145,42 @@ if defined?(Gem) then
|
|
130
145
|
Gem::GEM_PRELUDE_METHODS.each do |method_name|
|
131
146
|
undef_method method_name
|
132
147
|
end
|
148
|
+
undef_method :const_missing
|
149
|
+
undef_method :method_missing
|
133
150
|
end
|
134
151
|
|
135
152
|
Kernel.module_eval do
|
136
153
|
undef_method :gem if method_defined? :gem
|
137
154
|
end
|
138
155
|
|
139
|
-
$".delete
|
140
|
-
|
141
|
-
|
156
|
+
$".delete path_to_full_rubygems_library
|
157
|
+
$".each do |path|
|
158
|
+
if /#{Regexp.escape File::SEPARATOR}rubygems\.rb\z/ =~ path
|
159
|
+
raise LoadError, "another rubygems is already loaded from #{path}"
|
160
|
+
end
|
161
|
+
end
|
142
162
|
require 'rubygems'
|
143
163
|
end
|
144
164
|
|
165
|
+
def self.fake_rubygems_as_loaded
|
166
|
+
path = path_to_full_rubygems_library
|
167
|
+
$" << path unless $".include?(path)
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.path_to_full_rubygems_library
|
171
|
+
installed_path = File.join(Gem::ConfigMap[:rubylibprefix], Gem::ConfigMap[:ruby_version])
|
172
|
+
if $:.include?(installed_path)
|
173
|
+
return File.join(installed_path, 'rubygems.rb')
|
174
|
+
else # e.g., on test-all
|
175
|
+
$:.each do |dir|
|
176
|
+
if File.exist?( path = File.join(dir, 'rubygems.rb') )
|
177
|
+
return path
|
178
|
+
end
|
179
|
+
end
|
180
|
+
raise LoadError, 'rubygems.rb'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
145
184
|
GemPaths = {}
|
146
185
|
GemVersions = {}
|
147
186
|
|
@@ -194,19 +233,11 @@ if defined?(Gem) then
|
|
194
233
|
Dir.entries(gems_directory).each do |gem_directory_name|
|
195
234
|
next if gem_directory_name == "." || gem_directory_name == ".."
|
196
235
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
gem_name = gem_directory_name[0...dash]
|
236
|
+
next unless gem_name = gem_directory_name[/(.*)-(.*)/, 1]
|
237
|
+
new_version = integers_for($2)
|
201
238
|
current_version = GemVersions[gem_name]
|
202
|
-
|
203
|
-
|
204
|
-
if current_version then
|
205
|
-
if (current_version <=> new_version) == -1 then
|
206
|
-
GemVersions[gem_name] = new_version
|
207
|
-
GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
|
208
|
-
end
|
209
|
-
else
|
239
|
+
|
240
|
+
if !current_version or (current_version <=> new_version) < 0 then
|
210
241
|
GemVersions[gem_name] = new_version
|
211
242
|
GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
|
212
243
|
end
|
@@ -236,7 +267,7 @@ if defined?(Gem) then
|
|
236
267
|
require_paths.first.instance_variable_set(:@gem_prelude_index, true)
|
237
268
|
end
|
238
269
|
# gem directories must come after -I and ENV['RUBYLIB']
|
239
|
-
$:[$:.index(
|
270
|
+
$:[$:.index{|e|e.instance_variable_defined?(:@gem_prelude_index)}||-1,0] = require_paths
|
240
271
|
end
|
241
272
|
|
242
273
|
def const_missing(constant)
|
@@ -262,8 +293,7 @@ if defined?(Gem) then
|
|
262
293
|
|
263
294
|
begin
|
264
295
|
Gem.push_all_highest_version_gems_on_load_path
|
265
|
-
|
266
|
-
Gem::ConfigMap[:ruby_version], "rubygems.rb")
|
296
|
+
Gem::QuickLoader.fake_rubygems_as_loaded
|
267
297
|
rescue Exception => e
|
268
298
|
puts "Error loading gem paths on load path in gem_prelude"
|
269
299
|
puts e
|