rubygems-update 1.3.1 → 1.3.2
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.tar.gz.sig +0 -0
- data/.autotest +24 -0
- data/.document +4 -3
- data/ChangeLog +382 -1
- data/Manifest.txt +214 -0
- data/README +1 -49
- data/Rakefile +124 -191
- data/bin/gem +1 -4
- data/cruise_config.rb +22 -0
- data/doc/release_notes/rel_1_3_1.rdoc +3 -3
- data/doc/release_notes/rel_1_3_2.rdoc +119 -0
- data/lib/gauntlet_rubygems.rb +50 -0
- data/lib/rubygems.rb +250 -25
- data/lib/rubygems/builder.rb +62 -60
- data/lib/rubygems/command.rb +421 -319
- data/lib/rubygems/command_manager.rb +153 -125
- data/lib/rubygems/commands/check_command.rb +12 -7
- data/lib/rubygems/commands/cleanup_command.rb +11 -2
- data/lib/rubygems/commands/contents_command.rb +42 -18
- data/lib/rubygems/commands/generate_index_command.rb +91 -15
- data/lib/rubygems/commands/install_command.rb +33 -47
- data/lib/rubygems/commands/query_command.rb +36 -20
- data/lib/rubygems/commands/rdoc_command.rb +62 -68
- data/lib/rubygems/commands/search_command.rb +26 -32
- data/lib/rubygems/commands/setup_command.rb +353 -0
- data/lib/rubygems/commands/sources_command.rb +5 -0
- data/lib/rubygems/commands/specification_command.rb +23 -3
- data/lib/rubygems/commands/uninstall_command.rb +71 -61
- data/lib/rubygems/commands/unpack_command.rb +14 -12
- data/lib/rubygems/commands/update_command.rb +26 -5
- data/lib/rubygems/defaults.rb +16 -3
- data/lib/rubygems/dependency.rb +38 -7
- data/lib/rubygems/dependency_installer.rb +7 -4
- data/lib/rubygems/digest/digest_adapter.rb +42 -33
- data/lib/rubygems/digest/sha1.rb +6 -1
- data/lib/rubygems/digest/sha2.rb +5 -0
- data/lib/rubygems/doc_manager.rb +31 -11
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -1
- data/lib/rubygems/ext/rake_builder.rb +6 -2
- data/lib/rubygems/format.rb +63 -63
- data/lib/rubygems/gem_openssl.rb +14 -2
- data/lib/rubygems/gem_path_searcher.rb +7 -3
- data/lib/rubygems/gem_runner.rb +59 -39
- data/lib/rubygems/indexer.rb +450 -109
- data/lib/rubygems/install_update_options.rb +13 -1
- data/lib/rubygems/installer.rb +25 -22
- data/lib/rubygems/local_remote_options.rb +5 -3
- data/lib/rubygems/old_format.rb +124 -120
- data/lib/rubygems/package/tar_header.rb +25 -3
- data/lib/rubygems/package/tar_input.rb +5 -5
- data/lib/rubygems/package/tar_output.rb +2 -0
- data/lib/rubygems/package/tar_reader.rb +19 -0
- data/lib/rubygems/package/tar_reader/entry.rb +43 -0
- data/lib/rubygems/package/tar_writer.rb +65 -3
- data/lib/rubygems/package_task.rb +117 -0
- data/lib/rubygems/platform.rb +12 -8
- data/lib/rubygems/remote_fetcher.rb +43 -24
- data/lib/rubygems/require_paths_builder.rb +14 -12
- data/lib/rubygems/requirement.rb +15 -6
- data/lib/rubygems/rubygems_version.rb +14 -1
- data/lib/rubygems/source_index.rb +38 -16
- data/lib/rubygems/source_info_cache_entry.rb +2 -2
- data/lib/rubygems/spec_fetcher.rb +43 -20
- data/lib/rubygems/specification.rb +1122 -947
- data/lib/rubygems/text.rb +30 -0
- data/lib/rubygems/timer.rb +14 -11
- data/lib/rubygems/uninstaller.rb +25 -5
- data/lib/rubygems/user_interaction.rb +294 -264
- data/lib/rubygems/validator.rb +70 -36
- data/lib/rubygems/version.rb +97 -33
- data/lib/rubygems/version_option.rb +1 -0
- data/setup.rb +11 -306
- data/test/foo/discover.rb +0 -0
- data/test/gem_installer_test_case.rb +22 -11
- data/test/gem_package_tar_test_case.rb +0 -14
- data/test/gemutilities.rb +89 -8
- data/test/mockgemui.rb +2 -1
- data/test/rubygems_plugin.rb +16 -0
- data/test/test_gem.rb +107 -36
- data/test/test_gem_command.rb +3 -13
- data/test/test_gem_command_manager.rb +1 -14
- data/test/test_gem_commands_cert_command.rb +1 -1
- data/test/test_gem_commands_contents_command.rb +63 -0
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_generate_index_command.rb +104 -1
- data/test/test_gem_commands_install_command.rb +95 -0
- data/test/test_gem_commands_pristine_command.rb +3 -3
- data/test/test_gem_commands_query_command.rb +46 -0
- data/test/test_gem_commands_sources_command.rb +9 -5
- data/test/test_gem_commands_specification_command.rb +31 -0
- data/test/test_gem_commands_uninstall_command.rb +3 -2
- data/test/test_gem_commands_unpack_command.rb +3 -2
- data/test/test_gem_commands_update_command.rb +12 -7
- data/test/test_gem_dependency.rb +62 -11
- data/test/test_gem_dependency_installer.rb +18 -5
- data/test/test_gem_dependency_list.rb +6 -6
- data/test/test_gem_doc_manager.rb +7 -1
- data/test/test_gem_ext_configure_builder.rb +8 -10
- data/test/test_gem_ext_ext_conf_builder.rb +14 -8
- data/test/test_gem_gem_path_searcher.rb +1 -1
- data/test/test_gem_gem_runner.rb +11 -0
- data/test/test_gem_indexer.rb +398 -21
- data/test/test_gem_install_update_options.rb +20 -6
- data/test/test_gem_installer.rb +22 -14
- data/test/test_gem_local_remote_options.rb +2 -1
- data/test/test_gem_package_tar_header.rb +3 -3
- data/test/test_gem_package_tar_input.rb +3 -3
- data/test/test_gem_package_tar_output.rb +2 -2
- data/test/test_gem_package_task.rb +70 -0
- data/test/test_gem_platform.rb +12 -6
- data/test/test_gem_remote_fetcher.rb +23 -1
- data/test/test_gem_source_index.rb +32 -21
- data/test/test_gem_spec_fetcher.rb +77 -5
- data/test/test_gem_specification.rb +274 -1
- data/test/test_gem_uninstaller.rb +34 -4
- data/test/test_gem_version.rb +94 -4
- data/test/test_gem_version_option.rb +13 -0
- data/test/test_kernel.rb +4 -4
- data/util/CL2notes +56 -0
- data/util/gem_prelude.rb.template +251 -0
- metadata +30 -20
- metadata.gz.sig +3 -4
- data/TODO +0 -1
- data/scripts/buildtests.rb +0 -31
- data/scripts/gemdoc.rb +0 -67
- data/scripts/runtest.rb +0 -40
- data/scripts/specdoc.rb +0 -171
- data/scripts/upload_gemdoc.rb +0 -140
@@ -1,4 +1,3 @@
|
|
1
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
2
1
|
require File.join(File.expand_path(File.dirname(__FILE__)),
|
3
2
|
'gem_installer_test_case')
|
4
3
|
require 'rubygems/install_update_options'
|
@@ -21,6 +20,11 @@ class TestGemInstallUpdateOptions < GemInstallerTestCase
|
|
21
20
|
assert @cmd.handles?(args)
|
22
21
|
end
|
23
22
|
|
23
|
+
def test_prerelease
|
24
|
+
@cmd.handle_options %w[--prerelease]
|
25
|
+
assert_equal true, @cmd.options[:prerelease]
|
26
|
+
end
|
27
|
+
|
24
28
|
def test_security_policy
|
25
29
|
@cmd.handle_options %w[-P HighSecurity]
|
26
30
|
|
@@ -38,6 +42,8 @@ class TestGemInstallUpdateOptions < GemInstallerTestCase
|
|
38
42
|
def test_user_install_enabled
|
39
43
|
@cmd.handle_options %w[--user-install]
|
40
44
|
|
45
|
+
assert @cmd.options[:user_install]
|
46
|
+
|
41
47
|
@installer = Gem::Installer.new @gem, @cmd.options
|
42
48
|
@installer.install
|
43
49
|
assert File.exist?(File.join(Gem.user_dir, 'gems'))
|
@@ -46,15 +52,23 @@ class TestGemInstallUpdateOptions < GemInstallerTestCase
|
|
46
52
|
end
|
47
53
|
|
48
54
|
def test_user_install_disabled_read_only
|
49
|
-
|
55
|
+
if win_platform?
|
56
|
+
skip('test_user_install_disabled_read_only test skipped on MS Windows')
|
57
|
+
else
|
58
|
+
@cmd.handle_options %w[--no-user-install]
|
50
59
|
|
51
|
-
|
52
|
-
FileUtils.chmod 0000, @gemhome
|
60
|
+
refute @cmd.options[:user_install]
|
53
61
|
|
54
|
-
|
55
|
-
|
62
|
+
File.chmod 0755, @userhome
|
63
|
+
FileUtils.chmod 0000, @gemhome
|
64
|
+
|
65
|
+
assert_raises(Gem::FilePermissionError) do
|
66
|
+
@installer = Gem::Installer.new @gem, @cmd.options
|
67
|
+
end
|
56
68
|
end
|
57
69
|
ensure
|
58
70
|
FileUtils.chmod 0755, @gemhome
|
59
71
|
end
|
72
|
+
|
60
73
|
end
|
74
|
+
|
data/test/test_gem_installer.rb
CHANGED
@@ -31,7 +31,7 @@ if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
|
|
31
31
|
end
|
32
32
|
|
33
33
|
gem 'a', version
|
34
|
-
load 'my_exec'
|
34
|
+
load Gem.bin_path('a', 'my_exec', version)
|
35
35
|
EOF
|
36
36
|
|
37
37
|
wrapper = @installer.app_script_text 'my_exec'
|
@@ -46,7 +46,7 @@ load 'my_exec'
|
|
46
46
|
assert_equal '', @ui.output
|
47
47
|
assert_equal '', @ui.error
|
48
48
|
|
49
|
-
|
49
|
+
refute File.exist?('gem_make.out')
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_build_extensions_extconf_bad
|
@@ -288,12 +288,16 @@ load 'my_exec'
|
|
288
288
|
util_make_exec
|
289
289
|
|
290
290
|
Dir.mkdir util_inst_bindir
|
291
|
-
File.chmod 0000, util_inst_bindir
|
292
291
|
|
293
|
-
|
294
|
-
|
295
|
-
|
292
|
+
if win_platform?
|
293
|
+
skip('test_generate_bin_script_no_perms skipped on MS Windows')
|
294
|
+
else
|
295
|
+
File.chmod 0000, util_inst_bindir
|
296
296
|
|
297
|
+
assert_raises Gem::FilePermissionError do
|
298
|
+
@installer.generate_bin
|
299
|
+
end
|
300
|
+
end
|
297
301
|
ensure
|
298
302
|
File.chmod 0700, util_inst_bindir unless $DEBUG
|
299
303
|
end
|
@@ -373,12 +377,16 @@ load 'my_exec'
|
|
373
377
|
@installer.gem_dir = util_gem_dir
|
374
378
|
|
375
379
|
Dir.mkdir util_inst_bindir
|
376
|
-
File.chmod 0000, util_inst_bindir
|
377
380
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
+
if win_platform?
|
382
|
+
skip('test_generate_bin_symlink_no_perms skipped on MS Windows')
|
383
|
+
else
|
384
|
+
File.chmod 0000, util_inst_bindir
|
381
385
|
|
386
|
+
assert_raises Gem::FilePermissionError do
|
387
|
+
@installer.generate_bin
|
388
|
+
end
|
389
|
+
end
|
382
390
|
ensure
|
383
391
|
File.chmod 0700, util_inst_bindir unless $DEBUG
|
384
392
|
end
|
@@ -535,7 +543,7 @@ load 'my_exec'
|
|
535
543
|
cache_file = File.join @gemhome, 'cache', "#{@spec.full_name}.gem"
|
536
544
|
|
537
545
|
Gem.pre_install do |installer|
|
538
|
-
|
546
|
+
refute File.exist?(cache_file), 'cache file should not exist yet'
|
539
547
|
end
|
540
548
|
|
541
549
|
Gem.post_install do |installer|
|
@@ -771,7 +779,7 @@ load 'my_exec'
|
|
771
779
|
assert @installer.installation_satisfies_dependency?(dep)
|
772
780
|
|
773
781
|
dep = Gem::Dependency.new 'a', '> 2'
|
774
|
-
|
782
|
+
refute @installer.installation_satisfies_dependency?(dep)
|
775
783
|
end
|
776
784
|
|
777
785
|
def test_shebang
|
@@ -818,7 +826,7 @@ load 'my_exec'
|
|
818
826
|
@installer.env_shebang = true
|
819
827
|
|
820
828
|
shebang = @installer.shebang 'my_exec'
|
821
|
-
assert_equal "#!/usr/bin/env #{Gem::ConfigMap[:
|
829
|
+
assert_equal "#!/usr/bin/env #{Gem::ConfigMap[:ruby_install_name]}", shebang
|
822
830
|
end
|
823
831
|
|
824
832
|
def test_shebang_nested
|
@@ -884,7 +892,7 @@ load 'my_exec'
|
|
884
892
|
spec_dir = File.join @gemhome, 'specifications'
|
885
893
|
spec_file = File.join spec_dir, "#{@spec.full_name}.gemspec"
|
886
894
|
FileUtils.rm spec_file
|
887
|
-
|
895
|
+
refute File.exist?(spec_file)
|
888
896
|
|
889
897
|
@installer.spec = @spec
|
890
898
|
@installer.gem_home = @gemhome
|
@@ -60,8 +60,9 @@ class TestGemLocalRemoteOptions < RubyGemTestCase
|
|
60
60
|
s1 = URI.parse 'http://more-gems.example.com/'
|
61
61
|
s2 = URI.parse 'http://even-more-gems.example.com/'
|
62
62
|
s3 = URI.parse 'http://other-gems.example.com/some_subdir'
|
63
|
+
s4 = URI.parse 'http://more-gems.example.com/' # Intentional duplicate
|
63
64
|
|
64
|
-
@cmd.handle_options %W[--source #{s1} --source #{s2} --source #{s3}]
|
65
|
+
@cmd.handle_options %W[--source #{s1} --source #{s2} --source #{s3} --source #{s4}]
|
65
66
|
|
66
67
|
assert_equal [s1.to_s, s2.to_s, "#{s3}/"], Gem.sources
|
67
68
|
end
|
@@ -58,7 +58,7 @@ class TestGemPackageTarHeader < TarTestCase
|
|
58
58
|
assert_equal 'user', @tar_header.uname, 'uname'
|
59
59
|
assert_equal '00', @tar_header.version, 'version'
|
60
60
|
|
61
|
-
|
61
|
+
refute_empty @tar_header, 'empty'
|
62
62
|
end
|
63
63
|
|
64
64
|
def test_initialize_bad
|
@@ -80,13 +80,13 @@ class TestGemPackageTarHeader < TarTestCase
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def test_empty_eh
|
83
|
-
|
83
|
+
refute_empty @tar_header
|
84
84
|
|
85
85
|
@tar_header = Gem::Package::TarHeader.new :name => 'x', :prefix => '',
|
86
86
|
:mode => 0, :size => 0,
|
87
87
|
:empty => true
|
88
88
|
|
89
|
-
|
89
|
+
assert_empty @tar_header
|
90
90
|
end
|
91
91
|
|
92
92
|
def test_equals2
|
@@ -92,8 +92,8 @@ class TestGemPackageTarInput < TarTestCase
|
|
92
92
|
tar_input.extract_entry @tempdir, entry
|
93
93
|
name = File.join @tempdir, entry.header.name
|
94
94
|
|
95
|
-
if entry.directory?
|
96
|
-
assert File.
|
95
|
+
if entry.directory? then
|
96
|
+
assert File.directory?(name)
|
97
97
|
else
|
98
98
|
assert File.file?(name)
|
99
99
|
assert_equal @entry_sizes[i], File.stat(name).size
|
@@ -111,7 +111,7 @@ class TestGemPackageTarInput < TarTestCase
|
|
111
111
|
|
112
112
|
@entry_files.each_with_index do |x, i|
|
113
113
|
assert File.file?(x)
|
114
|
-
assert_equal @entry_contents[i],
|
114
|
+
assert_equal @entry_contents[i], Gem.read_binary(x)
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -49,7 +49,7 @@ class TestGemPackageTarOutput < TarTestCase
|
|
49
49
|
gz = Zlib::GzipReader.new StringIO.new(data)
|
50
50
|
assert_equal "This is some metadata\n", gz.read
|
51
51
|
|
52
|
-
|
52
|
+
assert_empty files
|
53
53
|
ensure
|
54
54
|
gz.close if gz
|
55
55
|
end
|
@@ -82,7 +82,7 @@ class TestGemPackageTarOutput < TarTestCase
|
|
82
82
|
name, data = files.shift
|
83
83
|
assert_equal 'metadata.gz.sig', name
|
84
84
|
|
85
|
-
|
85
|
+
assert_empty files
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Copyright (c) 2003, 2004 Jim Weirich, 2009 Eric Hodel
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
23
|
+
require 'rubygems'
|
24
|
+
require 'rubygems/package_task'
|
25
|
+
|
26
|
+
class TestGemPackageTask < MiniTest::Unit::TestCase
|
27
|
+
|
28
|
+
def test_gem_package
|
29
|
+
gem = Gem::Specification.new do |g|
|
30
|
+
g.name = "pkgr"
|
31
|
+
g.version = "1.2.3"
|
32
|
+
g.files = Rake::FileList["x"].resolve
|
33
|
+
end
|
34
|
+
pkg = Gem::PackageTask.new(gem) do |p|
|
35
|
+
p.package_files << "y"
|
36
|
+
end
|
37
|
+
assert_equal ["x", "y"], pkg.package_files
|
38
|
+
assert_equal "pkgr-1.2.3.gem", pkg.gem_file
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_gem_package_with_current_platform
|
42
|
+
gem = Gem::Specification.new do |g|
|
43
|
+
g.name = "pkgr"
|
44
|
+
g.version = "1.2.3"
|
45
|
+
g.files = Rake::FileList["x"].resolve
|
46
|
+
g.platform = Gem::Platform::CURRENT
|
47
|
+
end
|
48
|
+
pkg = Gem::PackageTask.new(gem) do |p|
|
49
|
+
p.package_files << "y"
|
50
|
+
end
|
51
|
+
assert_equal ["x", "y"], pkg.package_files
|
52
|
+
assert_match(/^pkgr-1\.2\.3-(\S+)\.gem$/, pkg.gem_file)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_gem_package_with_ruby_platform
|
56
|
+
gem = Gem::Specification.new do |g|
|
57
|
+
g.name = "pkgr"
|
58
|
+
g.version = "1.2.3"
|
59
|
+
g.files = Rake::FileList["x"].resolve
|
60
|
+
g.platform = Gem::Platform::RUBY
|
61
|
+
end
|
62
|
+
pkg = Gem::PackageTask.new(gem) do |p|
|
63
|
+
p.package_files << "y"
|
64
|
+
end
|
65
|
+
assert_equal ["x", "y"], pkg.package_files
|
66
|
+
assert_equal "pkgr-1.2.3.gem", pkg.gem_file
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
data/test/test_gem_platform.rb
CHANGED
@@ -133,6 +133,12 @@ class TestGemPlatform < RubyGemTestCase
|
|
133
133
|
assert_equal '1', platform.version
|
134
134
|
end
|
135
135
|
|
136
|
+
def test_empty
|
137
|
+
platform = Gem::Platform.new 'cpu-other_platform1'
|
138
|
+
assert_respond_to platform, :empty?
|
139
|
+
assert_equal false, platform.empty?
|
140
|
+
end
|
141
|
+
|
136
142
|
def test_to_s
|
137
143
|
if win_platform? then
|
138
144
|
assert_equal 'x86-mswin32-60', Gem::Platform.local.to_s
|
@@ -155,8 +161,8 @@ class TestGemPlatform < RubyGemTestCase
|
|
155
161
|
other = Gem::Platform.new %w[cpu other_platform 1]
|
156
162
|
|
157
163
|
assert(my === my)
|
158
|
-
|
159
|
-
|
164
|
+
refute(other === my)
|
165
|
+
refute(my === other)
|
160
166
|
end
|
161
167
|
|
162
168
|
def test_equals3_cpu
|
@@ -167,10 +173,10 @@ class TestGemPlatform < RubyGemTestCase
|
|
167
173
|
util_set_arch 'powerpc-darwin8'
|
168
174
|
assert((ppc_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
|
169
175
|
assert((uni_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
|
170
|
-
|
176
|
+
refute((x86_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
|
171
177
|
|
172
178
|
util_set_arch 'i686-darwin8'
|
173
|
-
|
179
|
+
refute((ppc_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
|
174
180
|
assert((uni_darwin8 === Gem::Platform.local), 'x86 =~ universal')
|
175
181
|
assert((x86_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
|
176
182
|
|
@@ -191,8 +197,8 @@ class TestGemPlatform < RubyGemTestCase
|
|
191
197
|
assert((x86_darwin === Gem::Platform.local), 'x86_darwin === x86_darwin8')
|
192
198
|
assert((x86_darwin8 === Gem::Platform.local), 'x86_darwin8 === x86_darwin8')
|
193
199
|
|
194
|
-
|
195
|
-
|
200
|
+
refute((x86_darwin7 === Gem::Platform.local), 'x86_darwin7 === x86_darwin8')
|
201
|
+
refute((x86_darwin9 === Gem::Platform.local), 'x86_darwin9 === x86_darwin8')
|
196
202
|
end
|
197
203
|
|
198
204
|
def test_equals_tilde
|
@@ -151,7 +151,7 @@ gems:
|
|
151
151
|
fetcher.fetch_size 'gems.example.com/yaml'
|
152
152
|
end
|
153
153
|
|
154
|
-
assert_equal 'uri is
|
154
|
+
assert_equal 'uri scheme is invalid', e.message
|
155
155
|
end
|
156
156
|
|
157
157
|
def test_fetch_size_socket_error
|
@@ -237,6 +237,21 @@ gems:
|
|
237
237
|
inst.download(@a1, local_path)
|
238
238
|
end
|
239
239
|
|
240
|
+
def test_download_local_space
|
241
|
+
space_path = File.join @tempdir, 'space path'
|
242
|
+
FileUtils.mkdir space_path
|
243
|
+
FileUtils.mv @a1_gem, space_path
|
244
|
+
local_path = File.join space_path, "#{@a1.full_name}.gem"
|
245
|
+
inst = nil
|
246
|
+
|
247
|
+
Dir.chdir @tempdir do
|
248
|
+
inst = Gem::RemoteFetcher.fetcher
|
249
|
+
end
|
250
|
+
|
251
|
+
assert_equal File.join(@gemhome, 'cache', "#{@a1.full_name}.gem"),
|
252
|
+
inst.download(@a1, local_path)
|
253
|
+
end
|
254
|
+
|
240
255
|
def test_download_install_dir
|
241
256
|
a1_data = nil
|
242
257
|
File.open @a1_gem, 'rb' do |fp|
|
@@ -463,6 +478,13 @@ gems:
|
|
463
478
|
assert_equal nil, fetcher.fetch_path(URI.parse(@gem_repo), Time.at(0))
|
464
479
|
end
|
465
480
|
|
481
|
+
def test_get_proxy_from_env_auto_normalizes
|
482
|
+
fetcher = Gem::RemoteFetcher.new(nil)
|
483
|
+
ENV['HTTP_PROXY'] = 'fakeurl:12345'
|
484
|
+
|
485
|
+
assert_equal('http://fakeurl:12345', fetcher.get_proxy_from_env.to_s)
|
486
|
+
end
|
487
|
+
|
466
488
|
def test_get_proxy_from_env_empty
|
467
489
|
orig_env_HTTP_PROXY = ENV['HTTP_PROXY']
|
468
490
|
orig_env_http_proxy = ENV['http_proxy']
|
@@ -222,7 +222,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
222
222
|
|
223
223
|
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
224
224
|
|
225
|
-
|
225
|
+
assert_empty paths, paths.join(', ')
|
226
226
|
end
|
227
227
|
|
228
228
|
def test_fetch_bulk_index_error
|
@@ -244,7 +244,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
244
244
|
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
245
245
|
assert_equal "#{@gem_repo}yaml", paths.shift
|
246
246
|
|
247
|
-
|
247
|
+
assert_empty paths, paths.join(', ')
|
248
248
|
|
249
249
|
assert_equal 'Error fetching remote gem cache: SocketError',
|
250
250
|
e.message
|
@@ -272,7 +272,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
272
272
|
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
273
273
|
assert_equal "#{@gem_repo}yaml", paths.shift
|
274
274
|
|
275
|
-
|
275
|
+
assert_empty paths, paths.join(', ')
|
276
276
|
end
|
277
277
|
|
278
278
|
def test_fetch_bulk_index_marshal_mismatch
|
@@ -296,7 +296,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
296
296
|
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
297
297
|
assert_equal "#{@gem_repo}yaml", paths.shift
|
298
298
|
|
299
|
-
|
299
|
+
assert_empty paths, paths.join(', ')
|
300
300
|
end
|
301
301
|
|
302
302
|
def test_fetch_bulk_index_uncompressed
|
@@ -313,7 +313,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
313
313
|
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
314
314
|
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
315
315
|
|
316
|
-
|
316
|
+
assert_empty paths, paths.join(', ')
|
317
317
|
end
|
318
318
|
|
319
319
|
def test_fetch_quick_index
|
@@ -331,7 +331,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
331
331
|
|
332
332
|
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
333
333
|
|
334
|
-
|
334
|
+
assert_empty paths, paths.join(', ')
|
335
335
|
end
|
336
336
|
|
337
337
|
def test_fetch_quick_index_all
|
@@ -349,7 +349,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
349
349
|
|
350
350
|
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
351
351
|
|
352
|
-
|
352
|
+
assert_empty paths, paths.join(', ')
|
353
353
|
end
|
354
354
|
|
355
355
|
def test_fetch_quick_index_error
|
@@ -366,7 +366,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
366
366
|
|
367
367
|
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
368
368
|
|
369
|
-
|
369
|
+
assert_empty paths, paths.join(', ')
|
370
370
|
end
|
371
371
|
|
372
372
|
def test_fetch_quick_index_fallback
|
@@ -382,7 +382,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
382
382
|
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
383
383
|
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
384
384
|
|
385
|
-
|
385
|
+
assert_empty paths, paths.join(', ')
|
386
386
|
end
|
387
387
|
|
388
388
|
def test_fetch_quick_index_subdir
|
@@ -399,7 +399,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
399
399
|
|
400
400
|
assert_equal "#{repo}quick/latest_index.rz", paths.shift
|
401
401
|
|
402
|
-
|
402
|
+
assert_empty paths, paths.join(', ')
|
403
403
|
end
|
404
404
|
|
405
405
|
def test_fetch_single_spec
|
@@ -415,7 +415,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
415
415
|
|
416
416
|
assert_equal a1_spec_url, paths.shift
|
417
417
|
|
418
|
-
|
418
|
+
assert_empty paths, paths.join(', ')
|
419
419
|
end
|
420
420
|
|
421
421
|
def test_fetch_single_spec_subdir
|
@@ -432,7 +432,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
432
432
|
|
433
433
|
assert_equal a1_spec_url, paths.shift
|
434
434
|
|
435
|
-
|
435
|
+
assert_empty paths, paths.join(', ')
|
436
436
|
end
|
437
437
|
|
438
438
|
def test_fetch_single_spec_yaml
|
@@ -450,7 +450,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
450
450
|
assert_equal "#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz", paths.shift
|
451
451
|
assert_equal a1_spec_url, paths.shift
|
452
452
|
|
453
|
-
|
453
|
+
assert_empty paths, paths.join(', ')
|
454
454
|
end
|
455
455
|
|
456
456
|
def test_fetch_single_spec_yaml_subdir
|
@@ -468,7 +468,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
468
468
|
assert_equal "#{repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz", paths.shift
|
469
469
|
assert_equal a1_spec_url, paths.shift
|
470
470
|
|
471
|
-
|
471
|
+
assert_empty paths, paths.join(', ')
|
472
472
|
end
|
473
473
|
|
474
474
|
def test_find_missing
|
@@ -593,6 +593,17 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
593
593
|
assert_equal [updated_platform.name], @source_index.outdated
|
594
594
|
end
|
595
595
|
|
596
|
+
def test_prerelease_specs_kept_in_right_place
|
597
|
+
gem_a1_alpha = quick_gem 'abba', '1.a'
|
598
|
+
@source_index.add_spec gem_a1_alpha
|
599
|
+
|
600
|
+
refute @source_index.latest_specs.include?(gem_a1_alpha)
|
601
|
+
assert_nil @source_index.specification(gem_a1_alpha.full_name)
|
602
|
+
assert @source_index.prerelease_specs.include?(gem_a1_alpha)
|
603
|
+
|
604
|
+
# TODO: don't think this tests writing prerelease index to disk
|
605
|
+
end
|
606
|
+
|
596
607
|
def test_refresh_bang
|
597
608
|
a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec"
|
598
609
|
|
@@ -600,7 +611,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
600
611
|
|
601
612
|
source_index = Gem::SourceIndex.from_installed_gems
|
602
613
|
|
603
|
-
|
614
|
+
refute source_index.gems.include?(@a1.full_name)
|
604
615
|
|
605
616
|
FileUtils.mv File.join(@tempdir, "#{@a1.full_name}.gemspec"), a1_spec
|
606
617
|
|
@@ -711,7 +722,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
711
722
|
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
712
723
|
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
713
724
|
|
714
|
-
|
725
|
+
assert_empty paths, paths.join(', ')
|
715
726
|
end
|
716
727
|
|
717
728
|
def test_update_incremental
|
@@ -736,7 +747,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
736
747
|
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
737
748
|
assert_equal marshal_uri, paths.shift
|
738
749
|
|
739
|
-
|
750
|
+
assert_empty paths, paths.join(', ')
|
740
751
|
ensure
|
741
752
|
Gem.configuration = old_gem_conf
|
742
753
|
end
|
@@ -762,7 +773,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
762
773
|
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
763
774
|
assert_equal marshal_uri, paths.shift
|
764
775
|
|
765
|
-
|
776
|
+
assert_empty paths, paths.join(', ')
|
766
777
|
ensure
|
767
778
|
Gem.configuration = old_gem_conf
|
768
779
|
end
|
@@ -791,7 +802,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
791
802
|
assert_equal marshal_uri, paths.shift
|
792
803
|
assert_equal yaml_uri, paths.shift
|
793
804
|
|
794
|
-
|
805
|
+
assert_empty paths, paths.join(', ')
|
795
806
|
ensure
|
796
807
|
Gem.configuration = old_gem_conf
|
797
808
|
end
|
@@ -823,7 +834,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
823
834
|
assert_equal marshal_uri, paths.shift
|
824
835
|
assert_equal yaml_uri, paths.shift
|
825
836
|
|
826
|
-
|
837
|
+
assert_empty paths, paths.join(', ')
|
827
838
|
ensure
|
828
839
|
Gem.configuration = old_gem_conf
|
829
840
|
end
|
@@ -851,7 +862,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
851
862
|
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
852
863
|
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
853
864
|
|
854
|
-
|
865
|
+
assert_empty paths, paths.join(', ')
|
855
866
|
end
|
856
867
|
|
857
868
|
def test_update_with_missing
|