rubygems-update 1.5.3 → 1.6.0
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 +2 -1
- data/History.txt +60 -9
- data/Manifest.txt +1 -1
- data/Rakefile +0 -2
- data/lib/rubygems.rb +142 -65
- data/lib/rubygems/commands/owner_command.rb +3 -2
- data/lib/rubygems/commands/pristine_command.rb +5 -3
- data/lib/rubygems/commands/push_command.rb +8 -4
- data/lib/rubygems/commands/setup_command.rb +1 -2
- data/lib/rubygems/commands/uninstall_command.rb +5 -0
- data/lib/rubygems/commands/unpack_command.rb +10 -16
- data/lib/rubygems/config_file.rb +12 -5
- data/lib/rubygems/custom_require.rb +27 -7
- data/lib/rubygems/dependency.rb +33 -8
- data/lib/rubygems/dependency_installer.rb +21 -6
- data/lib/rubygems/dependency_list.rb +35 -3
- data/lib/rubygems/doc_manager.rb +6 -4
- data/lib/rubygems/gem_path_searcher.rb +45 -1
- data/lib/rubygems/gemcutter_utilities.rb +33 -0
- data/lib/rubygems/indexer.rb +1 -0
- data/lib/rubygems/installer.rb +11 -7
- data/lib/rubygems/installer_test_case.rb +23 -15
- data/lib/rubygems/mock_gem_ui.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +29 -10
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/security.rb +1 -0
- data/lib/rubygems/source_index.rb +3 -2
- data/lib/rubygems/spec_fetcher.rb +3 -1
- data/lib/rubygems/specification.rb +54 -12
- data/lib/rubygems/test_case.rb +99 -28
- data/lib/rubygems/test_utilities.rb +11 -1
- data/lib/rubygems/uninstaller.rb +22 -11
- data/lib/rubygems/user_interaction.rb +50 -29
- data/lib/rubygems/validator.rb +1 -1
- data/test/rubygems/fix_openssl_warnings.rb +12 -0
- data/test/rubygems/plugin/load/rubygems_plugin.rb +3 -1
- data/test/rubygems/test_gem.rb +384 -38
- data/test/rubygems/test_gem_builder.rb +1 -1
- data/test/rubygems/test_gem_command_manager.rb +2 -2
- data/test/rubygems/test_gem_commands_build_command.rb +1 -1
- data/test/rubygems/test_gem_commands_cert_command.rb +2 -1
- data/test/rubygems/test_gem_commands_dependency_command.rb +6 -5
- data/test/rubygems/test_gem_commands_fetch_command.rb +4 -4
- data/test/rubygems/test_gem_commands_install_command.rb +21 -18
- data/test/rubygems/test_gem_commands_lock_command.rb +1 -1
- data/test/rubygems/test_gem_commands_outdated_command.rb +2 -5
- data/test/rubygems/test_gem_commands_owner_command.rb +42 -0
- data/test/rubygems/test_gem_commands_pristine_command.rb +28 -8
- data/test/rubygems/test_gem_commands_push_command.rb +31 -5
- data/test/rubygems/test_gem_commands_specification_command.rb +8 -8
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +23 -4
- data/test/rubygems/test_gem_commands_unpack_command.rb +10 -8
- data/test/rubygems/test_gem_commands_update_command.rb +16 -13
- data/test/rubygems/test_gem_commands_which_command.rb +1 -1
- data/test/rubygems/test_gem_config_file.rb +14 -0
- data/test/rubygems/test_gem_dependency.rb +39 -0
- data/test/rubygems/test_gem_dependency_installer.rb +213 -92
- data/test/rubygems/test_gem_dependency_list.rb +37 -17
- data/test/rubygems/test_gem_doc_manager.rb +5 -4
- data/test/rubygems/test_gem_format.rb +2 -2
- data/test/rubygems/test_gem_gemcutter_utilities.rb +48 -0
- data/test/rubygems/test_gem_indexer.rb +11 -10
- data/test/rubygems/test_gem_install_update_options.rb +0 -2
- data/test/rubygems/test_gem_installer.rb +151 -78
- data/test/rubygems/test_gem_package_tar_output.rb +3 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +23 -14
- data/test/rubygems/test_gem_requirement.rb +4 -0
- data/test/rubygems/test_gem_security.rb +1 -0
- data/test/rubygems/test_gem_source_index.rb +17 -16
- data/test/rubygems/test_gem_spec_fetcher.rb +6 -1
- data/test/rubygems/test_gem_specification.rb +81 -31
- data/test/rubygems/test_gem_stream_ui.rb +11 -1
- data/test/rubygems/test_gem_uninstaller.rb +70 -10
- data/test/rubygems/test_gem_validator.rb +1 -1
- data/test/rubygems/test_kernel.rb +1 -1
- metadata +7 -7
- metadata.gz.sig +0 -0
- data/ChangeLog +0 -5811
@@ -11,7 +11,7 @@ class TestGemCommandManager < Gem::TestCase
|
|
11
11
|
|
12
12
|
def test_run_interrupt
|
13
13
|
old_load_path = $:.dup
|
14
|
-
$: << "test/rubygems"
|
14
|
+
$: << File.expand_path("test/rubygems", @@project_dir)
|
15
15
|
Gem.load_env_plugins
|
16
16
|
|
17
17
|
use_ui @ui do
|
@@ -27,7 +27,7 @@ class TestGemCommandManager < Gem::TestCase
|
|
27
27
|
|
28
28
|
def test_run_crash_command
|
29
29
|
old_load_path = $:.dup
|
30
|
-
$: << "test/rubygems"
|
30
|
+
$: << File.expand_path("test/rubygems", @@project_dir)
|
31
31
|
|
32
32
|
@command_manager.register_command :crash
|
33
33
|
use_ui @ui do
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems/test_case'
|
2
2
|
require 'rubygems/commands/cert_command'
|
3
|
+
require 'rubygems/fix_openssl_warnings' if RUBY_VERSION < "1.9"
|
3
4
|
|
4
5
|
unless defined? OpenSSL then
|
5
6
|
warn "`gem cert` tests are being skipped, module OpenSSL not found"
|
@@ -15,7 +16,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
|
|
15
16
|
|
16
17
|
@cmd = Gem::Commands::CertCommand.new
|
17
18
|
|
18
|
-
root = File.expand_path(File.dirname(__FILE__))
|
19
|
+
root = File.expand_path(File.dirname(__FILE__), @@project_dir)
|
19
20
|
|
20
21
|
FileUtils.cp File.join(root, 'data', 'gem-private_key.pem'), @tempdir
|
21
22
|
FileUtils.cp File.join(root, 'data', 'gem-public_cert.pem'), @tempdir
|
@@ -26,7 +26,7 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
|
|
26
26
|
@cmd.execute
|
27
27
|
end
|
28
28
|
|
29
|
-
assert_equal "Gem foo-2\n bar (> 1
|
29
|
+
assert_equal "Gem foo-2\n bar (> 1)\n baz (> 1)\n\n",
|
30
30
|
@ui.output
|
31
31
|
assert_equal '', @ui.error
|
32
32
|
end
|
@@ -77,7 +77,7 @@ Gem pl-1-x86-linux
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def test_execute_pipe_format
|
80
|
-
|
80
|
+
quick_spec 'foo' do |gem|
|
81
81
|
gem.add_dependency 'bar', '> 1'
|
82
82
|
end
|
83
83
|
|
@@ -121,6 +121,7 @@ Gem b-2
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def test_execute_reverse
|
124
|
+
# FIX: this shouldn't need to write out, but fails if you switch it
|
124
125
|
quick_gem 'foo' do |gem|
|
125
126
|
gem.add_dependency 'bar', '> 1'
|
126
127
|
end
|
@@ -140,9 +141,9 @@ Gem b-2
|
|
140
141
|
|
141
142
|
expected = <<-EOF
|
142
143
|
Gem foo-2
|
143
|
-
bar (> 1
|
144
|
+
bar (> 1)
|
144
145
|
Used by
|
145
|
-
baz-2 (foo (>= 0
|
146
|
+
baz-2 (foo (>= 0))
|
146
147
|
|
147
148
|
EOF
|
148
149
|
|
@@ -188,7 +189,7 @@ ERROR: Only reverse dependencies for local gems are supported.
|
|
188
189
|
@cmd.execute
|
189
190
|
end
|
190
191
|
|
191
|
-
assert_equal "Gem foo-2\n bar (> 1
|
192
|
+
assert_equal "Gem foo-2\n bar (> 1)\n\n", @ui.output
|
192
193
|
assert_equal '', @ui.error
|
193
194
|
end
|
194
195
|
|
@@ -16,7 +16,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
16
16
|
util_setup_spec_fetcher @a2
|
17
17
|
|
18
18
|
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
19
|
-
File.read(
|
19
|
+
File.read(Gem.cache_gem(@a2.file_name, @gemhome))
|
20
20
|
|
21
21
|
@cmd.options[:args] = [@a2.name]
|
22
22
|
|
@@ -35,9 +35,9 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
35
35
|
util_setup_spec_fetcher @a2, @a2_pre
|
36
36
|
|
37
37
|
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
38
|
-
File.read(
|
38
|
+
File.read(Gem.cache_gem(@a2.file_name, @gemhome))
|
39
39
|
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
40
|
-
File.read(
|
40
|
+
File.read(Gem.cache_gem(@a2_pre.file_name, @gemhome))
|
41
41
|
|
42
42
|
@cmd.options[:args] = [@a2.name]
|
43
43
|
@cmd.options[:prerelease] = true
|
@@ -57,7 +57,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
57
57
|
util_setup_spec_fetcher @a1, @a2
|
58
58
|
|
59
59
|
@fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
|
60
|
-
File.read(
|
60
|
+
File.read(Gem.cache_gem(@a1.file_name, @gemhome))
|
61
61
|
|
62
62
|
@cmd.options[:args] = [@a2.name]
|
63
63
|
@cmd.options[:version] = Gem::Requirement.new '1'
|
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'rubygems/test_case'
|
2
2
|
require 'rubygems/commands/install_command'
|
3
3
|
|
4
|
+
begin
|
5
|
+
gem "rdoc"
|
6
|
+
rescue Gem::LoadError
|
7
|
+
# ignore
|
8
|
+
end
|
9
|
+
|
4
10
|
class TestGemCommandsInstallCommand < Gem::TestCase
|
5
11
|
|
6
12
|
def setup
|
@@ -16,9 +22,9 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
16
22
|
util_setup_spec_fetcher @a2, @a2_pre
|
17
23
|
|
18
24
|
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
19
|
-
read_binary(
|
25
|
+
read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
|
20
26
|
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
21
|
-
read_binary(
|
27
|
+
read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
|
22
28
|
|
23
29
|
@cmd.options[:args] = [@a2.name]
|
24
30
|
|
@@ -38,11 +44,12 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
38
44
|
util_setup_spec_fetcher @a2, @a2_pre
|
39
45
|
|
40
46
|
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
41
|
-
read_binary(
|
47
|
+
read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
|
42
48
|
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
43
|
-
read_binary(
|
49
|
+
read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
|
44
50
|
|
45
|
-
@cmd.handle_options [@a2_pre.name, '--version', @a2_pre.version.to_s
|
51
|
+
@cmd.handle_options [@a2_pre.name, '--version', @a2_pre.version.to_s,
|
52
|
+
"--no-ri", "--no-rdoc"]
|
46
53
|
assert @cmd.options[:prerelease]
|
47
54
|
assert @cmd.options[:version].satisfied_by?(@a2_pre.version)
|
48
55
|
|
@@ -79,8 +86,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
79
86
|
util_setup_fake_fetcher
|
80
87
|
@cmd.options[:domain] = :local
|
81
88
|
|
82
|
-
FileUtils.mv
|
83
|
-
File.join(@tempdir)
|
89
|
+
FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
|
84
90
|
|
85
91
|
@cmd.options[:args] = [@a2.name]
|
86
92
|
|
@@ -109,8 +115,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
109
115
|
util_setup_fake_fetcher
|
110
116
|
@cmd.options[:user_install] = false
|
111
117
|
|
112
|
-
FileUtils.mv
|
113
|
-
File.join(@tempdir)
|
118
|
+
FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
|
114
119
|
|
115
120
|
@cmd.options[:args] = [@a2.name]
|
116
121
|
|
@@ -177,7 +182,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
177
182
|
correctly_spelled = "non_existent_with_hint"
|
178
183
|
|
179
184
|
util_setup_fake_fetcher
|
180
|
-
util_setup_spec_fetcher
|
185
|
+
util_setup_spec_fetcher quick_spec(correctly_spelled, '2')
|
181
186
|
|
182
187
|
@cmd.options[:args] = [misspelled]
|
183
188
|
|
@@ -201,9 +206,9 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
201
206
|
util_setup_spec_fetcher @a2, @a2_pre
|
202
207
|
|
203
208
|
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
204
|
-
read_binary(
|
209
|
+
read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
|
205
210
|
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
206
|
-
read_binary(
|
211
|
+
read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
|
207
212
|
|
208
213
|
@cmd.options[:prerelease] = true
|
209
214
|
@cmd.options[:args] = [@a2_pre.name]
|
@@ -227,7 +232,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
227
232
|
util_setup_spec_fetcher @a2
|
228
233
|
|
229
234
|
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
230
|
-
read_binary(
|
235
|
+
read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
|
231
236
|
|
232
237
|
@cmd.options[:args] = [@a2.name]
|
233
238
|
|
@@ -254,11 +259,9 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
254
259
|
util_setup_fake_fetcher
|
255
260
|
@cmd.options[:domain] = :local
|
256
261
|
|
257
|
-
FileUtils.mv
|
258
|
-
File.join(@tempdir)
|
262
|
+
FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
|
259
263
|
|
260
|
-
FileUtils.mv
|
261
|
-
File.join(@tempdir)
|
264
|
+
FileUtils.mv Gem.cache_gem(@b2.file_name, @gemhome), @tempdir
|
262
265
|
|
263
266
|
@cmd.options[:args] = [@a2.name, @b2.name]
|
264
267
|
|
@@ -287,7 +290,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
287
290
|
util_setup_spec_fetcher @b2
|
288
291
|
|
289
292
|
@fetcher.data["#{@gem_repo}gems/#{@b2.file_name}"] =
|
290
|
-
read_binary(
|
293
|
+
read_binary(Gem.cache_gem(@b2.file_name, @gemhome))
|
291
294
|
|
292
295
|
uninstall_gem(@b2)
|
293
296
|
|
@@ -45,7 +45,7 @@ gem 'a', '= 1'
|
|
45
45
|
expected = <<-EXPECTED
|
46
46
|
require 'rubygems'
|
47
47
|
gem 'd', '= 1'
|
48
|
-
# Unable to satisfy 'z (>= 0
|
48
|
+
# Unable to satisfy 'z (>= 0)' from currently installed gems
|
49
49
|
EXPECTED
|
50
50
|
|
51
51
|
assert_equal expected, @ui.output
|
@@ -16,14 +16,11 @@ class TestGemCommandsOutdatedCommand < Gem::TestCase
|
|
16
16
|
def test_execute
|
17
17
|
quick_gem 'foo', '0.1'
|
18
18
|
quick_gem 'foo', '0.2'
|
19
|
-
remote_10 =
|
20
|
-
remote_20 =
|
19
|
+
remote_10 = quick_spec 'foo', '1.0'
|
20
|
+
remote_20 = quick_spec 'foo', '2.0'
|
21
21
|
|
22
22
|
remote_spec_file = File.join @gemhome, 'specifications', remote_10.spec_name
|
23
|
-
FileUtils.rm remote_spec_file
|
24
|
-
|
25
23
|
remote_spec_file = File.join @gemhome, 'specifications', remote_20.spec_name
|
26
|
-
FileUtils.rm remote_spec_file
|
27
24
|
|
28
25
|
@fetcher = Gem::FakeFetcher.new
|
29
26
|
Gem::RemoteFetcher.fetcher = @fetcher
|
@@ -47,6 +47,20 @@ EOF
|
|
47
47
|
assert_match response, @ui.output
|
48
48
|
end
|
49
49
|
|
50
|
+
def test_show_owners_key
|
51
|
+
response = "- email: user1@example.com\n"
|
52
|
+
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
|
53
|
+
File.open Gem.configuration.credentials_path, 'a' do |f|
|
54
|
+
f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
|
55
|
+
end
|
56
|
+
Gem.configuration.load_api_keys
|
57
|
+
|
58
|
+
@cmd.handle_options %w(-k other)
|
59
|
+
@cmd.show_owners('freewill')
|
60
|
+
|
61
|
+
assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
|
62
|
+
end
|
63
|
+
|
50
64
|
def test_add_owners
|
51
65
|
response = "Owner added successfully."
|
52
66
|
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
|
@@ -75,6 +89,20 @@ EOF
|
|
75
89
|
assert_match response, @ui.output
|
76
90
|
end
|
77
91
|
|
92
|
+
def test_add_owners_key
|
93
|
+
response = "Owner added successfully."
|
94
|
+
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
|
95
|
+
File.open Gem.configuration.credentials_path, 'a' do |f|
|
96
|
+
f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
|
97
|
+
end
|
98
|
+
Gem.configuration.load_api_keys
|
99
|
+
|
100
|
+
@cmd.handle_options %w(-k other)
|
101
|
+
@cmd.add_owners('freewill', ['user-new1@example.com'])
|
102
|
+
|
103
|
+
assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
|
104
|
+
end
|
105
|
+
|
78
106
|
def test_remove_owners
|
79
107
|
response = "Owner removed successfully."
|
80
108
|
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
|
@@ -102,4 +130,18 @@ EOF
|
|
102
130
|
|
103
131
|
assert_match response, @ui.output
|
104
132
|
end
|
133
|
+
|
134
|
+
def test_remove_owners_key
|
135
|
+
response = "Owner removed successfully."
|
136
|
+
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
|
137
|
+
File.open Gem.configuration.credentials_path, 'a' do |f|
|
138
|
+
f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
|
139
|
+
end
|
140
|
+
Gem.configuration.load_api_keys
|
141
|
+
|
142
|
+
@cmd.handle_options %w(-k other)
|
143
|
+
@cmd.remove_owners('freewill', ['user-remove1@example.com'])
|
144
|
+
|
145
|
+
assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
|
146
|
+
end
|
105
147
|
end
|
@@ -9,7 +9,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_execute
|
12
|
-
a =
|
12
|
+
a = quick_spec 'a' do |s| s.executables = %w[foo] end
|
13
13
|
FileUtils.mkdir_p File.join(@tempdir, 'bin')
|
14
14
|
File.open File.join(@tempdir, 'bin', 'foo'), 'w' do |fp|
|
15
15
|
fp.puts "#!/usr/bin/ruby"
|
@@ -39,7 +39,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_execute_all
|
42
|
-
a =
|
42
|
+
a = quick_spec 'a' do |s| s.executables = %w[foo] end
|
43
43
|
FileUtils.mkdir_p File.join(@tempdir, 'bin')
|
44
44
|
File.open File.join(@tempdir, 'bin', 'foo'), 'w' do |fp|
|
45
45
|
fp.puts "#!/usr/bin/ruby"
|
@@ -67,15 +67,29 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_execute_missing_cache_gem
|
70
|
-
a =
|
70
|
+
a = quick_spec 'a' do |s|
|
71
|
+
s.executables = %w[foo]
|
72
|
+
end
|
73
|
+
|
71
74
|
FileUtils.mkdir_p File.join(@tempdir, 'bin')
|
75
|
+
|
72
76
|
File.open File.join(@tempdir, 'bin', 'foo'), 'w' do |fp|
|
73
77
|
fp.puts "#!/usr/bin/ruby"
|
74
78
|
end
|
75
79
|
|
76
80
|
install_gem a
|
77
81
|
|
78
|
-
|
82
|
+
a_data = nil
|
83
|
+
open File.join(@gemhome, 'cache', a.file_name), 'rb' do |fp|
|
84
|
+
a_data = fp.read
|
85
|
+
end
|
86
|
+
|
87
|
+
util_setup_fake_fetcher
|
88
|
+
util_setup_spec_fetcher a
|
89
|
+
|
90
|
+
Gem::RemoteFetcher.fetcher.data["http://gems.example.com/gems/#{a.file_name}"] = a_data
|
91
|
+
|
92
|
+
FileUtils.rm Gem.cache_gem(a.file_name, @gemhome)
|
79
93
|
|
80
94
|
@cmd.options[:args] = %w[a]
|
81
95
|
|
@@ -85,11 +99,17 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
85
99
|
|
86
100
|
out = @ui.output.split "\n"
|
87
101
|
|
88
|
-
|
89
|
-
|
102
|
+
[
|
103
|
+
"Restoring gem\(s\) to pristine condition...",
|
104
|
+
"Restored a-1",
|
105
|
+
"Cached gem for a-2 not found, attempting to fetch...",
|
106
|
+
"Restored a-2",
|
107
|
+
"Restored a-3.a"
|
108
|
+
].each do |line|
|
109
|
+
assert_equal line, out.shift
|
110
|
+
end
|
90
111
|
|
91
|
-
|
92
|
-
@ui.error
|
112
|
+
assert_empty out, out.inspect
|
93
113
|
end
|
94
114
|
|
95
115
|
def test_execute_no_gem
|
@@ -1,16 +1,28 @@
|
|
1
1
|
require 'rubygems/test_case'
|
2
2
|
require 'rubygems/commands/push_command'
|
3
3
|
|
4
|
+
module Gem
|
5
|
+
class << self; remove_method :latest_rubygems_version; end
|
6
|
+
|
7
|
+
def self.latest_rubygems_version
|
8
|
+
Gem::Version.new Gem::VERSION
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
4
12
|
class TestGemCommandsPushCommand < Gem::TestCase
|
5
13
|
|
6
14
|
def setup
|
7
15
|
super
|
8
16
|
|
9
|
-
@gems_dir
|
10
|
-
@cache_dir =
|
17
|
+
@gems_dir = File.join @tempdir, 'gems'
|
18
|
+
@cache_dir = Gem.cache_dir @gemhome
|
19
|
+
|
11
20
|
FileUtils.mkdir @gems_dir
|
12
|
-
|
13
|
-
|
21
|
+
|
22
|
+
Gem.configuration.rubygems_api_key =
|
23
|
+
"ed244fbf2b1a52e012da8616c512fa47f9aa5250"
|
24
|
+
|
25
|
+
@spec, @path = util_gem "freewill", "1.0.0"
|
14
26
|
|
15
27
|
@fetcher = Gem::FakeFetcher.new
|
16
28
|
Gem::RemoteFetcher.fetcher = @fetcher
|
@@ -77,5 +89,19 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
77
89
|
assert_match response, @ui.output
|
78
90
|
end
|
79
91
|
|
80
|
-
|
92
|
+
def test_sending_gem_key
|
93
|
+
@response = "Successfully registered gem: freewill (1.0.0)"
|
94
|
+
@fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, "OK"]
|
95
|
+
File.open Gem.configuration.credentials_path, 'a' do |f|
|
96
|
+
f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
|
97
|
+
end
|
98
|
+
Gem.configuration.load_api_keys
|
99
|
+
|
100
|
+
@cmd.handle_options %w(-k other)
|
101
|
+
@cmd.send_gem(@path)
|
81
102
|
|
103
|
+
assert_equal Gem.configuration.api_keys[:other],
|
104
|
+
@fetcher.last_request["Authorization"]
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|