rubygems-update 2.4.4 → 2.4.5
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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.rdoc +58 -0
- data/History.txt +42 -0
- data/Manifest.txt +1 -1
- data/lib/rubygems.rb +8 -2
- data/lib/rubygems/basic_specification.rb +52 -22
- data/lib/rubygems/commands/contents_command.rb +0 -1
- data/lib/rubygems/commands/pristine_command.rb +15 -1
- data/lib/rubygems/commands/uninstall_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +0 -2
- data/lib/rubygems/core_ext/kernel_gem.rb +8 -1
- data/lib/rubygems/core_ext/kernel_require.rb +1 -1
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_list.rb +1 -5
- data/lib/rubygems/ext/ext_conf_builder.rb +1 -1
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/installer.rb +2 -2
- data/lib/rubygems/package/old.rb +2 -2
- data/lib/rubygems/package/tar_writer.rb +9 -3
- data/lib/rubygems/remote_fetcher.rb +5 -1
- data/lib/rubygems/request/connection_pools.rb +5 -1
- data/lib/rubygems/request/http_pool.rb +9 -0
- data/lib/rubygems/request_set.rb +1 -4
- data/lib/rubygems/request_set/lockfile.rb +21 -8
- data/lib/rubygems/resolver/api_set.rb +1 -1
- data/lib/rubygems/resolver/api_specification.rb +1 -1
- data/lib/rubygems/resolver/installer_set.rb +1 -1
- data/lib/rubygems/source.rb +6 -2
- data/lib/rubygems/specification.rb +10 -2
- data/lib/rubygems/stub_specification.rb +11 -5
- data/lib/rubygems/test_case.rb +31 -0
- data/lib/rubygems/text.rb +2 -2
- data/lib/rubygems/user_interaction.rb +0 -1
- data/test/rubygems/test_gem.rb +15 -32
- data/test/rubygems/test_gem_commands_pristine_command.rb +92 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +10 -6
- data/test/rubygems/test_gem_remote_fetcher.rb +25 -1
- data/test/rubygems/test_gem_request_set_lockfile.rb +28 -0
- data/test/rubygems/test_gem_resolver_api_specification.rb +2 -2
- data/test/rubygems/test_gem_resolver_installer_set.rb +14 -0
- data/test/rubygems/test_gem_source.rb +14 -0
- data/test/rubygems/test_gem_specification.rb +50 -1
- data/test/rubygems/test_gem_stub_specification.rb +9 -1
- data/test/rubygems/test_gem_text.rb +16 -0
- data/test/rubygems/test_kernel.rb +24 -0
- metadata +4 -3
- data/CONTRIBUTING +0 -32
@@ -23,6 +23,15 @@ class Gem::Request::HTTPPool # :nodoc:
|
|
23
23
|
@queue.push connection
|
24
24
|
end
|
25
25
|
|
26
|
+
def close_all
|
27
|
+
until @queue.empty?
|
28
|
+
if connection = @queue.pop(true) and connection.started?
|
29
|
+
connection.finish
|
30
|
+
end
|
31
|
+
end
|
32
|
+
@queue.push(nil)
|
33
|
+
end
|
34
|
+
|
26
35
|
private
|
27
36
|
|
28
37
|
def make_connection
|
data/lib/rubygems/request_set.rb
CHANGED
@@ -200,6 +200,8 @@ class Gem::RequestSet::Lockfile
|
|
200
200
|
|
201
201
|
platforms = @requests.map { |request| request.spec.platform }.uniq
|
202
202
|
|
203
|
+
platforms = platforms.sort_by { |platform| platform.to_s }
|
204
|
+
|
203
205
|
platforms.sort.each do |platform|
|
204
206
|
out << " #{platform}"
|
205
207
|
end
|
@@ -277,14 +279,7 @@ class Gem::RequestSet::Lockfile
|
|
277
279
|
when :bang then
|
278
280
|
get :bang
|
279
281
|
|
280
|
-
|
281
|
-
Gem::Resolver::GitSet === set or
|
282
|
-
Gem::Resolver::VendorSet === set
|
283
|
-
}.map { |set|
|
284
|
-
set.specs[name]
|
285
|
-
}.compact.first
|
286
|
-
|
287
|
-
requirements << spec.version
|
282
|
+
requirements << pinned_requirement(name)
|
288
283
|
when :l_paren then
|
289
284
|
get :l_paren
|
290
285
|
|
@@ -300,6 +295,13 @@ class Gem::RequestSet::Lockfile
|
|
300
295
|
end
|
301
296
|
|
302
297
|
get :r_paren
|
298
|
+
|
299
|
+
if peek[0] == :bang then
|
300
|
+
requirements.clear
|
301
|
+
requirements << pinned_requirement(name)
|
302
|
+
|
303
|
+
get :bang
|
304
|
+
end
|
303
305
|
end
|
304
306
|
|
305
307
|
@set.gem name, *requirements
|
@@ -507,6 +509,17 @@ class Gem::RequestSet::Lockfile
|
|
507
509
|
@tokens.first || [:EOF]
|
508
510
|
end
|
509
511
|
|
512
|
+
def pinned_requirement name # :nodoc:
|
513
|
+
spec = @set.sets.select { |set|
|
514
|
+
Gem::Resolver::GitSet === set or
|
515
|
+
Gem::Resolver::VendorSet === set
|
516
|
+
}.map { |set|
|
517
|
+
set.specs[name]
|
518
|
+
}.compact.first
|
519
|
+
|
520
|
+
spec.version
|
521
|
+
end
|
522
|
+
|
510
523
|
def skip type # :nodoc:
|
511
524
|
get while not @tokens.empty? and peek.first == type
|
512
525
|
end
|
@@ -19,7 +19,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
|
|
19
19
|
@set = set
|
20
20
|
@name = api_data[:name]
|
21
21
|
@version = Gem::Version.new api_data[:number]
|
22
|
-
@platform = api_data[:platform]
|
22
|
+
@platform = Gem::Platform.new api_data[:platform]
|
23
23
|
@dependencies = api_data[:dependencies].map do |name, ver|
|
24
24
|
Gem::Dependency.new name, ver.split(/\s*,\s*/)
|
25
25
|
end
|
data/lib/rubygems/source.rb
CHANGED
@@ -26,8 +26,12 @@ class Gem::Source
|
|
26
26
|
# Creates a new Source which will use the index located at +uri+.
|
27
27
|
|
28
28
|
def initialize(uri)
|
29
|
-
|
30
|
-
uri
|
29
|
+
begin
|
30
|
+
unless uri.kind_of? URI
|
31
|
+
uri = URI.parse(uri.to_s)
|
32
|
+
end
|
33
|
+
rescue URI::InvalidURIError
|
34
|
+
raise if Gem::Source == self.class
|
31
35
|
end
|
32
36
|
|
33
37
|
@uri = uri
|
@@ -709,8 +709,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
709
709
|
specs = {}
|
710
710
|
Gem.loaded_specs.each_value{|s| specs[s] = true}
|
711
711
|
@@all.each{|s| s.activated = true if specs[s]}
|
712
|
-
|
713
|
-
_resort!(@@all)
|
714
712
|
end
|
715
713
|
@@all
|
716
714
|
end
|
@@ -1478,6 +1476,16 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1478
1476
|
File.join build_info_dir, "#{full_name}.info"
|
1479
1477
|
end
|
1480
1478
|
|
1479
|
+
##
|
1480
|
+
# Used to detect if the gem is bundled in older version of Ruby, but not
|
1481
|
+
# detectable as default gem (see BasicSpecification#default_gem?).
|
1482
|
+
|
1483
|
+
def bundled_gem_in_old_ruby?
|
1484
|
+
!default_gem? &&
|
1485
|
+
RUBY_VERSION < "2.0.0" &&
|
1486
|
+
summary == "This #{name} is bundled with Ruby"
|
1487
|
+
end
|
1488
|
+
|
1481
1489
|
##
|
1482
1490
|
# Returns the full path to the cache directory containing this
|
1483
1491
|
# spec's cached gem.
|
@@ -42,6 +42,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
42
42
|
self.loaded_from = filename
|
43
43
|
@data = nil
|
44
44
|
@extensions = nil
|
45
|
+
@name = nil
|
45
46
|
@spec = nil
|
46
47
|
end
|
47
48
|
|
@@ -49,8 +50,11 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
49
50
|
# True when this gem has been activated
|
50
51
|
|
51
52
|
def activated?
|
52
|
-
|
53
|
-
|
53
|
+
@activated ||=
|
54
|
+
begin
|
55
|
+
loaded = Gem.loaded_specs[name]
|
56
|
+
loaded && loaded.version == version
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
def build_extensions # :nodoc:
|
@@ -154,9 +158,11 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
154
158
|
# The full Gem::Specification for this gem, loaded from evalling its gemspec
|
155
159
|
|
156
160
|
def to_spec
|
157
|
-
@spec ||=
|
158
|
-
|
159
|
-
|
161
|
+
@spec ||= if @data then
|
162
|
+
Gem.loaded_specs.values.find { |spec|
|
163
|
+
spec.name == name and spec.version == version
|
164
|
+
}
|
165
|
+
end
|
160
166
|
|
161
167
|
@spec ||= Gem::Specification.load(loaded_from)
|
162
168
|
@spec.ignored = @ignored if instance_variable_defined? :@ignored
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -1035,6 +1035,37 @@ Also, a list:
|
|
1035
1035
|
Zlib::Deflate.deflate data
|
1036
1036
|
end
|
1037
1037
|
|
1038
|
+
def util_set_RUBY_VERSION(version, patchlevel = nil, revision = nil)
|
1039
|
+
if Gem.instance_variables.include? :@ruby_version or
|
1040
|
+
Gem.instance_variables.include? '@ruby_version' then
|
1041
|
+
Gem.send :remove_instance_variable, :@ruby_version
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
@RUBY_VERSION = RUBY_VERSION
|
1045
|
+
@RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1046
|
+
@RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
|
1047
|
+
|
1048
|
+
Object.send :remove_const, :RUBY_VERSION
|
1049
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1050
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1051
|
+
|
1052
|
+
Object.const_set :RUBY_VERSION, version
|
1053
|
+
Object.const_set :RUBY_PATCHLEVEL, patchlevel if patchlevel
|
1054
|
+
Object.const_set :RUBY_REVISION, revision if revision
|
1055
|
+
end
|
1056
|
+
|
1057
|
+
def util_restore_RUBY_VERSION
|
1058
|
+
Object.send :remove_const, :RUBY_VERSION
|
1059
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1060
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1061
|
+
|
1062
|
+
Object.const_set :RUBY_VERSION, @RUBY_VERSION
|
1063
|
+
Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL if
|
1064
|
+
defined?(@RUBY_PATCHLEVEL)
|
1065
|
+
Object.const_set :RUBY_REVISION, @RUBY_REVISION if
|
1066
|
+
defined?(@RUBY_REVISION)
|
1067
|
+
end
|
1068
|
+
|
1038
1069
|
##
|
1039
1070
|
# Is this test being run on a Windows platform?
|
1040
1071
|
|
data/lib/rubygems/text.rb
CHANGED
data/test/rubygems/test_gem.rb
CHANGED
@@ -112,6 +112,20 @@ class TestGem < Gem::TestCase
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
def test_self_bin_path_active
|
116
|
+
a1 = util_spec 'a', '1' do |s|
|
117
|
+
s.executables = ['exec']
|
118
|
+
end
|
119
|
+
|
120
|
+
util_spec 'a', '2' do |s|
|
121
|
+
s.executables = ['exec']
|
122
|
+
end
|
123
|
+
|
124
|
+
a1.activate
|
125
|
+
|
126
|
+
assert_match 'a-1/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
|
127
|
+
end
|
128
|
+
|
115
129
|
def test_self_bin_path_no_exec_name
|
116
130
|
e = assert_raises ArgumentError do
|
117
131
|
Gem.bin_path 'a'
|
@@ -895,7 +909,7 @@ class TestGem < Gem::TestCase
|
|
895
909
|
end
|
896
910
|
|
897
911
|
expected = "Ignoring ext-1 because its extensions are not built. " +
|
898
|
-
"Try: gem pristine ext
|
912
|
+
"Try: gem pristine ext --version 1\n"
|
899
913
|
|
900
914
|
assert_equal expected, err
|
901
915
|
end
|
@@ -1551,37 +1565,6 @@ You may need to `gem install -g` to install missing gems
|
|
1551
1565
|
@abin_path = File.join spec.full_gem_path, spec.bindir, 'abin'
|
1552
1566
|
end
|
1553
1567
|
|
1554
|
-
def util_set_RUBY_VERSION(version, patchlevel = nil, revision = nil)
|
1555
|
-
if Gem.instance_variables.include? :@ruby_version or
|
1556
|
-
Gem.instance_variables.include? '@ruby_version' then
|
1557
|
-
Gem.send :remove_instance_variable, :@ruby_version
|
1558
|
-
end
|
1559
|
-
|
1560
|
-
@RUBY_VERSION = RUBY_VERSION
|
1561
|
-
@RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1562
|
-
@RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
|
1563
|
-
|
1564
|
-
Object.send :remove_const, :RUBY_VERSION
|
1565
|
-
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1566
|
-
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1567
|
-
|
1568
|
-
Object.const_set :RUBY_VERSION, version
|
1569
|
-
Object.const_set :RUBY_PATCHLEVEL, patchlevel if patchlevel
|
1570
|
-
Object.const_set :RUBY_REVISION, revision if revision
|
1571
|
-
end
|
1572
|
-
|
1573
|
-
def util_restore_RUBY_VERSION
|
1574
|
-
Object.send :remove_const, :RUBY_VERSION
|
1575
|
-
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
1576
|
-
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
1577
|
-
|
1578
|
-
Object.const_set :RUBY_VERSION, @RUBY_VERSION
|
1579
|
-
Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL if
|
1580
|
-
defined?(@RUBY_PATCHLEVEL)
|
1581
|
-
Object.const_set :RUBY_REVISION, @RUBY_REVISION if
|
1582
|
-
defined?(@RUBY_REVISION)
|
1583
|
-
end
|
1584
|
-
|
1585
1568
|
def util_remove_interrupt_command
|
1586
1569
|
Gem::Commands.send :remove_const, :InterruptCommand if
|
1587
1570
|
Gem::Commands.const_defined? :InterruptCommand
|
@@ -287,6 +287,57 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
287
287
|
assert_empty out, out.inspect
|
288
288
|
end
|
289
289
|
|
290
|
+
def test_execute_missing_cache_gem_when_multi_repo
|
291
|
+
specs = spec_fetcher do |fetcher|
|
292
|
+
fetcher.gem 'a', 1
|
293
|
+
fetcher.gem 'b', 1
|
294
|
+
end
|
295
|
+
|
296
|
+
FileUtils.rm_rf File.join(@gemhome, 'gems', 'a-1')
|
297
|
+
FileUtils.rm_rf File.join(@gemhome, 'gems', 'b-1')
|
298
|
+
|
299
|
+
install_gem specs["a-1"]
|
300
|
+
FileUtils.rm File.join(@gemhome, 'cache', 'a-1.gem')
|
301
|
+
|
302
|
+
Gem.clear_paths
|
303
|
+
gemhome2 = File.join(@tempdir, 'gemhome2')
|
304
|
+
Gem.paths = { "GEM_PATH" => [gemhome2, @gemhome], "GEM_HOME" => gemhome2 }
|
305
|
+
|
306
|
+
install_gem specs["b-1"]
|
307
|
+
FileUtils.rm File.join(gemhome2, 'cache', 'b-1.gem')
|
308
|
+
|
309
|
+
@cmd.options[:args] = %w[a b]
|
310
|
+
|
311
|
+
use_ui @ui do
|
312
|
+
@cmd.execute
|
313
|
+
end
|
314
|
+
|
315
|
+
out = @ui.output.split "\n"
|
316
|
+
|
317
|
+
[
|
318
|
+
"Restoring gems to pristine condition...",
|
319
|
+
"Cached gem for a-1 not found, attempting to fetch...",
|
320
|
+
"Restored a-1",
|
321
|
+
"Cached gem for b-1 not found, attempting to fetch...",
|
322
|
+
"Restored b-1",
|
323
|
+
].each do |line|
|
324
|
+
assert_equal line, out.shift
|
325
|
+
end
|
326
|
+
|
327
|
+
assert_empty out, out.inspect
|
328
|
+
assert_empty @ui.error
|
329
|
+
|
330
|
+
assert_path_exists File.join(@gemhome, "cache", 'a-1.gem')
|
331
|
+
refute_path_exists File.join(gemhome2, "cache", 'a-2.gem')
|
332
|
+
assert_path_exists File.join(@gemhome, "gems", 'a-1')
|
333
|
+
refute_path_exists File.join(gemhome2, "gems", 'a-1')
|
334
|
+
|
335
|
+
assert_path_exists File.join(gemhome2, "cache", 'b-1.gem')
|
336
|
+
refute_path_exists File.join(@gemhome, "cache", 'b-2.gem')
|
337
|
+
assert_path_exists File.join(gemhome2, "gems", 'b-1')
|
338
|
+
refute_path_exists File.join(@gemhome, "gems", 'b-1')
|
339
|
+
end
|
340
|
+
|
290
341
|
def test_execute_no_gem
|
291
342
|
@cmd.options[:args] = %w[]
|
292
343
|
|
@@ -329,6 +380,24 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
329
380
|
refute File.exist? gem_lib
|
330
381
|
end
|
331
382
|
|
383
|
+
def test_execute_unknown_gem_at_remote_source
|
384
|
+
util_spec 'a'
|
385
|
+
|
386
|
+
@cmd.options[:args] = %w[a]
|
387
|
+
|
388
|
+
use_ui @ui do
|
389
|
+
@cmd.execute
|
390
|
+
end
|
391
|
+
|
392
|
+
assert_equal([
|
393
|
+
"Restoring gems to pristine condition...",
|
394
|
+
"Cached gem for a-2 not found, attempting to fetch...",
|
395
|
+
"Skipped a-2, it was not found from cache and remote sources"
|
396
|
+
], @ui.output.split("\n"))
|
397
|
+
|
398
|
+
assert_empty @ui.error
|
399
|
+
end
|
400
|
+
|
332
401
|
def test_execute_default_gem
|
333
402
|
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
334
403
|
nil, "default/gem.rb")
|
@@ -348,6 +417,29 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
348
417
|
assert_empty(@ui.error)
|
349
418
|
end
|
350
419
|
|
420
|
+
def test_execute_bundled_gem_on_old_rubies
|
421
|
+
util_set_RUBY_VERSION '1.9.3', 551
|
422
|
+
|
423
|
+
util_spec 'bigdecimal', '1.1.0' do |s|
|
424
|
+
s.summary = "This bigdecimal is bundled with Ruby"
|
425
|
+
end
|
426
|
+
|
427
|
+
@cmd.options[:args] = %w[bigdecimal]
|
428
|
+
|
429
|
+
use_ui @ui do
|
430
|
+
@cmd.execute
|
431
|
+
end
|
432
|
+
|
433
|
+
assert_equal([
|
434
|
+
"Restoring gems to pristine condition...",
|
435
|
+
"Skipped bigdecimal-1.1.0, it is bundled with old Ruby"
|
436
|
+
], @ui.output.split("\n"))
|
437
|
+
|
438
|
+
assert_empty @ui.error
|
439
|
+
ensure
|
440
|
+
util_restore_RUBY_VERSION
|
441
|
+
end
|
442
|
+
|
351
443
|
def test_handle_options
|
352
444
|
@cmd.handle_options %w[]
|
353
445
|
|
@@ -224,26 +224,30 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
|
|
224
224
|
name = File.join 'a', 'b' * 100
|
225
225
|
assert_equal ['b' * 100, 'a'], @tar_writer.split_name(name)
|
226
226
|
|
227
|
-
|
228
|
-
|
227
|
+
name = File.join 'a', 'b' * 101
|
228
|
+
exception = assert_raises Gem::Package::TooLongFileName do
|
229
229
|
@tar_writer.split_name name
|
230
230
|
end
|
231
|
+
assert_includes exception.message, name
|
231
232
|
end
|
232
233
|
|
233
234
|
def test_split_name_too_long_prefix
|
234
235
|
name = File.join 'a' * 155, 'b'
|
235
236
|
assert_equal ['b', 'a' * 155], @tar_writer.split_name(name)
|
236
237
|
|
237
|
-
|
238
|
-
|
238
|
+
name = File.join 'a' * 156, 'b'
|
239
|
+
exception = assert_raises Gem::Package::TooLongFileName do
|
239
240
|
@tar_writer.split_name name
|
240
241
|
end
|
242
|
+
assert_includes exception.message, name
|
241
243
|
end
|
242
244
|
|
243
245
|
def test_split_name_too_long_total
|
244
|
-
|
245
|
-
|
246
|
+
name = 'a' * 257
|
247
|
+
exception = assert_raises Gem::Package::TooLongFileName do
|
248
|
+
@tar_writer.split_name name
|
246
249
|
end
|
250
|
+
assert_includes exception.message, name
|
247
251
|
end
|
248
252
|
|
249
253
|
end
|