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
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems/test_case'
|
2
|
+
require 'rubygems/commands/mirror_command'
|
3
|
+
|
4
|
+
class TestGemCommandsMirrorCommand < Gem::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
|
9
|
+
@cmd = Gem::Commands::MirrorCommand.new
|
10
|
+
|
11
|
+
@mirror_specs = Gem::Specification.find_all_by_name('rubygems-mirror').each do |spec|
|
12
|
+
Gem::Specification.remove_spec spec
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def teardown
|
17
|
+
@mirror_specs.each do |spec|
|
18
|
+
Gem::Specification.add_spec spec
|
19
|
+
end
|
20
|
+
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_execute
|
25
|
+
use_ui @ui do
|
26
|
+
@cmd.execute
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_match %r%Install the rubygems-mirror%i, @ui.error
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -80,10 +80,8 @@ EOF
|
|
80
80
|
response = "You don't have permission to push to this gem"
|
81
81
|
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
@cmd.add_owners("freewill", ["user-new1@example.com"])
|
86
|
-
end
|
83
|
+
use_ui @ui do
|
84
|
+
@cmd.add_owners("freewill", ["user-new1@example.com"])
|
87
85
|
end
|
88
86
|
|
89
87
|
assert_match response, @ui.output
|
@@ -122,10 +120,8 @@ EOF
|
|
122
120
|
response = "You don't have permission to push to this gem"
|
123
121
|
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
|
124
122
|
|
125
|
-
|
126
|
-
|
127
|
-
@cmd.remove_owners("freewill", ["user-remove1@example.com"])
|
128
|
-
end
|
123
|
+
use_ui @ui do
|
124
|
+
@cmd.remove_owners("freewill", ["user-remove1@example.com"])
|
129
125
|
end
|
130
126
|
|
131
127
|
assert_match response, @ui.output
|
@@ -9,20 +9,31 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_execute
|
12
|
-
a = quick_spec 'a' do |s|
|
12
|
+
a = quick_spec 'a' do |s|
|
13
|
+
s.executables = %w[foo]
|
14
|
+
s.files = %w[bin/foo lib/a.rb]
|
15
|
+
end
|
13
16
|
|
17
|
+
write_file File.join(@tempdir, 'lib', 'a.rb') do |fp|
|
18
|
+
fp.puts "puts __FILE__"
|
19
|
+
end
|
14
20
|
write_file File.join(@tempdir, 'bin', 'foo') do |fp|
|
15
21
|
fp.puts "#!/usr/bin/ruby"
|
16
22
|
end
|
17
23
|
|
18
24
|
install_gem a
|
19
25
|
|
20
|
-
foo_path
|
26
|
+
foo_path = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
|
27
|
+
a_rb_path = File.join @gemhome, 'gems', a.full_name, 'lib', 'a.rb'
|
21
28
|
|
22
29
|
write_file foo_path do |io|
|
23
30
|
io.puts 'I changed it!'
|
24
31
|
end
|
25
32
|
|
33
|
+
write_file a_rb_path do |io|
|
34
|
+
io.puts 'I changed it!'
|
35
|
+
end
|
36
|
+
|
26
37
|
@cmd.options[:args] = %w[a]
|
27
38
|
|
28
39
|
use_ui @ui do
|
@@ -30,6 +41,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
30
41
|
end
|
31
42
|
|
32
43
|
assert_equal "#!/usr/bin/ruby\n", File.read(foo_path), foo_path
|
44
|
+
assert_equal "puts __FILE__\n", File.read(a_rb_path), a_rb_path
|
33
45
|
|
34
46
|
out = @ui.output.split "\n"
|
35
47
|
|
@@ -46,9 +58,11 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
46
58
|
|
47
59
|
install_gem a
|
48
60
|
|
49
|
-
gem_bin
|
61
|
+
gem_bin = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
|
62
|
+
gem_stub = File.join @gemhome, 'bin', 'foo'
|
50
63
|
|
51
64
|
FileUtils.rm gem_bin
|
65
|
+
FileUtils.rm gem_stub
|
52
66
|
|
53
67
|
@cmd.handle_options %w[--all]
|
54
68
|
|
@@ -57,6 +71,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
57
71
|
end
|
58
72
|
|
59
73
|
assert File.exist?(gem_bin)
|
74
|
+
assert File.exist?(gem_stub)
|
60
75
|
|
61
76
|
out = @ui.output.split "\n"
|
62
77
|
|
@@ -65,7 +80,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
65
80
|
assert_empty out, out.inspect
|
66
81
|
end
|
67
82
|
|
68
|
-
def
|
83
|
+
def test_execute_no_extension
|
69
84
|
a = quick_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
|
70
85
|
|
71
86
|
ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
|
@@ -90,6 +105,38 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
90
105
|
assert_empty out, out.inspect
|
91
106
|
end
|
92
107
|
|
108
|
+
def test_execute_with_extension_with_build_args
|
109
|
+
a = quick_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
|
110
|
+
|
111
|
+
ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
|
112
|
+
write_file ext_path do |io|
|
113
|
+
io.write <<-'RUBY'
|
114
|
+
File.open "Makefile", "w" do |f|
|
115
|
+
f.puts "all:\n\techo built\n"
|
116
|
+
f.puts "install:\n\techo built\n"
|
117
|
+
end
|
118
|
+
RUBY
|
119
|
+
end
|
120
|
+
|
121
|
+
build_args = %w!--with-awesome=true --sweet!
|
122
|
+
|
123
|
+
install_gem a, :build_args => build_args
|
124
|
+
|
125
|
+
@cmd.options[:args] = %w[a]
|
126
|
+
|
127
|
+
use_ui @ui do
|
128
|
+
@cmd.execute
|
129
|
+
end
|
130
|
+
|
131
|
+
out = @ui.output.split "\n"
|
132
|
+
|
133
|
+
assert_equal 'Restoring gems to pristine condition...', out.shift
|
134
|
+
assert_equal "Building native extensions with: '--with-awesome=true --sweet'", out.shift
|
135
|
+
assert_equal "This could take a while...", out.shift
|
136
|
+
assert_equal "Restored #{a.full_name}", out.shift
|
137
|
+
assert_empty out, out.inspect
|
138
|
+
end
|
139
|
+
|
93
140
|
def test_execute_many
|
94
141
|
a = quick_spec 'a'
|
95
142
|
b = quick_spec 'b'
|
@@ -195,5 +242,53 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
195
242
|
assert_match %r|at least one gem name|, e.message
|
196
243
|
end
|
197
244
|
|
245
|
+
def test_execute_only_executables
|
246
|
+
a = quick_spec 'a' do |s|
|
247
|
+
s.executables = %w[foo]
|
248
|
+
s.files = %w[bin/foo lib/a.rb]
|
249
|
+
end
|
250
|
+
write_file File.join(@tempdir, 'lib', 'a.rb') do |fp|
|
251
|
+
fp.puts "puts __FILE__"
|
252
|
+
end
|
253
|
+
write_file File.join(@tempdir, 'bin', 'foo') do |fp|
|
254
|
+
fp.puts "#!/usr/bin/ruby"
|
255
|
+
end
|
256
|
+
|
257
|
+
install_gem a
|
258
|
+
|
259
|
+
gem_lib = File.join @gemhome, 'gems', a.full_name, 'lib', 'a.rb'
|
260
|
+
gem_exec = File.join @gemhome, 'bin', 'foo'
|
261
|
+
|
262
|
+
FileUtils.rm gem_exec
|
263
|
+
FileUtils.rm gem_lib
|
264
|
+
|
265
|
+
@cmd.handle_options %w[--all --only-executables]
|
266
|
+
|
267
|
+
use_ui @ui do
|
268
|
+
@cmd.execute
|
269
|
+
end
|
270
|
+
|
271
|
+
assert File.exist? gem_exec
|
272
|
+
refute File.exist? gem_lib
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_execute_default_gem
|
276
|
+
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
277
|
+
nil, "default/gem.rb")
|
278
|
+
install_default_specs(default_gem_spec)
|
279
|
+
|
280
|
+
@cmd.options[:args] = %w[default]
|
281
|
+
|
282
|
+
use_ui @ui do
|
283
|
+
@cmd.execute
|
284
|
+
end
|
285
|
+
|
286
|
+
assert_equal([
|
287
|
+
"Restoring gems to pristine condition...",
|
288
|
+
"Skipped default-2.0.0.0, it is a default gem",
|
289
|
+
],
|
290
|
+
@ui.output.split("\n"))
|
291
|
+
assert_empty(@ui.error)
|
292
|
+
end
|
198
293
|
end
|
199
294
|
|
@@ -13,6 +13,9 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
13
13
|
|
14
14
|
def setup
|
15
15
|
super
|
16
|
+
ENV["RUBYGEMS_HOST"] = nil
|
17
|
+
Gem.host = Gem::DEFAULT_HOST
|
18
|
+
Gem.configuration.disable_default_gem_server = false
|
16
19
|
|
17
20
|
@gems_dir = File.join @tempdir, 'gems'
|
18
21
|
@cache_dir = File.join @gemhome, "cache"
|
@@ -23,6 +26,8 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
23
26
|
"ed244fbf2b1a52e012da8616c512fa47f9aa5250"
|
24
27
|
|
25
28
|
@spec, @path = util_gem "freewill", "1.0.0"
|
29
|
+
@host = Gem.host
|
30
|
+
@api_key = Gem.configuration.rubygems_api_key
|
26
31
|
|
27
32
|
@fetcher = Gem::FakeFetcher.new
|
28
33
|
Gem::RemoteFetcher.fetcher = @fetcher
|
@@ -35,35 +40,84 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
35
40
|
@cmd.send_gem(@path)
|
36
41
|
end
|
37
42
|
|
38
|
-
assert_match %r{Pushing gem to #{
|
43
|
+
assert_match %r{Pushing gem to #{@host}...}, @ui.output
|
39
44
|
|
40
45
|
assert_equal Net::HTTP::Post, @fetcher.last_request.class
|
41
46
|
assert_equal Gem.read_binary(@path), @fetcher.last_request.body
|
42
47
|
assert_equal File.size(@path), @fetcher.last_request["Content-Length"].to_i
|
43
48
|
assert_equal "application/octet-stream", @fetcher.last_request["Content-Type"]
|
44
|
-
assert_equal
|
49
|
+
assert_equal @api_key, @fetcher.last_request["Authorization"]
|
45
50
|
|
46
51
|
assert_match @response, @ui.output
|
47
52
|
end
|
48
53
|
|
54
|
+
def test_sending_when_default_host_disabled
|
55
|
+
Gem.configuration.disable_default_gem_server = true
|
56
|
+
response = "You must specify a gem server"
|
57
|
+
|
58
|
+
assert_raises Gem::MockGemUi::TermError do
|
59
|
+
use_ui @ui do
|
60
|
+
@cmd.send_gem(@path)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
assert_match response, @ui.error
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_sending_when_default_host_disabled_with_override
|
68
|
+
ENV["RUBYGEMS_HOST"] = @host
|
69
|
+
Gem.configuration.disable_default_gem_server = true
|
70
|
+
@response = "Successfully registered gem: freewill (1.0.0)"
|
71
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
|
72
|
+
|
73
|
+
send_battery
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_sending_gem_to_metadata_host
|
77
|
+
@host = "http://rubygems.engineyard.com"
|
78
|
+
|
79
|
+
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
|
80
|
+
spec.metadata['default_gem_server'] = @host
|
81
|
+
end
|
82
|
+
|
83
|
+
@api_key = "EYKEY"
|
84
|
+
|
85
|
+
keys = {
|
86
|
+
:rubygems_api_key => 'KEY',
|
87
|
+
@host => @api_key
|
88
|
+
}
|
89
|
+
|
90
|
+
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
91
|
+
open Gem.configuration.credentials_path, 'w' do |f|
|
92
|
+
f.write keys.to_yaml
|
93
|
+
end
|
94
|
+
Gem.configuration.load_api_keys
|
95
|
+
|
96
|
+
FileUtils.rm Gem.configuration.credentials_path
|
97
|
+
|
98
|
+
@response = "Successfully registered gem: freebird (1.0.1)"
|
99
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
|
100
|
+
send_battery
|
101
|
+
end
|
102
|
+
|
49
103
|
def test_sending_gem_default
|
50
104
|
@response = "Successfully registered gem: freewill (1.0.0)"
|
51
|
-
@fetcher.data["#{
|
105
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
|
52
106
|
|
53
107
|
send_battery
|
54
108
|
end
|
55
109
|
|
56
110
|
def test_sending_gem_host
|
57
111
|
@response = "Successfully registered gem: freewill (1.0.0)"
|
58
|
-
@fetcher.data["#{
|
59
|
-
@cmd.options[
|
112
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
|
113
|
+
@cmd.options['host'] = "#{Gem.host}"
|
60
114
|
|
61
115
|
send_battery
|
62
116
|
end
|
63
117
|
|
64
118
|
def test_sending_gem_ENV
|
65
119
|
@response = "Successfully registered gem: freewill (1.0.0)"
|
66
|
-
@fetcher.data["#{
|
120
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
|
67
121
|
ENV["RUBYGEMS_HOST"] = "#{Gem.host}"
|
68
122
|
|
69
123
|
send_battery
|
@@ -78,7 +132,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
78
132
|
|
79
133
|
def test_sending_gem_denied
|
80
134
|
response = "You don't have permission to push to this gem"
|
81
|
-
@fetcher.data["#{
|
135
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [response, 403, 'Forbidden']
|
82
136
|
|
83
137
|
assert_raises Gem::MockGemUi::TermError do
|
84
138
|
use_ui @ui do
|
@@ -91,7 +145,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
91
145
|
|
92
146
|
def test_sending_gem_key
|
93
147
|
@response = "Successfully registered gem: freewill (1.0.0)"
|
94
|
-
@fetcher.data["#{
|
148
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
|
95
149
|
File.open Gem.configuration.credentials_path, 'a' do |f|
|
96
150
|
f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
|
97
151
|
end
|
@@ -349,5 +349,56 @@ pl (1 i386-linux)
|
|
349
349
|
assert_equal "WARNING: prereleases are always shown locally\n", @ui.error
|
350
350
|
end
|
351
351
|
|
352
|
+
def test_execute_local_details
|
353
|
+
@a1.platform = 'x86-linux'
|
354
|
+
|
355
|
+
@a2.summary = 'This is a lot of text. ' * 4
|
356
|
+
@a2.authors = ['Abraham Lincoln', 'Hirohito']
|
357
|
+
@a2.homepage = 'http://a.example.com/'
|
358
|
+
@a2.rubyforge_project = 'rubygems'
|
359
|
+
@a2.platform = 'universal-darwin'
|
360
|
+
|
361
|
+
util_clear_gems
|
362
|
+
util_setup_spec_fetcher @a1, @a2, @pl1
|
363
|
+
|
364
|
+
@cmd.handle_options %w[-l -d]
|
365
|
+
|
366
|
+
use_ui @ui do
|
367
|
+
@cmd.execute
|
368
|
+
end
|
369
|
+
|
370
|
+
str = @ui.output
|
371
|
+
|
372
|
+
str.gsub!(/\(\d\): [^\n]*/, "-")
|
373
|
+
str.gsub!(/at: [^\n]*/, "at: -")
|
374
|
+
|
375
|
+
expected = <<-EOF
|
376
|
+
*** LOCAL GEMS ***
|
377
|
+
|
378
|
+
a (2, 1)
|
379
|
+
Platforms:
|
380
|
+
1: x86-linux
|
381
|
+
2: universal-darwin
|
382
|
+
Authors: Abraham Lincoln, Hirohito
|
383
|
+
Rubyforge: http://rubyforge.org/projects/rubygems
|
384
|
+
Homepage: http://a.example.com/
|
385
|
+
Installed at -
|
386
|
+
-
|
387
|
+
|
388
|
+
This is a lot of text. This is a lot of text. This is a lot of text.
|
389
|
+
This is a lot of text.
|
390
|
+
|
391
|
+
pl \(1\)
|
392
|
+
Platform: i386-linux
|
393
|
+
Author: A User
|
394
|
+
Homepage: http://example.com
|
395
|
+
Installed at: -
|
396
|
+
|
397
|
+
this is a summary
|
398
|
+
EOF
|
399
|
+
|
400
|
+
assert_match expected, @ui.output
|
401
|
+
end
|
402
|
+
|
352
403
|
end
|
353
404
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems/test_case'
|
2
|
+
require 'rubygems/commands/search_command'
|
3
|
+
|
4
|
+
class TestGemCommandsSearchCommand < Gem::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
|
9
|
+
@cmd = Gem::Commands::SearchCommand.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_execute
|
13
|
+
@cmd.handle_options %w[a]
|
14
|
+
|
15
|
+
use_ui @ui do
|
16
|
+
@cmd.execute
|
17
|
+
end
|
18
|
+
|
19
|
+
assert_match %r%REMOTE GEMS%, @ui.output
|
20
|
+
|
21
|
+
assert_empty @ui.error
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems/test_case'
|
2
|
+
require 'rubygems/commands/setup_command'
|
3
|
+
|
4
|
+
class TestGemCommandsSetupCommand < Gem::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
|
9
|
+
@install_dir = File.join @tempdir, 'install'
|
10
|
+
@cmd = Gem::Commands::SetupCommand.new
|
11
|
+
@cmd.options[:prefix] = @install_dir
|
12
|
+
|
13
|
+
FileUtils.mkdir_p 'bin'
|
14
|
+
FileUtils.mkdir_p 'lib/rubygems'
|
15
|
+
|
16
|
+
open 'bin/gem', 'w' do |io| io.puts '# gem' end
|
17
|
+
open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
|
18
|
+
open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_rb_files_in
|
22
|
+
assert_equal %w[rubygems.rb rubygems/test_case.rb],
|
23
|
+
@cmd.rb_files_in('lib').sort
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_remove_old_lib_files
|
27
|
+
lib = File.join @install_dir, 'lib'
|
28
|
+
lib_rubygems = File.join lib, 'rubygems'
|
29
|
+
|
30
|
+
old_builder_rb = File.join lib_rubygems, 'builder.rb'
|
31
|
+
old_format_rb = File.join lib_rubygems, 'format.rb'
|
32
|
+
|
33
|
+
FileUtils.mkdir_p lib_rubygems
|
34
|
+
|
35
|
+
open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
|
36
|
+
open old_format_rb, 'w' do |io| io.puts '# format.rb' end
|
37
|
+
|
38
|
+
@cmd.remove_old_lib_files lib
|
39
|
+
|
40
|
+
refute_path_exists old_builder_rb
|
41
|
+
refute_path_exists old_format_rb
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|