rubygems-update 1.8.30 → 2.0.0.preview2
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.
- checksums.yaml +6 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -0
- data/.autotest +6 -3
- data/History.txt +137 -63
- data/LICENSE.txt +1 -5
- data/Manifest.txt +69 -32
- data/README.rdoc +11 -9
- data/Rakefile +24 -38
- data/bin/gem +0 -9
- data/bin/update_rubygems +1 -0
- data/lib/rubygems.rb +193 -405
- data/lib/rubygems/available_set.rb +95 -0
- data/lib/rubygems/command.rb +88 -45
- data/lib/rubygems/command_manager.rb +67 -40
- data/lib/rubygems/commands/build_command.rb +5 -23
- data/lib/rubygems/commands/cert_command.rb +199 -57
- data/lib/rubygems/commands/check_command.rb +14 -39
- data/lib/rubygems/commands/cleanup_command.rb +9 -1
- data/lib/rubygems/commands/contents_command.rb +30 -12
- data/lib/rubygems/commands/dependency_command.rb +3 -8
- data/lib/rubygems/commands/environment_command.rb +13 -8
- data/lib/rubygems/commands/fetch_command.rb +3 -16
- data/lib/rubygems/commands/generate_index_command.rb +7 -47
- data/lib/rubygems/commands/help_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +69 -36
- data/lib/rubygems/commands/list_command.rb +6 -4
- data/lib/rubygems/commands/lock_command.rb +1 -1
- data/lib/rubygems/commands/mirror_command.rb +17 -0
- data/lib/rubygems/commands/outdated_command.rb +6 -3
- data/lib/rubygems/commands/owner_command.rb +13 -5
- data/lib/rubygems/commands/pristine_command.rb +19 -4
- data/lib/rubygems/commands/push_command.rb +12 -1
- data/lib/rubygems/commands/query_command.rb +43 -27
- data/lib/rubygems/commands/rdoc_command.rb +23 -28
- data/lib/rubygems/commands/search_command.rb +4 -18
- data/lib/rubygems/commands/server_command.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +124 -38
- data/lib/rubygems/commands/sources_command.rb +16 -16
- data/lib/rubygems/commands/specification_command.rb +11 -13
- data/lib/rubygems/commands/uninstall_command.rb +24 -7
- data/lib/rubygems/commands/unpack_command.rb +7 -3
- data/lib/rubygems/commands/update_command.rb +22 -36
- data/lib/rubygems/commands/yank_command.rb +98 -0
- data/lib/rubygems/compatibility.rb +51 -0
- data/lib/rubygems/config_file.rb +82 -54
- data/lib/rubygems/core_ext/kernel_gem.rb +53 -0
- data/lib/rubygems/core_ext/kernel_require.rb +119 -0
- data/lib/rubygems/defaults.rb +10 -21
- data/lib/rubygems/dependency.rb +61 -10
- data/lib/rubygems/dependency_installer.rb +157 -69
- data/lib/rubygems/dependency_list.rb +11 -19
- data/lib/rubygems/dependency_resolver.rb +562 -0
- data/lib/rubygems/deprecate.rb +40 -40
- data/lib/rubygems/errors.rb +77 -24
- data/lib/rubygems/exceptions.rb +25 -7
- data/lib/rubygems/ext/builder.rb +20 -23
- data/lib/rubygems/ext/configure_builder.rb +2 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +5 -45
- data/lib/rubygems/ext/rake_builder.rb +2 -2
- data/lib/rubygems/gem_runner.rb +3 -16
- data/lib/rubygems/gemcutter_utilities.rb +22 -7
- data/lib/rubygems/indexer.rb +6 -159
- data/lib/rubygems/install_message.rb +12 -0
- data/lib/rubygems/install_update_options.rb +56 -18
- data/lib/rubygems/installer.rb +244 -134
- data/lib/rubygems/installer_test_case.rb +71 -19
- data/lib/rubygems/mock_gem_ui.rb +17 -0
- data/lib/rubygems/name_tuple.rb +110 -0
- data/lib/rubygems/package.rb +514 -43
- data/lib/rubygems/package/digest_io.rb +64 -0
- data/lib/rubygems/package/old.rb +147 -0
- data/lib/rubygems/package/tar_header.rb +18 -55
- data/lib/rubygems/package/tar_reader.rb +20 -3
- data/lib/rubygems/package/tar_writer.rb +63 -7
- data/lib/rubygems/package_task.rb +3 -4
- data/lib/rubygems/path_support.rb +14 -7
- data/lib/rubygems/platform.rb +19 -26
- data/lib/rubygems/rdoc.rb +316 -0
- data/lib/rubygems/remote_fetcher.rb +117 -54
- data/lib/rubygems/request_set.rb +182 -0
- data/lib/rubygems/requirement.rb +63 -26
- data/lib/rubygems/security.rb +295 -555
- data/lib/rubygems/security/policies.rb +115 -0
- data/lib/rubygems/security/policy.rb +227 -0
- data/lib/rubygems/security/signer.rb +136 -0
- data/lib/rubygems/security/trust_dir.rb +104 -0
- data/lib/rubygems/server.rb +45 -55
- data/lib/rubygems/source.rb +144 -0
- data/lib/rubygems/source_list.rb +87 -0
- data/lib/rubygems/source_local.rb +92 -0
- data/lib/rubygems/source_specific_file.rb +28 -0
- data/lib/rubygems/spec_fetcher.rb +116 -184
- data/lib/rubygems/specification.rb +731 -335
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +88 -30
- data/lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem +90 -0
- data/lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem +57 -0
- data/lib/rubygems/syck_hack.rb +2 -0
- data/lib/rubygems/test_case.rb +199 -109
- data/lib/rubygems/test_utilities.rb +25 -5
- data/lib/rubygems/uninstaller.rb +62 -20
- data/lib/rubygems/user_interaction.rb +10 -0
- data/lib/rubygems/validator.rb +33 -40
- data/lib/rubygems/version.rb +19 -8
- data/setup.rb +8 -1
- data/test/rubygems/alternate_cert.pem +9 -0
- data/test/rubygems/alternate_cert_32.pem +9 -0
- data/test/rubygems/alternate_key.pem +9 -0
- data/test/rubygems/bad_rake.rb +1 -0
- data/test/rubygems/child_cert.pem +9 -0
- data/test/rubygems/child_cert_32.pem +9 -0
- data/test/rubygems/child_key.pem +9 -0
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/expired_cert.pem +9 -0
- data/test/rubygems/future_cert.pem +9 -0
- data/test/rubygems/future_cert_32.pem +9 -0
- data/test/rubygems/good_rake.rb +1 -0
- data/test/rubygems/grandchild_cert.pem +9 -0
- data/test/rubygems/grandchild_cert_32.pem +9 -0
- data/test/rubygems/grandchild_key.pem +9 -0
- data/test/rubygems/invalid_issuer_cert.pem +9 -0
- data/test/rubygems/invalid_issuer_cert_32.pem +9 -0
- data/test/rubygems/invalid_key.pem +9 -0
- data/test/rubygems/invalid_signer_cert.pem +9 -0
- data/test/rubygems/invalid_signer_cert_32.pem +9 -0
- data/test/rubygems/invalidchild_cert.pem +9 -0
- data/test/rubygems/invalidchild_cert_32.pem +9 -0
- data/test/rubygems/invalidchild_key.pem +9 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/private_key.pem +7 -25
- data/test/rubygems/public_cert.pem +8 -18
- data/test/rubygems/public_cert_32.pem +10 -0
- data/test/rubygems/public_key.pem +4 -0
- data/test/rubygems/rubygems/commands/crash_command.rb +1 -1
- data/test/rubygems/test_config.rb +4 -6
- data/test/rubygems/test_deprecate.rb +76 -0
- data/test/rubygems/test_gem.rb +318 -83
- data/test/rubygems/test_gem_available_set.rb +106 -0
- data/test/rubygems/test_gem_command.rb +10 -0
- data/test/rubygems/test_gem_command_manager.rb +55 -9
- data/test/rubygems/test_gem_commands_build_command.rb +11 -19
- data/test/rubygems/test_gem_commands_cert_command.rb +441 -42
- data/test/rubygems/test_gem_commands_cleanup_command.rb +29 -1
- data/test/rubygems/test_gem_commands_contents_command.rb +23 -0
- data/test/rubygems/test_gem_commands_dependency_command.rb +5 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +19 -20
- data/test/rubygems/test_gem_commands_generate_index_command.rb +2 -83
- data/test/rubygems/test_gem_commands_help_command.rb +2 -1
- data/test/rubygems/test_gem_commands_install_command.rb +647 -48
- data/test/rubygems/test_gem_commands_mirror.rb +32 -0
- data/test/rubygems/test_gem_commands_owner_command.rb +4 -8
- data/test/rubygems/test_gem_commands_pristine_command.rb +99 -4
- data/test/rubygems/test_gem_commands_push_command.rb +62 -8
- data/test/rubygems/test_gem_commands_query_command.rb +51 -0
- data/test/rubygems/test_gem_commands_search_command.rb +25 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +45 -0
- data/test/rubygems/test_gem_commands_sources_command.rb +21 -6
- data/test/rubygems/test_gem_commands_specification_command.rb +33 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +91 -31
- data/test/rubygems/test_gem_commands_unpack_command.rb +3 -3
- data/test/rubygems/test_gem_commands_update_command.rb +56 -38
- data/test/rubygems/test_gem_commands_which_command.rb +4 -4
- data/test/rubygems/test_gem_commands_yank_command.rb +97 -0
- data/test/rubygems/test_gem_config_file.rb +66 -21
- data/test/rubygems/test_gem_dependency.rb +46 -0
- data/test/rubygems/test_gem_dependency_installer.rb +228 -18
- data/test/rubygems/test_gem_dependency_list.rb +0 -9
- data/test/rubygems/test_gem_dependency_resolver.rb +327 -0
- data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -49
- data/test/rubygems/test_gem_ext_rake_builder.rb +13 -13
- data/test/rubygems/test_gem_gem_runner.rb +27 -5
- data/test/rubygems/test_gem_gemcutter_utilities.rb +19 -0
- data/test/rubygems/test_gem_indexer.rb +14 -227
- data/test/rubygems/test_gem_install_update_options.rb +83 -3
- data/test/rubygems/test_gem_installer.rb +211 -236
- data/test/rubygems/test_gem_local_remote_options.rb +8 -2
- data/test/rubygems/test_gem_name_tuple.rb +15 -0
- data/test/rubygems/test_gem_package.rb +547 -0
- data/test/rubygems/test_gem_package_old.rb +37 -0
- data/test/rubygems/test_gem_package_tar_reader.rb +32 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +84 -1
- data/test/rubygems/test_gem_path_support.rb +4 -30
- data/test/rubygems/test_gem_platform.rb +3 -6
- data/test/rubygems/test_gem_rdoc.rb +245 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +51 -5
- data/test/rubygems/test_gem_request_set.rb +70 -0
- data/test/rubygems/test_gem_requirement.rb +53 -24
- data/test/rubygems/test_gem_security.rb +189 -43
- data/test/rubygems/test_gem_security_policy.rb +376 -0
- data/test/rubygems/test_gem_security_signer.rb +184 -0
- data/test/rubygems/test_gem_security_trust_dir.rb +94 -0
- data/test/rubygems/test_gem_server.rb +31 -36
- data/test/rubygems/test_gem_silent_ui.rb +2 -2
- data/test/rubygems/test_gem_source.rb +188 -0
- data/test/rubygems/test_gem_source_list.rb +87 -0
- data/test/rubygems/test_gem_source_local.rb +83 -0
- data/test/rubygems/test_gem_source_specific_file.rb +33 -0
- data/test/rubygems/test_gem_spec_fetcher.rb +91 -255
- data/test/rubygems/test_gem_specification.rb +293 -39
- data/test/rubygems/test_gem_uninstaller.rb +136 -13
- data/test/rubygems/test_gem_validator.rb +14 -41
- data/test/rubygems/test_gem_version.rb +15 -21
- data/test/rubygems/test_require.rb +193 -0
- data/test/rubygems/wrong_key_cert.pem +9 -0
- data/test/rubygems/wrong_key_cert_32.pem +9 -0
- metadata +171 -83
- metadata.gz.sig +1 -0
- data/CVE-2013-4287.txt +0 -36
- data/CVE-2013-4363.txt +0 -45
- data/ci_build.sh +0 -27
- data/cruise_config.rb +0 -32
- data/lib/rbconfig/datadir.rb +0 -13
- data/lib/rubygems/builder.rb +0 -99
- data/lib/rubygems/custom_require.rb +0 -69
- data/lib/rubygems/doc_manager.rb +0 -243
- data/lib/rubygems/format.rb +0 -82
- data/lib/rubygems/gem_openssl.rb +0 -90
- data/lib/rubygems/gem_path_searcher.rb +0 -172
- data/lib/rubygems/old_format.rb +0 -153
- data/lib/rubygems/package/f_sync_dir.rb +0 -23
- data/lib/rubygems/package/tar_input.rb +0 -234
- data/lib/rubygems/package/tar_output.rb +0 -146
- data/lib/rubygems/require_paths_builder.rb +0 -18
- data/lib/rubygems/source_index.rb +0 -406
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/test/rubygems/test_bundled_ca.rb +0 -59
- data/test/rubygems/test_gem_builder.rb +0 -44
- data/test/rubygems/test_gem_doc_manager.rb +0 -32
- data/test/rubygems/test_gem_ext_builder.rb +0 -58
- data/test/rubygems/test_gem_format.rb +0 -88
- data/test/rubygems/test_gem_gem_path_searcher.rb +0 -94
- data/test/rubygems/test_gem_package_tar_input.rb +0 -129
- data/test/rubygems/test_gem_package_tar_output.rb +0 -101
- data/test/rubygems/test_gem_source_index.rb +0 -250
- data/util/update_bundled_ca_certificates.rb +0 -103
@@ -1,129 +0,0 @@
|
|
1
|
-
require 'rubygems/package/tar_test_case'
|
2
|
-
require 'rubygems/package/tar_input'
|
3
|
-
|
4
|
-
class TestGemPackageTarInput < Gem::Package::TarTestCase
|
5
|
-
|
6
|
-
# Sometimes the setgid bit doesn't take. Don't know if this is a problem on
|
7
|
-
# all systems, or just some. But for now, we will ignore it in the tests.
|
8
|
-
SETGID_BIT = 02000
|
9
|
-
|
10
|
-
def setup
|
11
|
-
super
|
12
|
-
|
13
|
-
inner_tar = tar_file_header("bla", "", 0612, 10)
|
14
|
-
inner_tar += "0123456789" + "\0" * 502
|
15
|
-
inner_tar += tar_file_header("foo", "", 0636, 5)
|
16
|
-
inner_tar += "01234" + "\0" * 507
|
17
|
-
inner_tar += tar_dir_header("__dir__", "", 0600)
|
18
|
-
inner_tar += "\0" * 1024
|
19
|
-
str = TempIO.new
|
20
|
-
|
21
|
-
begin
|
22
|
-
os = Zlib::GzipWriter.new str
|
23
|
-
os.write inner_tar
|
24
|
-
ensure
|
25
|
-
os.finish
|
26
|
-
end
|
27
|
-
|
28
|
-
str.rewind
|
29
|
-
|
30
|
-
@file = File.join @tempdir, 'bla.tar'
|
31
|
-
|
32
|
-
File.open @file, 'wb' do |f|
|
33
|
-
f.write tar_file_header("data.tar.gz", "", 0644, str.string.size)
|
34
|
-
f.write str.string
|
35
|
-
f.write "\0" * ((512 - (str.string.size % 512)) % 512 )
|
36
|
-
|
37
|
-
@spec = Gem::Specification.new do |spec|
|
38
|
-
spec.author = "Mauricio :)"
|
39
|
-
end
|
40
|
-
|
41
|
-
meta = @spec.to_yaml
|
42
|
-
|
43
|
-
f.write tar_file_header("metadata", "", 0644, meta.size)
|
44
|
-
f.write meta + "\0" * (1024 - meta.size)
|
45
|
-
f.write "\0" * 1024
|
46
|
-
end
|
47
|
-
|
48
|
-
@entry_names = %w{bla foo __dir__}
|
49
|
-
@entry_sizes = [10, 5, 0]
|
50
|
-
#FIXME: are these modes system dependent?
|
51
|
-
@entry_modes = [0100612, 0100636, 040600]
|
52
|
-
@entry_files = %W[#{@tempdir}/bla #{@tempdir}/foo]
|
53
|
-
@entry_contents = %w[0123456789 01234]
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_initialize_no_metadata_file
|
57
|
-
Tempfile.open 'no_meta' do |io|
|
58
|
-
io.write tar_file_header('a', '', 0644, 1)
|
59
|
-
io.write 'a'
|
60
|
-
io.rewind
|
61
|
-
|
62
|
-
e = assert_raises Gem::Package::FormatError do
|
63
|
-
open io.path, Gem.binary_mode do |file|
|
64
|
-
Gem::Package::TarInput.open file do end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
assert_equal "no metadata found in #{io.path}", e.message
|
69
|
-
assert_equal io.path, e.path
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_each
|
74
|
-
open @file, 'rb' do |io|
|
75
|
-
Gem::Package::TarInput.open io do |tar_input|
|
76
|
-
count = 0
|
77
|
-
|
78
|
-
tar_input.each_with_index do |entry, i|
|
79
|
-
count = i
|
80
|
-
|
81
|
-
assert_kind_of Gem::Package::TarReader::Entry, entry
|
82
|
-
assert_equal @entry_names[i], entry.header.name
|
83
|
-
assert_equal @entry_sizes[i], entry.header.size
|
84
|
-
end
|
85
|
-
|
86
|
-
assert_equal 2, count
|
87
|
-
|
88
|
-
assert_equal @spec, tar_input.metadata
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_extract_entry
|
94
|
-
open @file, 'rb' do |io|
|
95
|
-
Gem::Package::TarInput.open io do |tar_input|
|
96
|
-
assert_equal @spec, tar_input.metadata
|
97
|
-
|
98
|
-
count = 0
|
99
|
-
|
100
|
-
tar_input.each_with_index do |entry, i|
|
101
|
-
count = i
|
102
|
-
tar_input.extract_entry @tempdir, entry
|
103
|
-
name = File.join @tempdir, entry.header.name
|
104
|
-
|
105
|
-
if entry.directory? then
|
106
|
-
assert File.directory?(name)
|
107
|
-
else
|
108
|
-
assert File.file?(name)
|
109
|
-
assert_equal @entry_sizes[i], File.stat(name).size
|
110
|
-
#FIXME: win32? !!
|
111
|
-
end
|
112
|
-
|
113
|
-
unless Gem.win_platform? then
|
114
|
-
assert_equal @entry_modes[i], File.stat(name).mode & (~SETGID_BIT)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
assert_equal 2, count
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
@entry_files.each_with_index do |x, i|
|
123
|
-
assert File.file?(x)
|
124
|
-
assert_equal @entry_contents[i], Gem.read_binary(x)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'rubygems/package/tar_test_case'
|
2
|
-
require 'rubygems/package/tar_output'
|
3
|
-
require 'rubygems/security'
|
4
|
-
|
5
|
-
class TestGemPackageTarOutput < Gem::Package::TarTestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
|
10
|
-
@file = File.join @tempdir, 'bla2.tar'
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_self_open
|
14
|
-
open @file, 'wb' do |tar_io|
|
15
|
-
Gem::Package::TarOutput.open tar_io do |tar_writer|
|
16
|
-
tar_writer.add_file_simple 'README', 0, 17 do |io|
|
17
|
-
io.write "This is a README\n"
|
18
|
-
end
|
19
|
-
|
20
|
-
tar_writer.metadata = "This is some metadata\n"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
files = util_extract
|
25
|
-
|
26
|
-
name, data = files.shift
|
27
|
-
assert_equal 'data.tar.gz', name
|
28
|
-
|
29
|
-
gz = Zlib::GzipReader.new StringIO.new(data)
|
30
|
-
|
31
|
-
Gem::Package::TarReader.new gz do |tar_reader|
|
32
|
-
tar_reader.each do |entry|
|
33
|
-
assert_equal 'README', entry.full_name
|
34
|
-
assert_equal "This is a README\n", entry.read
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
gz.close
|
39
|
-
|
40
|
-
name, data = files.shift
|
41
|
-
assert_equal 'metadata.gz', name
|
42
|
-
|
43
|
-
gz = Zlib::GzipReader.new StringIO.new(data)
|
44
|
-
assert_equal "This is some metadata\n", gz.read
|
45
|
-
|
46
|
-
assert_empty files
|
47
|
-
ensure
|
48
|
-
gz.close if gz
|
49
|
-
end
|
50
|
-
|
51
|
-
if defined? OpenSSL then
|
52
|
-
def test_self_open_signed
|
53
|
-
@private_key = File.expand_path('test/rubygems/private_key.pem', @@project_dir)
|
54
|
-
@public_cert = File.expand_path('test/rubygems/public_cert.pem', @@project_dir)
|
55
|
-
|
56
|
-
signer = Gem::Security::Signer.new @private_key, [@public_cert]
|
57
|
-
|
58
|
-
open @file, 'wb' do |tar_io|
|
59
|
-
Gem::Package::TarOutput.open tar_io, signer do |tar_writer|
|
60
|
-
tar_writer.add_file_simple 'README', 0, 17 do |io|
|
61
|
-
io.write "This is a README\n"
|
62
|
-
end
|
63
|
-
|
64
|
-
tar_writer.metadata = "This is some metadata\n"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
files = util_extract
|
69
|
-
|
70
|
-
name, data = files.shift
|
71
|
-
assert_equal 'data.tar.gz', name
|
72
|
-
|
73
|
-
name, data = files.shift
|
74
|
-
assert_equal 'metadata.gz', name
|
75
|
-
|
76
|
-
name, data = files.shift
|
77
|
-
assert_equal 'data.tar.gz.sig', name
|
78
|
-
|
79
|
-
name, data = files.shift
|
80
|
-
assert_equal 'metadata.gz.sig', name
|
81
|
-
|
82
|
-
assert_empty files
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def util_extract
|
87
|
-
files = []
|
88
|
-
|
89
|
-
open @file, 'rb' do |io|
|
90
|
-
Gem::Package::TarReader.new io do |tar_reader|
|
91
|
-
tar_reader.each do |entry|
|
92
|
-
files << [entry.full_name, entry.read]
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
files
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
|
@@ -1,250 +0,0 @@
|
|
1
|
-
require 'rubygems/test_case'
|
2
|
-
require 'rubygems/source_index'
|
3
|
-
require 'rubygems/config_file'
|
4
|
-
require 'rubygems/deprecate'
|
5
|
-
|
6
|
-
class TestGemSourceIndex < Gem::TestCase
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
|
10
|
-
util_setup_fake_fetcher
|
11
|
-
|
12
|
-
@source_index = Gem::Deprecate.skip_during { Gem.source_index }
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_find_name
|
16
|
-
Gem::Deprecate.skip_during do
|
17
|
-
assert_equal [@a1, @a2, @a3a], @source_index.find_name('a')
|
18
|
-
assert_equal [@a2], @source_index.find_name('a', '= 2')
|
19
|
-
assert_equal [], @source_index.find_name('bogusstring')
|
20
|
-
assert_equal [], @source_index.find_name('a', '= 3')
|
21
|
-
|
22
|
-
source_index = Gem::SourceIndex.new
|
23
|
-
source_index.add_spec @a1
|
24
|
-
source_index.add_spec @a2
|
25
|
-
|
26
|
-
assert_equal [@a1], source_index.find_name(@a1.name, '= 1')
|
27
|
-
|
28
|
-
r1 = Gem::Requirement.create '= 1'
|
29
|
-
assert_equal [@a1], source_index.find_name(@a1.name, r1)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_find_name_empty_cache
|
34
|
-
Gem::Deprecate.skip_during do
|
35
|
-
empty_source_index = Gem::SourceIndex.new
|
36
|
-
assert_equal [], empty_source_index.find_name("foo")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# HACK: deprecated impl is failing tests, but I may want to port it over
|
41
|
-
def test_latest_specs
|
42
|
-
Gem::Deprecate.skip_during do
|
43
|
-
p1_ruby = quick_spec 'p', '1'
|
44
|
-
p1_platform = quick_spec 'p', '1' do |spec|
|
45
|
-
spec.platform = Gem::Platform::CURRENT
|
46
|
-
end
|
47
|
-
|
48
|
-
a1_platform = quick_spec @a1.name, (@a1.version) do |s|
|
49
|
-
s.platform = Gem::Platform.new 'x86-my_platform1'
|
50
|
-
end
|
51
|
-
|
52
|
-
a2_platform = quick_spec @a2.name, (@a2.version) do |s|
|
53
|
-
s.platform = Gem::Platform.new 'x86-my_platform1'
|
54
|
-
end
|
55
|
-
|
56
|
-
a2_platform_other = quick_spec @a2.name, (@a2.version) do |s|
|
57
|
-
s.platform = Gem::Platform.new 'x86-other_platform1'
|
58
|
-
end
|
59
|
-
|
60
|
-
a3_platform_other = quick_spec @a2.name, (@a2.version.bump) do |s|
|
61
|
-
s.platform = Gem::Platform.new 'x86-other_platform1'
|
62
|
-
end
|
63
|
-
|
64
|
-
@source_index.add_spec p1_ruby
|
65
|
-
@source_index.add_spec p1_platform
|
66
|
-
@source_index.add_spec a1_platform
|
67
|
-
@source_index.add_spec a2_platform
|
68
|
-
@source_index.add_spec a2_platform_other
|
69
|
-
@source_index.add_spec a3_platform_other
|
70
|
-
|
71
|
-
expected = [
|
72
|
-
@a2.full_name,
|
73
|
-
a2_platform.full_name,
|
74
|
-
a3_platform_other.full_name,
|
75
|
-
@b2.full_name,
|
76
|
-
@c1_2.full_name,
|
77
|
-
@a_evil9.full_name,
|
78
|
-
p1_ruby.full_name,
|
79
|
-
p1_platform.full_name,
|
80
|
-
@pl1.full_name
|
81
|
-
].sort
|
82
|
-
|
83
|
-
latest_specs = @source_index.latest_specs.map { |s| s.full_name }.sort
|
84
|
-
|
85
|
-
assert_equal expected, latest_specs
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_load_gems_in
|
90
|
-
Gem::Deprecate.skip_during do
|
91
|
-
spec_dir1 = File.join @gemhome, 'specifications'
|
92
|
-
spec_dir2 = File.join @tempdir, 'gemhome2', 'specifications'
|
93
|
-
|
94
|
-
FileUtils.rm_r spec_dir1
|
95
|
-
|
96
|
-
FileUtils.mkdir_p spec_dir1
|
97
|
-
FileUtils.mkdir_p spec_dir2
|
98
|
-
|
99
|
-
a1 = quick_spec 'a', '1' do |spec| spec.author = 'author 1' end
|
100
|
-
a2 = quick_spec 'a', '1' do |spec| spec.author = 'author 2' end
|
101
|
-
|
102
|
-
path1 = File.join(spec_dir1, a1.spec_name)
|
103
|
-
path2 = File.join(spec_dir2, a2.spec_name)
|
104
|
-
|
105
|
-
File.open path1, 'w' do |fp|
|
106
|
-
fp.write a1.to_ruby
|
107
|
-
end
|
108
|
-
|
109
|
-
File.open path2, 'w' do |fp|
|
110
|
-
fp.write a2.to_ruby
|
111
|
-
end
|
112
|
-
|
113
|
-
@source_index.load_gems_in File.dirname(path1), File.dirname(path2)
|
114
|
-
|
115
|
-
assert_equal a1.author, @source_index.specification(a1.full_name).author
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
# REFACTOR: move to test_gem_commands_outdated_command.rb
|
120
|
-
def test_outdated
|
121
|
-
Gem::Deprecate.skip_during do
|
122
|
-
util_setup_spec_fetcher
|
123
|
-
|
124
|
-
assert_equal [], @source_index.outdated
|
125
|
-
|
126
|
-
updated = quick_spec @a2.name, (@a2.version.bump)
|
127
|
-
util_setup_spec_fetcher updated
|
128
|
-
|
129
|
-
assert_equal [updated.name], @source_index.outdated
|
130
|
-
|
131
|
-
updated_platform = quick_spec @a2.name, (updated.version.bump) do |s|
|
132
|
-
s.platform = Gem::Platform.new 'x86-other_platform1'
|
133
|
-
end
|
134
|
-
|
135
|
-
util_setup_spec_fetcher updated, updated_platform
|
136
|
-
|
137
|
-
assert_equal [updated_platform.name], @source_index.outdated
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_prerelease_specs_kept_in_right_place
|
142
|
-
Gem::Deprecate.skip_during do
|
143
|
-
gem_a1_alpha = quick_spec 'abba', '1.a'
|
144
|
-
@source_index.add_spec gem_a1_alpha
|
145
|
-
|
146
|
-
refute_includes @source_index.latest_specs, gem_a1_alpha
|
147
|
-
assert_includes @source_index.latest_specs(true), gem_a1_alpha
|
148
|
-
assert_empty @source_index.find_name gem_a1_alpha.full_name
|
149
|
-
assert_includes @source_index.prerelease_specs, gem_a1_alpha
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_refresh_bang
|
154
|
-
Gem::Deprecate.skip_during do
|
155
|
-
a1_spec = File.join @gemhome, "specifications", @a1.spec_name
|
156
|
-
|
157
|
-
FileUtils.mv a1_spec, @tempdir
|
158
|
-
|
159
|
-
Gem::Specification.reset
|
160
|
-
Gem.send :class_variable_set, :@@source_index, nil
|
161
|
-
source_index = Gem.source_index
|
162
|
-
|
163
|
-
refute_includes source_index.gems.keys.sort, @a1.full_name
|
164
|
-
|
165
|
-
FileUtils.mv File.join(@tempdir, @a1.spec_name), a1_spec
|
166
|
-
|
167
|
-
source_index.refresh!
|
168
|
-
|
169
|
-
assert source_index.gems.include?(@a1.full_name)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_remove_spec
|
174
|
-
Gem::Deprecate.skip_during do
|
175
|
-
si = Gem.source_index
|
176
|
-
|
177
|
-
expected = si.gems.keys.sort
|
178
|
-
|
179
|
-
expected.delete "a-1"
|
180
|
-
@source_index.remove_spec 'a-1'
|
181
|
-
|
182
|
-
assert_equal expected, si.gems.keys.sort
|
183
|
-
|
184
|
-
expected.delete "a-3.a"
|
185
|
-
@source_index.remove_spec 'a-3.a'
|
186
|
-
|
187
|
-
assert_equal expected, si.gems.keys.sort
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_search
|
192
|
-
Gem::Deprecate.skip_during do
|
193
|
-
requirement = Gem::Requirement.create '= 9'
|
194
|
-
with_version = Gem::Dependency.new(/^a/, requirement)
|
195
|
-
assert_equal [@a_evil9], @source_index.search(with_version)
|
196
|
-
|
197
|
-
with_default = Gem::Dependency.new(/^a/, Gem::Requirement.default)
|
198
|
-
assert_equal [@a1, @a2, @a3a, @a_evil9], @source_index.search(with_default)
|
199
|
-
|
200
|
-
c1_1_dep = Gem::Dependency.new 'c', '~> 1.1'
|
201
|
-
assert_equal [@c1_2], @source_index.search(c1_1_dep)
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
def test_search_platform
|
206
|
-
Gem::Deprecate.skip_during do
|
207
|
-
util_set_arch 'x86-my_platform1'
|
208
|
-
|
209
|
-
a1 = quick_spec 'a', '1'
|
210
|
-
a1_mine = quick_spec 'a', '1' do |s|
|
211
|
-
s.platform = Gem::Platform.new 'x86-my_platform1'
|
212
|
-
end
|
213
|
-
a1_other = quick_spec 'a', '1' do |s|
|
214
|
-
s.platform = Gem::Platform.new 'x86-other_platform1'
|
215
|
-
end
|
216
|
-
|
217
|
-
si = Gem::SourceIndex.new
|
218
|
-
si.add_specs a1, a1_mine, a1_other
|
219
|
-
|
220
|
-
dep = Gem::Dependency.new 'a', Gem::Requirement.new('1')
|
221
|
-
|
222
|
-
gems = si.search dep, true
|
223
|
-
|
224
|
-
assert_equal [a1, a1_mine], gems.sort
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
def test_signature
|
229
|
-
Gem::Deprecate.skip_during do
|
230
|
-
sig = @source_index.gem_signature('foo-1.2.3')
|
231
|
-
assert_equal 64, sig.length
|
232
|
-
assert_match(/^[a-f0-9]{64}$/, sig)
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
def test_specification
|
237
|
-
Gem::Deprecate.skip_during do
|
238
|
-
assert_equal @a1, @source_index.specification(@a1.full_name)
|
239
|
-
|
240
|
-
assert_nil @source_index.specification("foo-1.2.4")
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
def test_index_signature
|
245
|
-
Gem::Deprecate.skip_during do
|
246
|
-
sig = @source_index.index_signature
|
247
|
-
assert_match(/^[a-f0-9]{64}$/, sig)
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|