rubygems-update 1.3.3 → 1.3.4
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 +0 -0
- data/ChangeLog +238 -184
- data/lib/rubygems.rb +11 -5
- data/lib/rubygems/command.rb +4 -1
- data/lib/rubygems/commands/install_command.rb +40 -0
- data/lib/rubygems/commands/query_command.rb +16 -1
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +1 -1
- data/lib/rubygems/config_file.rb +0 -1
- data/lib/rubygems/defaults.rb +2 -1
- data/lib/rubygems/dependency.rb +0 -2
- data/lib/rubygems/dependency_list.rb +36 -16
- data/lib/rubygems/exceptions.rb +0 -2
- data/lib/rubygems/ext/builder.rb +0 -2
- data/lib/rubygems/gem_openssl.rb +0 -1
- data/lib/rubygems/gem_path_searcher.rb +0 -2
- data/lib/rubygems/indexer.rb +1 -0
- data/lib/rubygems/package/f_sync_dir.rb +0 -2
- data/lib/rubygems/package/tar_header.rb +0 -2
- data/lib/rubygems/package/tar_input.rb +0 -2
- data/lib/rubygems/package/tar_output.rb +0 -2
- data/lib/rubygems/package/tar_reader.rb +2 -2
- data/lib/rubygems/package/tar_reader/entry.rb +0 -2
- data/lib/rubygems/package/tar_writer.rb +0 -2
- data/lib/rubygems/platform.rb +0 -2
- data/lib/rubygems/remote_fetcher.rb +5 -1
- data/lib/rubygems/requirement.rb +2 -4
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/source_index.rb +19 -9
- data/lib/rubygems/spec_fetcher.rb +0 -1
- data/lib/rubygems/specification.rb +0 -1
- data/lib/rubygems/uninstaller.rb +4 -4
- data/lib/rubygems/version.rb +0 -2
- data/test/gemutilities.rb +13 -4
- data/test/test_gem.rb +54 -5
- data/test/test_gem_commands_install_command.rb +2 -0
- data/test/test_gem_commands_query_command.rb +68 -8
- data/test/test_gem_commands_unpack_command.rb +4 -4
- data/test/test_gem_dependency_installer.rb +3 -1
- data/test/test_gem_format.rb +1 -1
- data/test/test_gem_indexer.rb +5 -3
- data/test/test_gem_source_index.rb +14 -445
- data/test/test_gem_source_info_cache.rb +1 -1
- data/test/test_gem_specification.rb +2 -1
- metadata +4 -4
- metadata.gz.sig +0 -0
data/lib/rubygems/platform.rb
CHANGED
@@ -139,7 +139,11 @@ class Gem::RemoteFetcher
|
|
139
139
|
Gem.configuration.really_verbose
|
140
140
|
when nil then # TODO test for local overriding cache
|
141
141
|
begin
|
142
|
-
|
142
|
+
if Gem.win_platform? && source_uri.scheme && !source_uri.path.include?(':')
|
143
|
+
FileUtils.cp URI.unescape(source_uri.scheme + ':' + source_uri.path), local_gem_path
|
144
|
+
else
|
145
|
+
FileUtils.cp URI.unescape(source_uri.path), local_gem_path
|
146
|
+
end
|
143
147
|
rescue Errno::EACCES
|
144
148
|
local_gem_path = source_uri.to_s
|
145
149
|
end
|
data/lib/rubygems/requirement.rb
CHANGED
@@ -4,8 +4,6 @@
|
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
6
6
|
|
7
|
-
require 'rubygems/version'
|
8
|
-
|
9
7
|
##
|
10
8
|
# Requirement version includes a prefaced comparator in addition
|
11
9
|
# to a version number.
|
@@ -65,7 +63,7 @@ class Gem::Requirement
|
|
65
63
|
|
66
64
|
##
|
67
65
|
# Constructs a Requirement from +requirements+ which can be a String, a
|
68
|
-
# Gem::Version, or an Array of those. See parse for details on the
|
66
|
+
# Gem::Version, or an Array of those. See #parse for details on the
|
69
67
|
# formatting of requirement strings.
|
70
68
|
|
71
69
|
def initialize(requirements)
|
@@ -142,7 +140,7 @@ class Gem::Requirement
|
|
142
140
|
# Parse the version requirement obj returning the operator and version.
|
143
141
|
#
|
144
142
|
# The requirement can be a String or a Gem::Version. A String can be an
|
145
|
-
# operator (<, <=, =,
|
143
|
+
# operator (<, <=, =, >=, >, !=, ~>), a version number, or both, operator
|
146
144
|
# first.
|
147
145
|
|
148
146
|
def parse(obj)
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
6
6
|
|
7
|
-
require 'rubygems'
|
8
7
|
require 'rubygems/user_interaction'
|
9
8
|
require 'rubygems/specification'
|
10
9
|
|
@@ -116,11 +115,11 @@ class Gem::SourceIndex
|
|
116
115
|
end
|
117
116
|
|
118
117
|
##
|
119
|
-
# Constructs a source index instance from the provided
|
120
|
-
#
|
121
|
-
|
122
|
-
#
|
123
|
-
#
|
118
|
+
# Constructs a source index instance from the provided specifications, which
|
119
|
+
# is a Hash of gem full names and Gem::Specifications.
|
120
|
+
#--
|
121
|
+
# TODO merge @gems and @prerelease_gems and provide a separate method
|
122
|
+
# #prerelease_gems
|
124
123
|
|
125
124
|
def initialize(specifications={})
|
126
125
|
@gems, @prerelease_gems = [{}, {}]
|
@@ -128,6 +127,13 @@ class Gem::SourceIndex
|
|
128
127
|
@spec_dirs = nil
|
129
128
|
end
|
130
129
|
|
130
|
+
##
|
131
|
+
# Both regular and prerelease gems
|
132
|
+
|
133
|
+
def all_gems
|
134
|
+
@gems.merge @prerelease_gems
|
135
|
+
end
|
136
|
+
|
131
137
|
##
|
132
138
|
# Reconstruct the source index from the specifications in +spec_dirs+.
|
133
139
|
|
@@ -215,7 +221,11 @@ class Gem::SourceIndex
|
|
215
221
|
# Remove a gem specification named +full_name+.
|
216
222
|
|
217
223
|
def remove_spec(full_name)
|
218
|
-
@gems.
|
224
|
+
if @gems.key? full_name then
|
225
|
+
@gems.delete full_name
|
226
|
+
else
|
227
|
+
@prerelease_gems.delete full_name
|
228
|
+
end
|
219
229
|
end
|
220
230
|
|
221
231
|
##
|
@@ -279,7 +289,7 @@ class Gem::SourceIndex
|
|
279
289
|
|
280
290
|
# TODO - Remove support and warning for legacy arguments after 2008/11
|
281
291
|
unless Gem::Dependency === gem_pattern
|
282
|
-
warn "#{Gem.location_of_caller.join ':'}:Warning: Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated"
|
292
|
+
warn "#{Gem.location_of_caller.join ':'}:Warning: Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated, use #find_name"
|
283
293
|
end
|
284
294
|
|
285
295
|
case gem_pattern
|
@@ -304,7 +314,7 @@ class Gem::SourceIndex
|
|
304
314
|
version_requirement = Gem::Requirement.create version_requirement
|
305
315
|
end
|
306
316
|
|
307
|
-
specs =
|
317
|
+
specs = all_gems.values.select do |spec|
|
308
318
|
spec.name =~ gem_pattern and
|
309
319
|
version_requirement.satisfied_by? spec.version
|
310
320
|
end
|
data/lib/rubygems/uninstaller.rb
CHANGED
@@ -126,14 +126,14 @@ class Gem::Uninstaller
|
|
126
126
|
unless spec.executables.empty? then
|
127
127
|
bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path)
|
128
128
|
|
129
|
-
list = @source_index.find_name(spec.name).delete_if { |
|
130
|
-
|
129
|
+
list = @source_index.find_name(spec.name).delete_if { |s|
|
130
|
+
s.version == spec.version
|
131
131
|
}
|
132
132
|
|
133
133
|
executables = spec.executables.clone
|
134
134
|
|
135
|
-
list.each do |
|
136
|
-
|
135
|
+
list.each do |s|
|
136
|
+
s.executables.each do |exe_name|
|
137
137
|
executables.delete exe_name
|
138
138
|
end
|
139
139
|
end
|
data/lib/rubygems/version.rb
CHANGED
data/test/gemutilities.rb
CHANGED
@@ -8,7 +8,11 @@ at_exit { $SAFE = 1 }
|
|
8
8
|
|
9
9
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
10
10
|
|
11
|
-
|
11
|
+
if RUBY_VERSION > '1.9' then
|
12
|
+
Gem::QuickLoader.load_full_rubygems_library
|
13
|
+
else
|
14
|
+
require 'rubygems'
|
15
|
+
end
|
12
16
|
require 'fileutils'
|
13
17
|
begin
|
14
18
|
gem 'minitest', '>= 1.3.1'
|
@@ -329,6 +333,7 @@ Also, a list:
|
|
329
333
|
end
|
330
334
|
|
331
335
|
@a2 = quick_gem('a', '2', &init)
|
336
|
+
@a3a = quick_gem('a', '3.a', &init)
|
332
337
|
@a_evil9 = quick_gem('a_evil', '9', &init)
|
333
338
|
@b2 = quick_gem('b', '2', &init)
|
334
339
|
@c1_2 = quick_gem('c', '1.2', &init)
|
@@ -348,11 +353,14 @@ Also, a list:
|
|
348
353
|
|
349
354
|
write_file File.join(*%W[gems #{@a1.original_name} lib code.rb]) do end
|
350
355
|
write_file File.join(*%W[gems #{@a2.original_name} lib code.rb]) do end
|
356
|
+
write_file File.join(*%W[gems #{@a3a.original_name} lib code.rb]) do end
|
351
357
|
write_file File.join(*%W[gems #{@b2.original_name} lib code.rb]) do end
|
352
358
|
write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb]) do end
|
353
359
|
write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb]) do end
|
354
360
|
|
355
|
-
[@a1, @a2, @a_evil9, @b2, @c1_2, @pl1].each
|
361
|
+
[@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1].each do |spec|
|
362
|
+
util_build_gem spec
|
363
|
+
end
|
356
364
|
|
357
365
|
FileUtils.rm_r File.join(@gemhome, 'gems', @pl1.original_name)
|
358
366
|
|
@@ -381,15 +389,16 @@ Also, a list:
|
|
381
389
|
|
382
390
|
util_make_gems(prerelease)
|
383
391
|
|
384
|
-
@all_gems = [@a1, @a2, @a_evil9, @b2, @c1_2].sort
|
392
|
+
@all_gems = [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2].sort
|
385
393
|
@all_gem_names = @all_gems.map { |gem| gem.full_name }
|
386
394
|
|
387
|
-
gem_names = [@a1.full_name, @a2.full_name, @b2.full_name]
|
395
|
+
gem_names = [@a1.full_name, @a2.full_name, @a3a.full_name, @b2.full_name]
|
388
396
|
@gem_names = gem_names.sort.join("\n")
|
389
397
|
|
390
398
|
@source_index = Gem::SourceIndex.new
|
391
399
|
@source_index.add_spec @a1
|
392
400
|
@source_index.add_spec @a2
|
401
|
+
@source_index.add_spec @a3a
|
393
402
|
@source_index.add_spec @a_evil9
|
394
403
|
@source_index.add_spec @c1_2
|
395
404
|
@source_index.add_spec @a2_pre if prerelease
|
data/test/test_gem.rb
CHANGED
@@ -24,6 +24,7 @@ class TestGem < RubyGemTestCase
|
|
24
24
|
expected = [
|
25
25
|
File.join(@gemhome, *%W[gems #{@a1.full_name} lib]),
|
26
26
|
File.join(@gemhome, *%W[gems #{@a2.full_name} lib]),
|
27
|
+
File.join(@gemhome, *%W[gems #{@a3a.full_name} lib]),
|
27
28
|
File.join(@gemhome, *%W[gems #{@a_evil9.full_name} lib]),
|
28
29
|
File.join(@gemhome, *%W[gems #{@b2.full_name} lib]),
|
29
30
|
File.join(@gemhome, *%W[gems #{@c1_2.full_name} lib]),
|
@@ -305,7 +306,7 @@ class TestGem < RubyGemTestCase
|
|
305
306
|
util_make_gems
|
306
307
|
|
307
308
|
expected = [
|
308
|
-
File.join(@gemhome, *%W[gems #{@
|
309
|
+
File.join(@gemhome, *%W[gems #{@a3a.full_name} lib]),
|
309
310
|
File.join(@gemhome, *%W[gems #{@a_evil9.full_name} lib]),
|
310
311
|
File.join(@gemhome, *%W[gems #{@b2.full_name} lib]),
|
311
312
|
File.join(@gemhome, *%W[gems #{@c1_2.full_name} lib]),
|
@@ -512,11 +513,28 @@ class TestGem < RubyGemTestCase
|
|
512
513
|
Gem::ConfigMap[:EXEEXT] = orig_exe_ext
|
513
514
|
end
|
514
515
|
|
515
|
-
def
|
516
|
-
|
517
|
-
|
516
|
+
def test_self_ruby_version_1_8_5
|
517
|
+
util_set_RUBY_VERSION '1.8.5'
|
518
|
+
|
519
|
+
assert_equal Gem::Version.new('1.8.5'), Gem.ruby_version
|
520
|
+
ensure
|
521
|
+
util_restore_RUBY_VERSION
|
522
|
+
end
|
523
|
+
|
524
|
+
def test_self_ruby_version_1_8_6p287
|
525
|
+
util_set_RUBY_VERSION '1.8.6', 287
|
518
526
|
|
519
|
-
assert_equal Gem::Version.new(
|
527
|
+
assert_equal Gem::Version.new('1.8.6.287'), Gem.ruby_version
|
528
|
+
ensure
|
529
|
+
util_restore_RUBY_VERSION
|
530
|
+
end
|
531
|
+
|
532
|
+
def test_self_ruby_version_1_9_2dev_r23493
|
533
|
+
util_set_RUBY_VERSION '1.9.2', -1, 23493
|
534
|
+
|
535
|
+
assert_equal Gem::Version.new('1.9.2.dev.23493'), Gem.ruby_version
|
536
|
+
ensure
|
537
|
+
util_restore_RUBY_VERSION
|
520
538
|
end
|
521
539
|
|
522
540
|
def test_self_searcher
|
@@ -625,5 +643,36 @@ class TestGem < RubyGemTestCase
|
|
625
643
|
@abin_path = File.join spec.full_gem_path, spec.bindir, 'abin'
|
626
644
|
end
|
627
645
|
|
646
|
+
def util_set_RUBY_VERSION(version, patchlevel = nil, revision = nil)
|
647
|
+
if Gem.instance_variables.include? :@ruby_version or
|
648
|
+
Gem.instance_variables.include? '@ruby_version' then
|
649
|
+
Gem.send :remove_instance_variable, :@ruby_version
|
650
|
+
end
|
651
|
+
|
652
|
+
@RUBY_VERSION = RUBY_VERSION
|
653
|
+
@RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
654
|
+
@RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
|
655
|
+
|
656
|
+
Object.send :remove_const, :RUBY_VERSION
|
657
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
658
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
659
|
+
|
660
|
+
Object.const_set :RUBY_VERSION, version
|
661
|
+
Object.const_set :RUBY_PATCHLEVEL, patchlevel if patchlevel
|
662
|
+
Object.const_set :RUBY_REVISION, revision if revision
|
663
|
+
end
|
664
|
+
|
665
|
+
def util_restore_RUBY_VERSION
|
666
|
+
Object.send :remove_const, :RUBY_VERSION
|
667
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
|
668
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
669
|
+
|
670
|
+
Object.const_set :RUBY_VERSION, @RUBY_VERSION
|
671
|
+
Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL if
|
672
|
+
defined?(@RUBY_PATCHLEVEL)
|
673
|
+
Object.const_set :RUBY_REVISION, @RUBY_REVISION if
|
674
|
+
defined?(@RUBY_REVISION)
|
675
|
+
end
|
676
|
+
|
628
677
|
end
|
629
678
|
|
@@ -10,7 +10,7 @@ class TestGemCommandsQueryCommand < RubyGemTestCase
|
|
10
10
|
|
11
11
|
util_setup_fake_fetcher
|
12
12
|
|
13
|
-
@si = util_setup_spec_fetcher @a1, @a2, @pl1
|
13
|
+
@si = util_setup_spec_fetcher @a1, @a2, @pl1, @a3a
|
14
14
|
|
15
15
|
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
|
16
16
|
raise Gem::RemoteFetcher::FetchError
|
@@ -252,11 +252,30 @@ RubyGems will revert to legacy indexes degrading performance.
|
|
252
252
|
assert_equal expected, @ui.error
|
253
253
|
end
|
254
254
|
|
255
|
+
def test_execute_legacy_prerelease
|
256
|
+
Gem::SpecFetcher.fetcher = nil
|
257
|
+
si = util_setup_source_info_cache @a1, @a2, @pl1
|
258
|
+
|
259
|
+
@fetcher.data["#{@gem_repo}yaml"] = YAML.dump si
|
260
|
+
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] =
|
261
|
+
si.dump
|
262
|
+
|
263
|
+
@fetcher.data.delete "#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"
|
264
|
+
|
265
|
+
@cmd.handle_options %w[-r --prerelease]
|
266
|
+
|
267
|
+
e = assert_raises Gem::OperationNotSupportedError do
|
268
|
+
@cmd.execute
|
269
|
+
end
|
270
|
+
|
271
|
+
assert_equal 'Prereleases not supported on legacy repositories', e.message
|
272
|
+
end
|
273
|
+
|
255
274
|
def test_execute_local_details
|
256
|
-
@
|
257
|
-
@
|
258
|
-
@
|
259
|
-
@
|
275
|
+
@a3a.summary = 'This is a lot of text. ' * 4
|
276
|
+
@a3a.authors = ['Abraham Lincoln', 'Hirohito']
|
277
|
+
@a3a.homepage = 'http://a.example.com/'
|
278
|
+
@a3a.rubyforge_project = 'rubygems'
|
260
279
|
|
261
280
|
@cmd.handle_options %w[--local --details]
|
262
281
|
|
@@ -268,10 +287,11 @@ RubyGems will revert to legacy indexes degrading performance.
|
|
268
287
|
|
269
288
|
*** LOCAL GEMS ***
|
270
289
|
|
271
|
-
a (2, 1)
|
290
|
+
a (3.a, 2, 1)
|
272
291
|
Author: A User
|
273
292
|
Homepage: http://example.com
|
274
|
-
Installed at (
|
293
|
+
Installed at (3.a): #{@gemhome}
|
294
|
+
(2): #{@gemhome}
|
275
295
|
(1): #{@gemhome}
|
276
296
|
|
277
297
|
this is a summary
|
@@ -320,7 +340,7 @@ pl (1)
|
|
320
340
|
end
|
321
341
|
|
322
342
|
expected = <<-EOF
|
323
|
-
a (2, 1)
|
343
|
+
a (3.a, 2, 1)
|
324
344
|
a_evil (9)
|
325
345
|
b (2)
|
326
346
|
c (1.2)
|
@@ -368,5 +388,45 @@ pl (1)
|
|
368
388
|
assert_equal '', @ui.error
|
369
389
|
end
|
370
390
|
|
391
|
+
def test_execute_prerelease
|
392
|
+
@cmd.handle_options %w[-r --prerelease]
|
393
|
+
|
394
|
+
use_ui @ui do
|
395
|
+
@cmd.execute
|
396
|
+
end
|
397
|
+
|
398
|
+
expected = <<-EOF
|
399
|
+
|
400
|
+
*** REMOTE GEMS ***
|
401
|
+
|
402
|
+
a (3.a)
|
403
|
+
EOF
|
404
|
+
|
405
|
+
assert_equal expected, @ui.output
|
406
|
+
assert_equal '', @ui.error
|
407
|
+
end
|
408
|
+
|
409
|
+
def test_execute_prerelease_local
|
410
|
+
@cmd.handle_options %w[-l --prerelease]
|
411
|
+
|
412
|
+
use_ui @ui do
|
413
|
+
@cmd.execute
|
414
|
+
end
|
415
|
+
|
416
|
+
expected = <<-EOF
|
417
|
+
|
418
|
+
*** LOCAL GEMS ***
|
419
|
+
|
420
|
+
a (3.a, 2, 1)
|
421
|
+
a_evil (9)
|
422
|
+
b (2)
|
423
|
+
c (1.2)
|
424
|
+
pl (1)
|
425
|
+
EOF
|
426
|
+
|
427
|
+
assert_equal expected, @ui.output
|
428
|
+
assert_equal "WARNING: prereleases are always shown locally\n", @ui.error
|
429
|
+
end
|
430
|
+
|
371
431
|
end
|
372
432
|
|
@@ -22,8 +22,8 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
assert File.exist?(File.join(@tempdir, 'a-
|
26
|
-
assert File.exist?(File.join(@tempdir, 'b-2')),
|
25
|
+
assert File.exist?(File.join(@tempdir, 'a-3.a')), 'a should be installed'
|
26
|
+
assert File.exist?(File.join(@tempdir, 'b-2')), 'b should be installed'
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_execute_gem_path
|
@@ -44,7 +44,7 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
assert File.exist?(File.join(@tempdir, 'a-
|
47
|
+
assert File.exist?(File.join(@tempdir, 'a-3.a'))
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_execute_gem_path_missing
|
@@ -81,7 +81,7 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
assert File.exist?(File.join(@tempdir, target, 'a-
|
84
|
+
assert File.exist?(File.join(@tempdir, target, 'a-3.a'))
|
85
85
|
end
|
86
86
|
|
87
87
|
def test_execute_exact_match
|