rubygems-update 3.0.4 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/History.txt +85 -0
- data/Manifest.txt +5 -3
- data/Rakefile +8 -6
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/lib/rubygems.rb +6 -12
- data/lib/rubygems/commands/push_command.rb +2 -0
- data/lib/rubygems/commands/setup_command.rb +9 -11
- data/lib/rubygems/commands/uninstall_command.rb +16 -6
- data/lib/rubygems/commands/which_command.rb +1 -3
- data/lib/rubygems/defaults.rb +1 -8
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +1 -2
- data/lib/rubygems/exceptions.rb +0 -4
- data/lib/rubygems/gemcutter_utilities.rb +9 -5
- data/lib/rubygems/installer.rb +8 -5
- data/lib/rubygems/installer_test_case.rb +2 -2
- data/lib/rubygems/package/tar_header.rb +11 -2
- data/lib/rubygems/remote_fetcher.rb +15 -54
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +3 -5
- data/lib/rubygems/resolver.rb +4 -1
- data/lib/rubygems/s3_uri_signer.rb +183 -0
- data/lib/rubygems/security_option.rb +0 -1
- data/lib/rubygems/specification.rb +13 -14
- data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +1 -2
- data/lib/rubygems/test_case.rb +8 -4
- data/lib/rubygems/util.rb +12 -0
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/test_bundled_ca.rb +7 -4
- data/test/rubygems/test_gem.rb +40 -3
- data/test/rubygems/test_gem_commands_push_command.rb +15 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +11 -7
- data/test/rubygems/test_gem_commands_uninstall_command.rb +80 -1
- data/test/rubygems/test_gem_indexer.rb +8 -8
- data/test/rubygems/test_gem_installer.rb +78 -19
- data/test/rubygems/test_gem_package_tar_header.rb +41 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +133 -14
- data/test/rubygems/test_gem_request.rb +4 -4
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +20 -30
- data/test/rubygems/test_gem_specification.rb +29 -0
- data/test/rubygems/test_gem_util.rb +8 -0
- data/util/cops/deprecations.rb +52 -0
- data/util/create_certs.sh +27 -0
- data/util/update_bundled_ca_certificates.rb +1 -3
- metadata +12 -9
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -2284,7 +2284,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2284
2284
|
|
2285
2285
|
e = Gem::LoadError.new msg
|
2286
2286
|
e.name = self.name
|
2287
|
-
# TODO: e.requirement = dep.requirement
|
2288
2287
|
|
2289
2288
|
raise e
|
2290
2289
|
end
|
@@ -2349,18 +2348,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2349
2348
|
|
2350
2349
|
def ruby_code(obj)
|
2351
2350
|
case obj
|
2352
|
-
when String
|
2353
|
-
when Array
|
2354
|
-
when Hash
|
2351
|
+
when String then obj.dump + ".freeze"
|
2352
|
+
when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
|
2353
|
+
when Hash then
|
2355
2354
|
seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
|
2356
2355
|
"{ #{seg.join(', ')} }"
|
2357
|
-
when Gem::Version
|
2358
|
-
when DateLike
|
2359
|
-
when Time
|
2360
|
-
when Numeric
|
2361
|
-
when true, false, nil
|
2362
|
-
when Gem::Platform
|
2363
|
-
when Gem::Requirement
|
2356
|
+
when Gem::Version then obj.to_s.dump
|
2357
|
+
when DateLike then obj.strftime('%Y-%m-%d').dump
|
2358
|
+
when Time then obj.strftime('%Y-%m-%d').dump
|
2359
|
+
when Numeric then obj.inspect
|
2360
|
+
when true, false, nil then obj.inspect
|
2361
|
+
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
|
2362
|
+
when Gem::Requirement then
|
2364
2363
|
list = obj.as_list
|
2365
2364
|
"Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
|
2366
2365
|
else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
|
@@ -2479,6 +2478,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2479
2478
|
# still have their default values are omitted.
|
2480
2479
|
|
2481
2480
|
def to_ruby
|
2481
|
+
require 'openssl'
|
2482
2482
|
mark_version
|
2483
2483
|
result = []
|
2484
2484
|
result << "# -*- encoding: utf-8 -*-"
|
@@ -2517,9 +2517,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2517
2517
|
@@attributes.each do |attr_name|
|
2518
2518
|
next if handled.include? attr_name
|
2519
2519
|
current_value = self.send(attr_name)
|
2520
|
-
if current_value != default_value(attr_name)
|
2521
|
-
|
2522
|
-
result << " s.#{attr_name} = #{ruby_code current_value}"
|
2520
|
+
if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
|
2521
|
+
result << " s.#{attr_name} = #{ruby_code current_value}" unless current_value.is_a?(OpenSSL::PKey::RSA)
|
2523
2522
|
end
|
2524
2523
|
end
|
2525
2524
|
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G
|
3
|
+
A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp
|
4
|
+
Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4
|
5
|
+
MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG
|
6
|
+
A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
|
7
|
+
hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8
|
8
|
+
RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT
|
9
|
+
gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm
|
10
|
+
KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd
|
11
|
+
QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ
|
12
|
+
XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw
|
13
|
+
DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o
|
14
|
+
LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU
|
15
|
+
RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp
|
16
|
+
jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK
|
17
|
+
6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX
|
18
|
+
mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
|
19
|
+
Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
|
20
|
+
WD9f
|
21
|
+
-----END CERTIFICATE-----
|
@@ -110,8 +110,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
110
110
|
begin
|
111
111
|
saved_lineno = $.
|
112
112
|
|
113
|
-
|
114
|
-
open loaded_from, OPEN_MODE do |file|
|
113
|
+
File.open loaded_from, OPEN_MODE do |file|
|
115
114
|
begin
|
116
115
|
file.readline # discard encoding line
|
117
116
|
stubline = file.readline.chomp
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -140,6 +140,12 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
140
140
|
assert File.exist?(path), msg
|
141
141
|
end
|
142
142
|
|
143
|
+
def assert_directory_exists(path, msg = nil)
|
144
|
+
msg = message(msg) { "Expected path '#{path}' to be a directory" }
|
145
|
+
assert_path_exists path
|
146
|
+
assert File.directory?(path), msg
|
147
|
+
end
|
148
|
+
|
143
149
|
##
|
144
150
|
# Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
|
145
151
|
# the original value when the block ends
|
@@ -256,6 +262,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
256
262
|
@orig_gem_env_requirements = ENV.to_hash
|
257
263
|
|
258
264
|
ENV['GEM_VENDOR'] = nil
|
265
|
+
ENV['GEMRC'] = nil
|
259
266
|
ENV['SOURCE_DATE_EPOCH'] = nil
|
260
267
|
|
261
268
|
@current_dir = Dir.pwd
|
@@ -746,7 +753,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
746
753
|
# Removes all installed gems from +@gemhome+.
|
747
754
|
|
748
755
|
def util_clear_gems
|
749
|
-
FileUtils.rm_rf File.join(@gemhome, "gems")
|
756
|
+
FileUtils.rm_rf File.join(@gemhome, "gems")
|
750
757
|
FileUtils.mkdir File.join(@gemhome, "gems")
|
751
758
|
FileUtils.rm_rf File.join(@gemhome, "specifications")
|
752
759
|
FileUtils.mkdir File.join(@gemhome, "specifications")
|
@@ -931,9 +938,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
|
|
931
938
|
# location are returned.
|
932
939
|
|
933
940
|
def util_gem(name, version, deps = nil, &block)
|
934
|
-
# TODO: deprecate
|
935
|
-
raise "deps or block, not both" if deps and block
|
936
|
-
|
937
941
|
if deps
|
938
942
|
block = proc do |s|
|
939
943
|
# Since Hash#each is unordered in 1.8, sort
|
data/lib/rubygems/util.rb
CHANGED
@@ -128,4 +128,16 @@ module Gem::Util
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
+
##
|
132
|
+
# Corrects +path+ (usually returned by `URI.parse().path` on Windows), that
|
133
|
+
# comes with a leading slash.
|
134
|
+
|
135
|
+
def self.correct_for_windows_path(path)
|
136
|
+
if path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
|
137
|
+
path[1..-1]
|
138
|
+
else
|
139
|
+
path
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
131
143
|
end
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.0.
|
5
|
+
s.version = "3.0.9"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
@@ -51,13 +51,16 @@ if ENV["CI"] || ENV["TEST_SSL"]
|
|
51
51
|
assert_https('rubygems.org')
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
assert_https('rubygems.
|
54
|
+
def test_accessing_www_rubygems
|
55
|
+
assert_https('www.rubygems.org')
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
assert_https('
|
58
|
+
def test_accessing_staging
|
59
|
+
assert_https('staging.rubygems.org')
|
60
60
|
end
|
61
61
|
|
62
|
+
def test_accessing_new_index
|
63
|
+
assert_https('index.rubygems.org')
|
64
|
+
end
|
62
65
|
end
|
63
66
|
end
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -156,7 +156,7 @@ class TestGem < Gem::TestCase
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def assert_self_install_permissions
|
159
|
-
mask =
|
159
|
+
mask = win_platform? ? 0700 : 0777
|
160
160
|
options = {
|
161
161
|
:dir_mode => 0500,
|
162
162
|
:prog_mode => 0510,
|
@@ -195,6 +195,9 @@ class TestGem < Gem::TestCase
|
|
195
195
|
'gems/foo-1/bin/foo.cmd' => prog_mode,
|
196
196
|
'gems/foo-1/data/foo.txt' => data_mode,
|
197
197
|
}
|
198
|
+
# below is for intermittent errors on Appveyor & Travis 2019-01,
|
199
|
+
# see https://github.com/rubygems/rubygems/pull/2568
|
200
|
+
sleep 0.2
|
198
201
|
result = {}
|
199
202
|
Dir.chdir @gemhome do
|
200
203
|
expected.each_key do |n|
|
@@ -320,6 +323,40 @@ class TestGem < Gem::TestCase
|
|
320
323
|
refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
|
321
324
|
end
|
322
325
|
|
326
|
+
def test_activate_bin_path_respects_underscore_selection_if_given
|
327
|
+
bundler_latest = util_spec 'bundler', '2.0.1' do |s|
|
328
|
+
s.executables = ['bundle']
|
329
|
+
end
|
330
|
+
|
331
|
+
bundler_previous = util_spec 'bundler', '1.17.3' do |s|
|
332
|
+
s.executables = ['bundle']
|
333
|
+
end
|
334
|
+
|
335
|
+
install_specs bundler_latest, bundler_previous
|
336
|
+
|
337
|
+
File.open("Gemfile.lock", "w") do |f|
|
338
|
+
f.write <<-L.gsub(/ {8}/, "")
|
339
|
+
GEM
|
340
|
+
remote: https://rubygems.org/
|
341
|
+
specs:
|
342
|
+
|
343
|
+
PLATFORMS
|
344
|
+
ruby
|
345
|
+
|
346
|
+
DEPENDENCIES
|
347
|
+
|
348
|
+
BUNDLED WITH
|
349
|
+
2.0.1
|
350
|
+
L
|
351
|
+
end
|
352
|
+
|
353
|
+
File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') }
|
354
|
+
|
355
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
|
356
|
+
|
357
|
+
assert_equal %w(bundler-1.17.3), loaded_spec_names
|
358
|
+
end
|
359
|
+
|
323
360
|
def test_self_bin_path_no_exec_name
|
324
361
|
e = assert_raises ArgumentError do
|
325
362
|
Gem.bin_path 'a'
|
@@ -541,7 +578,7 @@ class TestGem < Gem::TestCase
|
|
541
578
|
|
542
579
|
Gem.ensure_gem_subdirectories @gemhome, 0750
|
543
580
|
|
544
|
-
|
581
|
+
assert_directory_exists File.join(@gemhome, "cache")
|
545
582
|
|
546
583
|
assert_equal 0750, File::Stat.new(@gemhome).mode & 0777
|
547
584
|
assert_equal 0750, File::Stat.new(File.join(@gemhome, "cache")).mode & 0777
|
@@ -570,7 +607,7 @@ class TestGem < Gem::TestCase
|
|
570
607
|
|
571
608
|
Gem.ensure_gem_subdirectories gemdir
|
572
609
|
|
573
|
-
|
610
|
+
assert_directory_exists util_cache_dir
|
574
611
|
end
|
575
612
|
|
576
613
|
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
@@ -199,6 +199,21 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
199
199
|
send_battery
|
200
200
|
end
|
201
201
|
|
202
|
+
def test_sending_gem_with_env_var_api_key
|
203
|
+
@host = "http://privategemserver.example"
|
204
|
+
|
205
|
+
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
|
206
|
+
spec.metadata['allowed_push_host'] = @host
|
207
|
+
end
|
208
|
+
|
209
|
+
@api_key = "PRIVKEY"
|
210
|
+
ENV["GEM_HOST_API_KEY"] = "PRIVKEY"
|
211
|
+
|
212
|
+
@response = "Successfully registered gem: freebird (1.0.1)"
|
213
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
|
214
|
+
send_battery
|
215
|
+
end
|
216
|
+
|
202
217
|
def test_sending_gem_to_allowed_push_host_with_basic_credentials
|
203
218
|
@sanitized_host = "http://privategemserver.example"
|
204
219
|
@host = "http://user:password@privategemserver.example"
|
@@ -38,6 +38,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
38
38
|
FileUtils.mkdir_p 'default/gems'
|
39
39
|
|
40
40
|
gemspec = Gem::Specification.new
|
41
|
+
gemspec.author = "Us"
|
41
42
|
gemspec.name = "bundler"
|
42
43
|
gemspec.version = BUNDLER_VERS
|
43
44
|
gemspec.bindir = "exe"
|
@@ -166,16 +167,19 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
166
167
|
def test_install_default_bundler_gem
|
167
168
|
@cmd.extend FileUtils
|
168
169
|
|
169
|
-
@
|
170
|
+
bin_dir = File.join(@gemhome, 'bin')
|
171
|
+
@cmd.install_default_bundler_gem bin_dir
|
170
172
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
spec = Gem::Specification.load(default_spec_path)
|
173
|
+
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
|
174
|
+
default_spec_path = File.join(Gem::Specification.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
|
175
|
+
spec = Gem::Specification.load(default_spec_path)
|
175
176
|
|
176
|
-
|
177
|
-
|
177
|
+
spec.executables.each do |e|
|
178
|
+
if Gem.win_platform?
|
179
|
+
assert_path_exists File.join(bin_dir, "#{e}.bat")
|
178
180
|
end
|
181
|
+
|
182
|
+
assert_path_exists File.join bin_dir, e
|
179
183
|
end
|
180
184
|
|
181
185
|
default_dir = Gem::Specification.default_specifications_dir
|
@@ -192,6 +192,62 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
192
192
|
assert File.exist? File.join(@gemhome, 'bin', 'executable')
|
193
193
|
end
|
194
194
|
|
195
|
+
def test_uninstall_selection
|
196
|
+
ui = Gem::MockGemUi.new "1\n"
|
197
|
+
|
198
|
+
util_make_gems
|
199
|
+
|
200
|
+
list = Gem::Specification.find_all_by_name 'a'
|
201
|
+
|
202
|
+
@cmd.options[:args] = ['a']
|
203
|
+
|
204
|
+
use_ui ui do
|
205
|
+
@cmd.execute
|
206
|
+
end
|
207
|
+
|
208
|
+
updated_list = Gem::Specification.find_all_by_name('a')
|
209
|
+
assert_equal list.length - 1, updated_list.length
|
210
|
+
|
211
|
+
assert_match ' 1. a-1', ui.output
|
212
|
+
assert_match ' 2. a-2', ui.output
|
213
|
+
assert_match ' 3. a-3.a', ui.output
|
214
|
+
assert_match ' 4. All versions', ui.output
|
215
|
+
assert_match 'uninstalled a-1', ui.output
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_uninstall_selection_multiple_gems
|
219
|
+
ui = Gem::MockGemUi.new "1\n"
|
220
|
+
|
221
|
+
util_make_gems
|
222
|
+
|
223
|
+
a_list = Gem::Specification.find_all_by_name('a')
|
224
|
+
b_list = Gem::Specification.find_all_by_name('b')
|
225
|
+
list = a_list + b_list
|
226
|
+
|
227
|
+
@cmd.options[:args] = ['a', 'b']
|
228
|
+
|
229
|
+
use_ui ui do
|
230
|
+
@cmd.execute
|
231
|
+
end
|
232
|
+
|
233
|
+
updated_a_list = Gem::Specification.find_all_by_name('a')
|
234
|
+
updated_b_list = Gem::Specification.find_all_by_name('b')
|
235
|
+
updated_list = updated_a_list + updated_b_list
|
236
|
+
|
237
|
+
assert_equal list.length - 2, updated_list.length
|
238
|
+
|
239
|
+
out = ui.output.split("\n")
|
240
|
+
assert_match 'uninstalled b-2', out.shift
|
241
|
+
assert_match '', out.shift
|
242
|
+
assert_match 'Select gem to uninstall:', out.shift
|
243
|
+
assert_match ' 1. a-1', out.shift
|
244
|
+
assert_match ' 2. a-2', out.shift
|
245
|
+
assert_match ' 3. a-3.a', out.shift
|
246
|
+
assert_match ' 4. All versions', out.shift
|
247
|
+
assert_match 'uninstalled a-1', out.shift
|
248
|
+
assert_empty out
|
249
|
+
end
|
250
|
+
|
195
251
|
def test_execute_with_force_and_without_version_uninstalls_everything
|
196
252
|
ui = Gem::MockGemUi.new "y\n"
|
197
253
|
|
@@ -246,7 +302,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
246
302
|
gemhome2 = "#{@gemhome}2"
|
247
303
|
|
248
304
|
a_4, = util_gem 'a', 4
|
249
|
-
install_gem a_4
|
305
|
+
install_gem a_4
|
250
306
|
|
251
307
|
Gem::Specification.dirs = [@gemhome, gemhome2]
|
252
308
|
|
@@ -264,6 +320,29 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
264
320
|
assert_equal %w[default-1], Gem::Specification.all_names.sort
|
265
321
|
end
|
266
322
|
|
323
|
+
def test_execute_outside_gem_home
|
324
|
+
ui = Gem::MockGemUi.new "y\n"
|
325
|
+
|
326
|
+
gemhome2 = "#{@gemhome}2"
|
327
|
+
|
328
|
+
a_4, = util_gem 'a', 4
|
329
|
+
install_gem a_4 , :install_dir => gemhome2
|
330
|
+
|
331
|
+
Gem::Specification.dirs = [@gemhome, gemhome2]
|
332
|
+
|
333
|
+
assert_includes Gem::Specification.all_names, 'a-4'
|
334
|
+
|
335
|
+
@cmd.options[:args] = ['a:4']
|
336
|
+
|
337
|
+
e = assert_raises Gem::InstallError do
|
338
|
+
use_ui ui do
|
339
|
+
@cmd.execute
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
assert_includes e.message, "a is not installed in GEM_HOME"
|
344
|
+
end
|
345
|
+
|
267
346
|
def test_handle_options
|
268
347
|
@cmd.handle_options %w[]
|
269
348
|
|
@@ -103,8 +103,8 @@ class TestGemIndexer < Gem::TestCase
|
|
103
103
|
quickdir = File.join @tempdir, 'quick'
|
104
104
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
105
105
|
|
106
|
-
|
107
|
-
|
106
|
+
assert_directory_exists quickdir
|
107
|
+
assert_directory_exists marshal_quickdir
|
108
108
|
|
109
109
|
assert_indexed marshal_quickdir, "#{File.basename(@a1.spec_file)}.rz"
|
110
110
|
assert_indexed marshal_quickdir, "#{File.basename(@a2.spec_file)}.rz"
|
@@ -133,8 +133,8 @@ class TestGemIndexer < Gem::TestCase
|
|
133
133
|
quickdir = File.join @tempdir, 'quick'
|
134
134
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
135
135
|
|
136
|
-
|
137
|
-
|
136
|
+
assert_directory_exists quickdir, 'quickdir should be directory'
|
137
|
+
assert_directory_exists marshal_quickdir
|
138
138
|
|
139
139
|
refute_indexed quickdir, "index"
|
140
140
|
refute_indexed quickdir, "index.rz"
|
@@ -179,8 +179,8 @@ class TestGemIndexer < Gem::TestCase
|
|
179
179
|
quickdir = File.join @tempdir, 'quick'
|
180
180
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
181
181
|
|
182
|
-
|
183
|
-
|
182
|
+
assert_directory_exists quickdir
|
183
|
+
assert_directory_exists marshal_quickdir
|
184
184
|
|
185
185
|
assert_indexed marshal_quickdir, "#{File.basename(@a1.spec_file)}.rz"
|
186
186
|
assert_indexed marshal_quickdir, "#{File.basename(@a2.spec_file)}.rz"
|
@@ -315,8 +315,8 @@ class TestGemIndexer < Gem::TestCase
|
|
315
315
|
quickdir = File.join @tempdir, 'quick'
|
316
316
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
317
317
|
|
318
|
-
|
319
|
-
|
318
|
+
assert_directory_exists quickdir
|
319
|
+
assert_directory_exists marshal_quickdir
|
320
320
|
|
321
321
|
@d2_1 = util_spec 'd', '2.1'
|
322
322
|
util_build_gem @d2_1
|