rubygems-update 1.6.2 → 1.7.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 +0 -0
- data/.autotest +0 -1
- data/History.txt +70 -4
- data/README.rdoc +3 -0
- data/Rakefile +76 -0
- data/lib/rubygems.rb +57 -27
- data/lib/rubygems/command.rb +6 -4
- data/lib/rubygems/commands/contents_command.rb +14 -11
- data/lib/rubygems/commands/fetch_command.rb +6 -3
- data/lib/rubygems/commands/outdated_command.rb +2 -1
- data/lib/rubygems/commands/pristine_command.rb +4 -3
- data/lib/rubygems/commands/unpack_command.rb +46 -4
- data/lib/rubygems/commands/update_command.rb +24 -10
- data/lib/rubygems/custom_require.rb +1 -2
- data/lib/rubygems/dependency_installer.rb +1 -1
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gem_runner.rb +1 -0
- data/lib/rubygems/mock_gem_ui.rb +2 -1
- data/lib/rubygems/package/tar_input.rb +1 -0
- data/lib/rubygems/remote_fetcher.rb +62 -39
- data/lib/rubygems/server.rb +1 -1
- data/lib/rubygems/source_index.rb +64 -43
- data/lib/rubygems/spec_fetcher.rb +5 -6
- data/lib/rubygems/specification.rb +375 -402
- data/lib/rubygems/test_case.rb +7 -8
- data/lib/rubygems/uninstaller.rb +2 -2
- data/lib/rubygems/user_interaction.rb +27 -31
- data/test/rubygems/test_gem.rb +2 -44
- data/test/rubygems/test_gem_commands_contents_command.rb +19 -30
- data/test/rubygems/test_gem_commands_unpack_command.rb +24 -0
- data/test/rubygems/test_gem_commands_update_command.rb +26 -1
- data/test/rubygems/test_gem_dependency_installer.rb +9 -5
- data/test/rubygems/test_gem_dependency_list.rb +2 -6
- data/test/rubygems/test_gem_gem_runner.rb +1 -4
- data/test/rubygems/test_gem_installer.rb +1 -2
- data/test/rubygems/test_gem_remote_fetcher.rb +131 -24
- data/test/rubygems/test_gem_source_index.rb +7 -192
- data/test/rubygems/test_gem_specification.rb +132 -103
- metadata +9 -9
- metadata.gz.sig +0 -0
@@ -33,10 +33,7 @@ class TestGemGemRunner < Gem::TestCase
|
|
33
33
|
def test_build_args__are_handled
|
34
34
|
Gem.clear_paths
|
35
35
|
|
36
|
-
|
37
|
-
assert_raises(Gem::SystemExitException) do
|
38
|
-
gr.run(%W[--help -- --build_arg1 --build_arg2])
|
39
|
-
end
|
36
|
+
Gem::GemRunner.new.run(%W[help -- --build_arg1 --build_arg2])
|
40
37
|
|
41
38
|
assert_equal %w[--build_arg1 --build_arg2], Gem::Command.build_args
|
42
39
|
end
|
@@ -654,8 +654,7 @@ load Gem.bin_path('a', 'executable', version)
|
|
654
654
|
|
655
655
|
FileUtils.mv @gemhome, gemhome2
|
656
656
|
Gem.source_index.gems.delete b2.full_name
|
657
|
-
source_index = Gem::SourceIndex.
|
658
|
-
'specifications')
|
657
|
+
source_index = Gem::SourceIndex.new [File.join(gemhome2, 'specifications')]
|
659
658
|
|
660
659
|
util_setup_gem
|
661
660
|
|
@@ -146,7 +146,7 @@ gems:
|
|
146
146
|
fetcher.fetch_size 'gems.example.com/yaml'
|
147
147
|
end
|
148
148
|
|
149
|
-
assert_equal 'uri scheme is invalid', e.message
|
149
|
+
assert_equal 'uri scheme is invalid: nil', e.message
|
150
150
|
end
|
151
151
|
|
152
152
|
def test_fetch_size_socket_error
|
@@ -416,7 +416,7 @@ gems:
|
|
416
416
|
def test_fetch_path_gzip
|
417
417
|
fetcher = Gem::RemoteFetcher.new nil
|
418
418
|
|
419
|
-
def fetcher.
|
419
|
+
def fetcher.fetch_http(uri, mtime, head = nil)
|
420
420
|
Gem.gzip 'foo'
|
421
421
|
end
|
422
422
|
|
@@ -426,7 +426,7 @@ gems:
|
|
426
426
|
def test_fetch_path_gzip_unmodified
|
427
427
|
fetcher = Gem::RemoteFetcher.new nil
|
428
428
|
|
429
|
-
def fetcher.
|
429
|
+
def fetcher.fetch_http(uri, mtime, head = nil)
|
430
430
|
nil
|
431
431
|
end
|
432
432
|
|
@@ -436,53 +436,59 @@ gems:
|
|
436
436
|
def test_fetch_path_io_error
|
437
437
|
fetcher = Gem::RemoteFetcher.new nil
|
438
438
|
|
439
|
-
def fetcher.
|
439
|
+
def fetcher.fetch_http(*)
|
440
440
|
raise EOFError
|
441
441
|
end
|
442
442
|
|
443
|
+
url = 'http://example.com/uri'
|
444
|
+
|
443
445
|
e = assert_raises Gem::RemoteFetcher::FetchError do
|
444
|
-
fetcher.fetch_path
|
446
|
+
fetcher.fetch_path url
|
445
447
|
end
|
446
448
|
|
447
|
-
assert_equal
|
448
|
-
assert_equal
|
449
|
+
assert_equal "EOFError: EOFError (#{url})", e.message
|
450
|
+
assert_equal url, e.uri
|
449
451
|
end
|
450
452
|
|
451
453
|
def test_fetch_path_socket_error
|
452
454
|
fetcher = Gem::RemoteFetcher.new nil
|
453
455
|
|
454
|
-
def fetcher.
|
456
|
+
def fetcher.fetch_http(uri, mtime, head = nil)
|
455
457
|
raise SocketError
|
456
458
|
end
|
457
459
|
|
460
|
+
url = 'http://example.com/uri'
|
461
|
+
|
458
462
|
e = assert_raises Gem::RemoteFetcher::FetchError do
|
459
|
-
fetcher.fetch_path
|
463
|
+
fetcher.fetch_path url
|
460
464
|
end
|
461
465
|
|
462
|
-
assert_equal
|
463
|
-
assert_equal
|
466
|
+
assert_equal "SocketError: SocketError (#{url})", e.message
|
467
|
+
assert_equal url, e.uri
|
464
468
|
end
|
465
469
|
|
466
470
|
def test_fetch_path_system_call_error
|
467
471
|
fetcher = Gem::RemoteFetcher.new nil
|
468
472
|
|
469
|
-
def fetcher.
|
473
|
+
def fetcher.fetch_http(uri, mtime = nil, head = nil)
|
470
474
|
raise Errno::ECONNREFUSED, 'connect(2)'
|
471
475
|
end
|
472
476
|
|
477
|
+
url = 'http://example.com/uri'
|
478
|
+
|
473
479
|
e = assert_raises Gem::RemoteFetcher::FetchError do
|
474
|
-
fetcher.fetch_path
|
480
|
+
fetcher.fetch_path url
|
475
481
|
end
|
476
482
|
|
477
|
-
assert_match %r|ECONNREFUSED:.*connect\(2\) \(
|
483
|
+
assert_match %r|ECONNREFUSED:.*connect\(2\) \(#{Regexp.escape url}\)\z|,
|
478
484
|
e.message
|
479
|
-
assert_equal
|
485
|
+
assert_equal url, e.uri
|
480
486
|
end
|
481
487
|
|
482
488
|
def test_fetch_path_unmodified
|
483
489
|
fetcher = Gem::RemoteFetcher.new nil
|
484
490
|
|
485
|
-
def fetcher.
|
491
|
+
def fetcher.fetch_http(uri, mtime, head = nil)
|
486
492
|
nil
|
487
493
|
end
|
488
494
|
|
@@ -545,16 +551,18 @@ gems:
|
|
545
551
|
end
|
546
552
|
end
|
547
553
|
|
548
|
-
def
|
554
|
+
def test_fetch_http
|
549
555
|
fetcher = Gem::RemoteFetcher.new nil
|
556
|
+
url = 'http://gems.example.com/redirect'
|
550
557
|
|
551
558
|
conn = Object.new
|
552
559
|
def conn.started?() true end
|
553
560
|
def conn.request(req)
|
561
|
+
url = 'http://gems.example.com/redirect'
|
554
562
|
unless defined? @requested then
|
555
563
|
@requested = true
|
556
564
|
res = Net::HTTPMovedPermanently.new nil, 301, nil
|
557
|
-
res.add_field 'Location',
|
565
|
+
res.add_field 'Location', url
|
558
566
|
res
|
559
567
|
else
|
560
568
|
res = Net::HTTPOK.new nil, 200, nil
|
@@ -566,19 +574,21 @@ gems:
|
|
566
574
|
conn = { "#{Thread.current.object_id}:gems.example.com:80" => conn }
|
567
575
|
fetcher.instance_variable_set :@connections, conn
|
568
576
|
|
569
|
-
data = fetcher.
|
577
|
+
data = fetcher.fetch_http URI.parse(url)
|
570
578
|
|
571
579
|
assert_equal 'real_path', data
|
572
580
|
end
|
573
581
|
|
574
|
-
def
|
582
|
+
def test_fetch_http_redirects
|
575
583
|
fetcher = Gem::RemoteFetcher.new nil
|
584
|
+
url = 'http://gems.example.com/redirect'
|
576
585
|
|
577
586
|
conn = Object.new
|
578
587
|
def conn.started?() true end
|
579
588
|
def conn.request(req)
|
589
|
+
url = 'http://gems.example.com/redirect'
|
580
590
|
res = Net::HTTPMovedPermanently.new nil, 301, nil
|
581
|
-
res.add_field 'Location',
|
591
|
+
res.add_field 'Location', url
|
582
592
|
res
|
583
593
|
end
|
584
594
|
|
@@ -586,11 +596,10 @@ gems:
|
|
586
596
|
fetcher.instance_variable_set :@connections, conn
|
587
597
|
|
588
598
|
e = assert_raises Gem::RemoteFetcher::FetchError do
|
589
|
-
fetcher.
|
599
|
+
fetcher.fetch_http URI.parse(url)
|
590
600
|
end
|
591
601
|
|
592
|
-
assert_equal
|
593
|
-
e.message
|
602
|
+
assert_equal "too many redirects (#{url})", e.message
|
594
603
|
end
|
595
604
|
|
596
605
|
def test_request
|
@@ -625,6 +634,85 @@ gems:
|
|
625
634
|
assert_equal t.rfc2822, conn.payload['if-modified-since']
|
626
635
|
end
|
627
636
|
|
637
|
+
def test_user_agent
|
638
|
+
ua = @fetcher.user_agent
|
639
|
+
|
640
|
+
assert_match %r%^RubyGems/\S+ \S+ Ruby/\S+ \(.*?\)%, ua
|
641
|
+
assert_match %r%RubyGems/#{Regexp.escape Gem::VERSION}%, ua
|
642
|
+
assert_match %r% #{Regexp.escape Gem::Platform.local.to_s} %, ua
|
643
|
+
assert_match %r%Ruby/#{Regexp.escape RUBY_VERSION}%, ua
|
644
|
+
assert_match %r%\(#{Regexp.escape RUBY_RELEASE_DATE} %, ua
|
645
|
+
end
|
646
|
+
|
647
|
+
def test_user_agent_engine
|
648
|
+
util_save_version
|
649
|
+
|
650
|
+
Object.send :remove_const, :RUBY_ENGINE if defined?(RUBY_ENGINE)
|
651
|
+
Object.send :const_set, :RUBY_ENGINE, 'vroom'
|
652
|
+
|
653
|
+
ua = @fetcher.user_agent
|
654
|
+
|
655
|
+
assert_match %r%\) vroom%, ua
|
656
|
+
ensure
|
657
|
+
util_restore_version
|
658
|
+
end
|
659
|
+
|
660
|
+
def test_user_agent_engine_ruby
|
661
|
+
util_save_version
|
662
|
+
|
663
|
+
Object.send :remove_const, :RUBY_ENGINE if defined?(RUBY_ENGINE)
|
664
|
+
Object.send :const_set, :RUBY_ENGINE, 'ruby'
|
665
|
+
|
666
|
+
ua = @fetcher.user_agent
|
667
|
+
|
668
|
+
assert_match %r%\)%, ua
|
669
|
+
ensure
|
670
|
+
util_restore_version
|
671
|
+
end
|
672
|
+
|
673
|
+
def test_user_agent_patchlevel
|
674
|
+
util_save_version
|
675
|
+
|
676
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL
|
677
|
+
Object.send :const_set, :RUBY_PATCHLEVEL, 5
|
678
|
+
|
679
|
+
ua = @fetcher.user_agent
|
680
|
+
|
681
|
+
assert_match %r% patchlevel 5\)%, ua
|
682
|
+
ensure
|
683
|
+
util_restore_version
|
684
|
+
end
|
685
|
+
|
686
|
+
def test_user_agent_revision
|
687
|
+
util_save_version
|
688
|
+
|
689
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL
|
690
|
+
Object.send :const_set, :RUBY_PATCHLEVEL, -1
|
691
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
692
|
+
Object.send :const_set, :RUBY_REVISION, 6
|
693
|
+
|
694
|
+
ua = @fetcher.user_agent
|
695
|
+
|
696
|
+
assert_match %r% revision 6\)%, ua
|
697
|
+
assert_match %r%Ruby/#{Regexp.escape RUBY_VERSION}dev%, ua
|
698
|
+
ensure
|
699
|
+
util_restore_version
|
700
|
+
end
|
701
|
+
|
702
|
+
def test_user_agent_revision_missing
|
703
|
+
util_save_version
|
704
|
+
|
705
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL
|
706
|
+
Object.send :const_set, :RUBY_PATCHLEVEL, -1
|
707
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
708
|
+
|
709
|
+
ua = @fetcher.user_agent
|
710
|
+
|
711
|
+
assert_match %r%\(#{Regexp.escape RUBY_RELEASE_DATE}\)%, ua
|
712
|
+
ensure
|
713
|
+
util_restore_version
|
714
|
+
end
|
715
|
+
|
628
716
|
def test_yaml_error_on_size
|
629
717
|
use_ui @ui do
|
630
718
|
self.class.enable_yaml = false
|
@@ -747,5 +835,24 @@ gems:
|
|
747
835
|
assert_equal "/home/skillet", @fetcher.correct_for_windows_path(path)
|
748
836
|
end
|
749
837
|
|
838
|
+
def util_save_version
|
839
|
+
@orig_RUBY_ENGINE = RUBY_ENGINE if defined? RUBY_ENGINE
|
840
|
+
@orig_RUBY_PATCHLEVEL = RUBY_PATCHLEVEL
|
841
|
+
@orig_RUBY_REVISION = RUBY_REVISION if defined? RUBY_REVISION
|
842
|
+
end
|
843
|
+
|
844
|
+
def util_restore_version
|
845
|
+
Object.send :remove_const, :RUBY_ENGINE if defined?(RUBY_ENGINE)
|
846
|
+
Object.send :const_set, :RUBY_ENGINE, @orig_RUBY_ENGINE if
|
847
|
+
defined?(@orig_RUBY_ENGINE)
|
848
|
+
|
849
|
+
Object.send :remove_const, :RUBY_PATCHLEVEL
|
850
|
+
Object.send :const_set, :RUBY_PATCHLEVEL, @orig_RUBY_PATCHLEVEL
|
851
|
+
|
852
|
+
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
853
|
+
Object.send :const_set, :RUBY_REVISION, @orig_RUBY_REVISION if
|
854
|
+
defined?(@orig_RUBY_REVISION)
|
855
|
+
end
|
856
|
+
|
750
857
|
end
|
751
858
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rubygems/test_case'
|
2
2
|
require 'rubygems/source_index'
|
3
3
|
require 'rubygems/config_file'
|
4
|
+
require 'rubygems/deprecate'
|
4
5
|
|
5
6
|
class TestGemSourceIndex < Gem::TestCase
|
6
7
|
|
@@ -10,182 +11,6 @@ class TestGemSourceIndex < Gem::TestCase
|
|
10
11
|
util_setup_fake_fetcher
|
11
12
|
end
|
12
13
|
|
13
|
-
def test_self_from_gems_in
|
14
|
-
spec_dir = File.join @gemhome, 'specifications'
|
15
|
-
|
16
|
-
FileUtils.rm_r spec_dir
|
17
|
-
|
18
|
-
FileUtils.mkdir_p spec_dir
|
19
|
-
|
20
|
-
a1 = quick_spec 'a', '1' do |spec| spec.author = 'author 1' end
|
21
|
-
|
22
|
-
spec_file = File.join spec_dir, a1.spec_name
|
23
|
-
|
24
|
-
File.open spec_file, 'w' do |fp|
|
25
|
-
fp.write a1.to_ruby
|
26
|
-
end
|
27
|
-
|
28
|
-
si = Gem::SourceIndex.from_gems_in spec_dir
|
29
|
-
|
30
|
-
assert_equal [spec_dir], si.spec_dirs
|
31
|
-
assert_equal [a1.full_name], si.gems.keys
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_self_load_specification
|
35
|
-
spec_dir = File.join @gemhome, 'specifications'
|
36
|
-
|
37
|
-
FileUtils.rm_r spec_dir
|
38
|
-
|
39
|
-
FileUtils.mkdir_p spec_dir
|
40
|
-
|
41
|
-
a1 = quick_spec 'a', '1' do |spec| spec.author = 'author 1' end
|
42
|
-
|
43
|
-
spec_file = File.join spec_dir, a1.spec_name
|
44
|
-
|
45
|
-
File.open spec_file, 'w' do |fp|
|
46
|
-
fp.write a1.to_ruby
|
47
|
-
end
|
48
|
-
|
49
|
-
spec = Gem::SourceIndex.load_specification spec_file
|
50
|
-
|
51
|
-
assert_equal a1.author, spec.author
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_self_load_specification_utf_8
|
55
|
-
spec_dir = File.join @gemhome, 'specifications'
|
56
|
-
|
57
|
-
FileUtils.rm_r spec_dir
|
58
|
-
|
59
|
-
FileUtils.mkdir_p spec_dir
|
60
|
-
|
61
|
-
spec_file = File.join spec_dir, "utf-8.gemspec"
|
62
|
-
spec_data = <<-SPEC
|
63
|
-
Gem::Specification.new do |s|
|
64
|
-
s.name = %q{utf}
|
65
|
-
s.version = "8"
|
66
|
-
|
67
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0")
|
68
|
-
s.authors = ["\317\200"]
|
69
|
-
s.date = %q{2008-09-10}
|
70
|
-
s.description = %q{This is a test description}
|
71
|
-
s.email = %q{example@example.com}
|
72
|
-
s.has_rdoc = true
|
73
|
-
s.homepage = %q{http://example.com}
|
74
|
-
s.require_paths = ["lib"]
|
75
|
-
s.rubygems_version = %q{1.2.0}
|
76
|
-
s.summary = %q{this is a summary}
|
77
|
-
|
78
|
-
if s.respond_to? :specification_version then
|
79
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
80
|
-
s.specification_version = 2
|
81
|
-
|
82
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
83
|
-
else
|
84
|
-
end
|
85
|
-
else
|
86
|
-
end
|
87
|
-
end
|
88
|
-
SPEC
|
89
|
-
|
90
|
-
spec_data.force_encoding 'UTF-8'
|
91
|
-
|
92
|
-
File.open spec_file, 'w' do |io| io.write spec_data end
|
93
|
-
|
94
|
-
spec = Gem::SourceIndex.load_specification spec_file
|
95
|
-
|
96
|
-
pi = "\317\200"
|
97
|
-
pi.force_encoding 'UTF-8' if pi.respond_to? :force_encoding
|
98
|
-
|
99
|
-
assert_equal pi, spec.author
|
100
|
-
end if Gem.ruby_version > Gem::Version.new('1.9')
|
101
|
-
|
102
|
-
def test_self_load_specification_exception
|
103
|
-
spec_dir = File.join @gemhome, 'specifications'
|
104
|
-
|
105
|
-
FileUtils.mkdir_p spec_dir
|
106
|
-
|
107
|
-
spec_file = File.join spec_dir, 'a-1.gemspec'
|
108
|
-
|
109
|
-
File.open spec_file, 'w' do |fp|
|
110
|
-
fp.write 'raise Exception, "epic fail"'
|
111
|
-
end
|
112
|
-
|
113
|
-
out, err = capture_io do
|
114
|
-
assert_equal nil, Gem::SourceIndex.load_specification(spec_file)
|
115
|
-
end
|
116
|
-
|
117
|
-
assert_equal '', out
|
118
|
-
|
119
|
-
expected = "Invalid gemspec in [#{spec_file}]: epic fail\n"
|
120
|
-
assert_equal expected, err
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_self_load_specification_interrupt
|
124
|
-
spec_dir = File.join @gemhome, 'specifications'
|
125
|
-
|
126
|
-
FileUtils.mkdir_p spec_dir
|
127
|
-
|
128
|
-
spec_file = File.join spec_dir, 'a-1.gemspec'
|
129
|
-
|
130
|
-
File.open spec_file, 'w' do |fp|
|
131
|
-
fp.write 'raise Interrupt, "^C"'
|
132
|
-
end
|
133
|
-
|
134
|
-
use_ui @ui do
|
135
|
-
assert_raises Interrupt do
|
136
|
-
Gem::SourceIndex.load_specification(spec_file)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
assert_equal '', @ui.output
|
141
|
-
assert_equal '', @ui.error
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_self_load_specification_syntax_error
|
145
|
-
spec_dir = File.join @gemhome, 'specifications'
|
146
|
-
|
147
|
-
FileUtils.mkdir_p spec_dir
|
148
|
-
|
149
|
-
spec_file = File.join spec_dir, 'a-1.gemspec'
|
150
|
-
|
151
|
-
File.open spec_file, 'w' do |fp|
|
152
|
-
fp.write '1 +'
|
153
|
-
end
|
154
|
-
|
155
|
-
out, err = capture_io do
|
156
|
-
assert_equal nil, Gem::SourceIndex.load_specification(spec_file)
|
157
|
-
end
|
158
|
-
|
159
|
-
assert_equal '', out
|
160
|
-
|
161
|
-
assert_match(/syntax error/, err)
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_self_load_specification_system_exit
|
165
|
-
spec_dir = File.join @gemhome, 'specifications'
|
166
|
-
|
167
|
-
FileUtils.mkdir_p spec_dir
|
168
|
-
|
169
|
-
spec_file = File.join spec_dir, 'a-1.gemspec'
|
170
|
-
|
171
|
-
File.open spec_file, 'w' do |fp|
|
172
|
-
fp.write 'raise SystemExit, "bye-bye"'
|
173
|
-
end
|
174
|
-
|
175
|
-
use_ui @ui do
|
176
|
-
assert_raises SystemExit do
|
177
|
-
Gem::SourceIndex.load_specification(spec_file)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
assert_equal '', @ui.output
|
182
|
-
assert_equal '', @ui.error
|
183
|
-
end
|
184
|
-
|
185
|
-
def test_create_from_directory
|
186
|
-
# TODO
|
187
|
-
end
|
188
|
-
|
189
14
|
def test_find_name
|
190
15
|
assert_equal [@a1, @a2, @a3a], @source_index.find_name('a')
|
191
16
|
assert_equal [@a2], @source_index.find_name('a', '= 2')
|
@@ -203,7 +28,7 @@ end
|
|
203
28
|
end
|
204
29
|
|
205
30
|
def test_find_name_empty_cache
|
206
|
-
empty_source_index = Gem::SourceIndex.new
|
31
|
+
empty_source_index = Gem::SourceIndex.new
|
207
32
|
assert_equal [], empty_source_index.find_name("foo")
|
208
33
|
end
|
209
34
|
|
@@ -310,7 +135,7 @@ end
|
|
310
135
|
|
311
136
|
FileUtils.mv a1_spec, @tempdir
|
312
137
|
|
313
|
-
source_index = Gem
|
138
|
+
source_index = Gem.source_index
|
314
139
|
|
315
140
|
refute source_index.gems.include?(@a1.full_name)
|
316
141
|
|
@@ -321,26 +146,16 @@ end
|
|
321
146
|
assert source_index.gems.include?(@a1.full_name)
|
322
147
|
end
|
323
148
|
|
324
|
-
def test_refresh_bang_not_from_dir
|
325
|
-
source_index = Gem::SourceIndex.new
|
326
|
-
|
327
|
-
e = assert_raises RuntimeError do
|
328
|
-
source_index.refresh!
|
329
|
-
end
|
330
|
-
|
331
|
-
assert_equal 'source index not created from disk', e.message
|
332
|
-
end
|
333
|
-
|
334
149
|
def test_remove_spec
|
335
150
|
deleted = @source_index.remove_spec 'a-1'
|
336
151
|
|
337
152
|
assert_equal %w[a-2 a-3.a a_evil-9 c-1.2],
|
338
|
-
@source_index.
|
153
|
+
@source_index.gems.values.map { |s| s.full_name }.sort
|
339
154
|
|
340
155
|
deleted = @source_index.remove_spec 'a-3.a'
|
341
156
|
|
342
157
|
assert_equal %w[a-2 a_evil-9 c-1.2],
|
343
|
-
@source_index.
|
158
|
+
@source_index.gems.values.map { |s| s.full_name }.sort
|
344
159
|
end
|
345
160
|
|
346
161
|
def test_search
|
@@ -366,8 +181,8 @@ end
|
|
366
181
|
s.platform = Gem::Platform.new 'x86-other_platform1'
|
367
182
|
end
|
368
183
|
|
369
|
-
si = Gem::SourceIndex.new
|
370
|
-
|
184
|
+
si = Gem::SourceIndex.new
|
185
|
+
si.add_specs a1, a1_mine, a1_other
|
371
186
|
|
372
187
|
dep = Gem::Dependency.new 'a', Gem::Requirement.new('1')
|
373
188
|
|