rubygems-update 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +8 -1
- data/ChangeLog +164 -0
- data/History.txt +52 -1
- data/Manifest.txt +8 -8
- data/README +3 -2
- data/Rakefile +49 -5
- data/bin/gem +2 -2
- data/bin/update_rubygems +9 -11
- data/cruise_config.rb +4 -3
- data/hide_lib_for_update/note.txt +5 -0
- data/lib/rbconfig/datadir.rb +10 -14
- data/lib/rubygems.rb +117 -140
- data/lib/rubygems/builder.rb +4 -2
- data/lib/rubygems/command.rb +51 -48
- data/lib/rubygems/command_manager.rb +2 -0
- data/lib/rubygems/commands/dependency_command.rb +10 -5
- data/lib/rubygems/commands/environment_command.rb +1 -1
- data/lib/rubygems/commands/fetch_command.rb +6 -5
- data/lib/rubygems/commands/install_command.rb +1 -0
- data/lib/rubygems/commands/mirror_command.rb +8 -8
- data/lib/rubygems/commands/owner_command.rb +75 -0
- data/lib/rubygems/commands/pristine_command.rb +1 -1
- data/lib/rubygems/commands/push_command.rb +45 -0
- data/lib/rubygems/commands/query_command.rb +4 -1
- data/lib/rubygems/commands/rdoc_command.rb +24 -9
- data/lib/rubygems/commands/server_command.rb +6 -0
- data/lib/rubygems/commands/setup_command.rb +14 -4
- data/lib/rubygems/commands/unpack_command.rb +2 -2
- data/lib/rubygems/commands/update_command.rb +2 -2
- data/lib/rubygems/commands/which_command.rb +7 -9
- data/lib/rubygems/config_file.rb +100 -26
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +133 -75
- data/lib/rubygems/dependency_installer.rb +28 -10
- data/lib/rubygems/dependency_list.rb +41 -12
- data/lib/rubygems/doc_manager.rb +7 -0
- data/lib/rubygems/format.rb +16 -20
- data/lib/rubygems/gem_openssl.rb +1 -1
- data/lib/rubygems/gem_path_searcher.rb +10 -12
- data/lib/rubygems/gemcutter_utilities.rb +49 -0
- data/lib/rubygems/indexer.rb +2 -2
- data/lib/rubygems/install_update_options.rb +1 -9
- data/lib/rubygems/installer.rb +35 -76
- data/lib/rubygems/local_remote_options.rb +1 -2
- data/lib/rubygems/package.rb +0 -1
- data/lib/rubygems/package/tar_input.rb +3 -1
- data/lib/rubygems/package_task.rb +16 -11
- data/lib/rubygems/remote_fetcher.rb +22 -8
- data/lib/rubygems/requirement.rb +78 -100
- data/lib/rubygems/server.rb +41 -10
- data/lib/rubygems/source_index.rb +5 -5
- data/lib/rubygems/spec_fetcher.rb +2 -2
- data/lib/rubygems/specification.rb +66 -16
- data/lib/rubygems/test_utilities.rb +33 -4
- data/lib/rubygems/uninstaller.rb +3 -3
- data/lib/rubygems/user_interaction.rb +45 -0
- data/lib/rubygems/validator.rb +6 -7
- data/lib/rubygems/version.rb +206 -149
- data/lib/rubygems/version_option.rb +16 -0
- data/test/fake_certlib/openssl.rb +1 -1
- data/test/functional.rb +0 -7
- data/test/gem_installer_test_case.rb +4 -4
- data/test/gem_package_tar_test_case.rb +1 -1
- data/test/gemutilities.rb +35 -31
- data/test/insure_session.rb +0 -8
- data/test/mockgemui.rb +0 -8
- data/test/simple_gem.rb +2 -8
- data/test/test_config.rb +3 -10
- data/test/test_gem.rb +9 -14
- data/test/test_gem_builder.rb +1 -7
- data/test/test_gem_command.rb +1 -8
- data/test/test_gem_command_manager.rb +1 -7
- data/test/test_gem_commands_build_command.rb +4 -4
- data/test/test_gem_commands_cert_command.rb +1 -2
- data/test/test_gem_commands_check_command.rb +1 -7
- data/test/test_gem_commands_contents_command.rb +1 -1
- data/test/test_gem_commands_dependency_command.rb +17 -31
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_fetch_command.rb +14 -12
- data/test/test_gem_commands_generate_index_command.rb +1 -1
- data/test/test_gem_commands_install_command.rb +22 -20
- data/test/test_gem_commands_list_command.rb +1 -1
- data/test/test_gem_commands_lock_command.rb +1 -1
- data/test/test_gem_commands_mirror_command.rb +5 -5
- data/test/test_gem_commands_outdated_command.rb +3 -5
- data/test/test_gem_commands_owner_command.rb +105 -0
- data/test/test_gem_commands_pristine_command.rb +2 -2
- data/test/test_gem_commands_push_command.rb +61 -0
- data/test/test_gem_commands_query_command.rb +23 -56
- data/test/test_gem_commands_server_command.rb +1 -1
- data/test/test_gem_commands_sources_command.rb +1 -70
- data/test/test_gem_commands_specification_command.rb +3 -4
- data/test/test_gem_commands_stale_command.rb +1 -1
- data/test/test_gem_commands_uninstall_command.rb +3 -4
- data/test/test_gem_commands_unpack_command.rb +1 -1
- data/test/test_gem_commands_update_command.rb +13 -13
- data/test/test_gem_commands_which_command.rb +66 -0
- data/test/test_gem_config_file.rb +13 -7
- data/test/test_gem_dependency.rb +82 -134
- data/test/test_gem_dependency_installer.rb +55 -30
- data/test/test_gem_dependency_list.rb +28 -7
- data/test/test_gem_doc_manager.rb +1 -7
- data/test/test_gem_ext_configure_builder.rb +2 -2
- data/test/test_gem_ext_ext_conf_builder.rb +1 -1
- data/test/test_gem_ext_rake_builder.rb +1 -1
- data/test/test_gem_format.rb +14 -11
- data/test/test_gem_gem_path_searcher.rb +12 -1
- data/test/test_gem_gem_runner.rb +1 -1
- data/test/test_gem_gemcutter_utilities.rb +103 -0
- data/test/test_gem_indexer.rb +44 -51
- data/test/test_gem_install_update_options.rb +1 -7
- data/test/test_gem_installer.rb +22 -82
- data/test/test_gem_local_remote_options.rb +1 -1
- data/test/test_gem_package_tar_header.rb +1 -8
- data/test/test_gem_package_tar_input.rb +1 -8
- data/test/test_gem_package_tar_output.rb +1 -8
- data/test/test_gem_package_tar_reader.rb +1 -8
- data/test/test_gem_package_tar_reader_entry.rb +1 -8
- data/test/test_gem_package_tar_writer.rb +1 -8
- data/test/test_gem_package_task.rb +1 -25
- data/test/test_gem_platform.rb +4 -4
- data/test/test_gem_remote_fetcher.rb +31 -21
- data/test/test_gem_requirement.rb +210 -140
- data/test/test_gem_server.rb +36 -1
- data/test/test_gem_source_index.rb +7 -13
- data/test/test_gem_spec_fetcher.rb +17 -47
- data/test/test_gem_specification.rb +7 -20
- data/test/test_gem_stream_ui.rb +21 -1
- data/test/test_gem_uninstaller.rb +1 -2
- data/test/test_gem_validator.rb +2 -8
- data/test/test_gem_version.rb +110 -254
- data/test/test_gem_version_option.rb +1 -1
- data/test/test_kernel.rb +1 -7
- data/util/CL2notes +1 -1
- data/util/gem_prelude.rb.template +64 -41
- metadata +33 -71
- metadata.gz.sig +0 -0
- data/lib/rubygems/digest/digest_adapter.rb +0 -49
- data/lib/rubygems/digest/md5.rb +0 -23
- data/lib/rubygems/digest/sha1.rb +0 -22
- data/lib/rubygems/digest/sha2.rb +0 -22
- data/lib/rubygems/timer.rb +0 -28
- data/test/test_gem_digest.rb +0 -46
- data/test/test_gem_source_info_cache.rb +0 -447
- data/test/test_gem_source_info_cache_entry.rb +0 -78
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/dependency_installer'
|
3
3
|
|
4
4
|
class TestGemDependencyInstaller < RubyGemTestCase
|
@@ -23,6 +23,16 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
23
23
|
s.add_development_dependency 'aa'
|
24
24
|
end
|
25
25
|
|
26
|
+
@b1_pre, @b1_pre_gem = util_gem 'b', '1.a' do |s|
|
27
|
+
s.add_dependency 'a'
|
28
|
+
s.add_development_dependency 'aa'
|
29
|
+
end
|
30
|
+
|
31
|
+
@c1_pre, @c1_pre_gem = util_gem 'c', '1.a' do |s|
|
32
|
+
s.add_dependency 'a', '1.a'
|
33
|
+
s.add_dependency 'b', '1'
|
34
|
+
end
|
35
|
+
|
26
36
|
@d1, @d1_gem = util_gem 'd', '1'
|
27
37
|
@d2, @d2_gem = util_gem 'd', '2'
|
28
38
|
|
@@ -46,8 +56,8 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
46
56
|
@fetcher = Gem::FakeFetcher.new
|
47
57
|
Gem::RemoteFetcher.fetcher = @fetcher
|
48
58
|
|
49
|
-
si = util_setup_spec_fetcher(@a1, @a1_pre, @b1, @
|
50
|
-
@y1_1_p, @z1)
|
59
|
+
si = util_setup_spec_fetcher(@a1, @a1_pre, @b1, @b1_pre, @c1_pre, @d1, @d2,
|
60
|
+
@x1_m, @x1_o, @w1, @y1, @y1_1_p, @z1)
|
51
61
|
|
52
62
|
util_clear_gems
|
53
63
|
end
|
@@ -104,8 +114,8 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
104
114
|
|
105
115
|
assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
|
106
116
|
|
107
|
-
assert File.exist?(File.join(@tempdir, 'cache',
|
108
|
-
assert File.exist?(File.join(@tempdir, 'cache',
|
117
|
+
assert File.exist?(File.join(@tempdir, 'cache', @a1.file_name))
|
118
|
+
assert File.exist?(File.join(@tempdir, 'cache', @b1.file_name))
|
109
119
|
end
|
110
120
|
|
111
121
|
def test_install_dependencies_satisfied
|
@@ -124,7 +134,7 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
124
134
|
inst.install 'a-2'
|
125
135
|
end
|
126
136
|
|
127
|
-
FileUtils.rm File.join(@tempdir,
|
137
|
+
FileUtils.rm File.join(@tempdir, a2.file_name)
|
128
138
|
|
129
139
|
Dir.chdir @tempdir do
|
130
140
|
inst = Gem::DependencyInstaller.new
|
@@ -259,7 +269,9 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
259
269
|
inst.install 'a'
|
260
270
|
end
|
261
271
|
|
262
|
-
|
272
|
+
env = "/\\S+/env" unless Gem.win_platform?
|
273
|
+
|
274
|
+
assert_match %r|\A#!#{env} #{Gem::ConfigMap[:ruby_install_name]}\n|,
|
263
275
|
File.read(File.join(@gemhome, 'bin', 'a_bin'))
|
264
276
|
end
|
265
277
|
|
@@ -302,10 +314,8 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
302
314
|
|
303
315
|
assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
|
304
316
|
|
305
|
-
assert File.exist?(File.join(gemhome2, 'specifications',
|
306
|
-
|
307
|
-
assert File.exist?(File.join(gemhome2, 'cache',
|
308
|
-
"#{@a1.full_name}.gem"))
|
317
|
+
assert File.exist?(File.join(gemhome2, 'specifications', @a1.spec_name))
|
318
|
+
assert File.exist?(File.join(gemhome2, 'cache', @a1.file_name))
|
309
319
|
end
|
310
320
|
|
311
321
|
def test_install_domain_both
|
@@ -327,10 +337,8 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
327
337
|
assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
|
328
338
|
a1, b1 = inst.installed_gems
|
329
339
|
|
330
|
-
a1_expected = File.join(@gemhome, 'specifications',
|
331
|
-
|
332
|
-
b1_expected = File.join(@gemhome, 'specifications',
|
333
|
-
"#{b1.full_name}.gemspec")
|
340
|
+
a1_expected = File.join(@gemhome, 'specifications', a1.spec_name)
|
341
|
+
b1_expected = File.join(@gemhome, 'specifications', b1.spec_name)
|
334
342
|
|
335
343
|
assert_equal a1_expected, a1.loaded_from
|
336
344
|
assert_equal b1_expected, b1.loaded_from
|
@@ -463,9 +471,9 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
463
471
|
File.open @a1_gem, 'rb' do |fp| a1_data = fp.read end
|
464
472
|
File.open a2_o_gem, 'rb' do |fp| a2_o_data = fp.read end
|
465
473
|
|
466
|
-
@fetcher.data["http://gems.example.com/gems/#{@a1.
|
474
|
+
@fetcher.data["http://gems.example.com/gems/#{@a1.file_name}"] =
|
467
475
|
a1_data
|
468
|
-
@fetcher.data["http://gems.example.com/gems/#{a2_o.
|
476
|
+
@fetcher.data["http://gems.example.com/gems/#{a2_o.file_name}"] =
|
469
477
|
a2_o_data
|
470
478
|
|
471
479
|
inst = Gem::DependencyInstaller.new :domain => :remote
|
@@ -576,10 +584,29 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
576
584
|
|
577
585
|
local = gems.last
|
578
586
|
assert_equal 'a-1', local.first.full_name, 'local spec'
|
579
|
-
assert_equal File.join(@tempdir,
|
587
|
+
assert_equal File.join(@tempdir, @a1.file_name),
|
580
588
|
local.last, 'local path'
|
581
589
|
end
|
582
590
|
|
591
|
+
def test_find_gems_with_sources_prerelease
|
592
|
+
installer = Gem::DependencyInstaller.new
|
593
|
+
|
594
|
+
dependency = Gem::Dependency.new('a', Gem::Requirement.default)
|
595
|
+
|
596
|
+
releases =
|
597
|
+
installer.find_gems_with_sources(dependency).map { |gems, *| gems }
|
598
|
+
|
599
|
+
assert releases.any? { |s| s.name == 'a' and s.version.to_s == '1' }
|
600
|
+
refute releases.any? { |s| s.name == 'a' and s.version.to_s == '1.a' }
|
601
|
+
|
602
|
+
dependency.prerelease = true
|
603
|
+
|
604
|
+
prereleases =
|
605
|
+
installer.find_gems_with_sources(dependency).map { |gems, *| gems }
|
606
|
+
|
607
|
+
assert_equal [@a1_pre], prereleases
|
608
|
+
end
|
609
|
+
|
583
610
|
def test_gather_dependencies
|
584
611
|
inst = Gem::DependencyInstaller.new
|
585
612
|
inst.find_spec_by_name_and_version 'b'
|
@@ -622,6 +649,15 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
622
649
|
assert_equal %w[y-1 z-1], inst.gems_to_install.map { |s| s.full_name }
|
623
650
|
end
|
624
651
|
|
652
|
+
def test_gather_dependencies_prerelease
|
653
|
+
inst = Gem::DependencyInstaller.new :prerelease => true
|
654
|
+
inst.find_spec_by_name_and_version 'c', '1.a'
|
655
|
+
inst.gather_dependencies
|
656
|
+
|
657
|
+
assert_equal %w[a-1.a b-1 c-1.a],
|
658
|
+
inst.gems_to_install.map { |s| s.full_name }
|
659
|
+
end
|
660
|
+
|
625
661
|
def test_gather_dependencies_old_required
|
626
662
|
e1, = util_gem 'e', '1' do |s| s.add_dependency 'd', '= 1' end
|
627
663
|
|
@@ -636,16 +672,5 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
636
672
|
assert_equal %w[d-1 e-1], inst.gems_to_install.map { |s| s.full_name }
|
637
673
|
end
|
638
674
|
|
639
|
-
def test_prerelease_uses_pre_index
|
640
|
-
installer = Gem::DependencyInstaller.new
|
641
|
-
pre_installer = Gem::DependencyInstaller.new(:prerelease => true)
|
642
|
-
dependency = Gem::Dependency.new('a', Gem::Requirement.default)
|
643
|
-
|
644
|
-
releases = installer.find_gems_with_sources(dependency).map{ |gems, *| gems }
|
645
|
-
prereleases = pre_installer.find_gems_with_sources(dependency).map{ |gems, *| gems }
|
646
|
-
|
647
|
-
assert releases.select{ |s| s.name == 'a' and s.version.to_s == '1' }.first
|
648
|
-
assert releases.select{ |s| s.name == 'a' and s.version.to_s == '1.a' }.empty?
|
649
|
-
assert_equal [@a1_pre], prereleases
|
650
|
-
end
|
651
675
|
end
|
676
|
+
|
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
8
2
|
require 'rubygems/dependency_list'
|
9
3
|
|
10
4
|
class TestGemDependencyList < RubyGemTestCase
|
@@ -71,6 +65,33 @@ class TestGemDependencyList < RubyGemTestCase
|
|
71
65
|
assert_equal %w[b-1 c-1 a-1], order.map { |s| s.full_name }
|
72
66
|
end
|
73
67
|
|
68
|
+
def test_dependency_order_development
|
69
|
+
e1 = quick_gem 'e', '1'
|
70
|
+
f1 = quick_gem 'f', '1'
|
71
|
+
g1 = quick_gem 'g', '1'
|
72
|
+
|
73
|
+
@a1.add_dependency 'e'
|
74
|
+
@a1.add_dependency 'f'
|
75
|
+
@a1.add_dependency 'g'
|
76
|
+
g1.add_development_dependency 'a'
|
77
|
+
|
78
|
+
deplist = Gem::DependencyList.new true
|
79
|
+
deplist.add @a1, e1, f1, g1
|
80
|
+
|
81
|
+
order = deplist.dependency_order
|
82
|
+
|
83
|
+
assert_equal %w[g-1 a-1 f-1 e-1], order.map { |s| s.full_name },
|
84
|
+
'development on'
|
85
|
+
|
86
|
+
deplist2 = Gem::DependencyList.new
|
87
|
+
deplist2.add @a1, e1, f1, g1
|
88
|
+
|
89
|
+
order = deplist2.dependency_order
|
90
|
+
|
91
|
+
assert_equal %w[a-1 g-1 f-1 e-1], order.map { |s| s.full_name },
|
92
|
+
'development off'
|
93
|
+
end
|
94
|
+
|
74
95
|
def test_dependency_order_diamond
|
75
96
|
util_diamond
|
76
97
|
e1 = quick_gem 'e', '1'
|
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
8
2
|
require 'rubygems/doc_manager'
|
9
3
|
|
10
4
|
class TestGemDocManager < RubyGemTestCase
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/ext'
|
3
3
|
|
4
4
|
class TestGemExtConfigureBuilder < RubyGemTestCase
|
@@ -46,7 +46,7 @@ class TestGemExtConfigureBuilder < RubyGemTestCase
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
shell_error_msg = %r{(\./configure: .*)|(Can't open \./configure)}
|
49
|
+
shell_error_msg = %r{(\./configure: .*)|(Can't open \./configure(?:: No such file or directory)?)}
|
50
50
|
sh_prefix_configure = "sh ./configure --prefix="
|
51
51
|
|
52
52
|
expected = %r(configure failed:
|
data/test/test_gem_format.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
8
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'simple_gem')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
|
+
require File.expand_path('../simple_gem', __FILE__)
|
9
3
|
require 'rubygems/format'
|
10
4
|
|
11
5
|
class TestGemFormat < RubyGemTestCase
|
@@ -16,7 +10,7 @@ class TestGemFormat < RubyGemTestCase
|
|
16
10
|
@simple_gem = SIMPLE_GEM
|
17
11
|
end
|
18
12
|
|
19
|
-
def
|
13
|
+
def test_class_from_file_by_path
|
20
14
|
util_make_gems
|
21
15
|
|
22
16
|
gems = Dir[File.join(@gemhome, 'cache', '*.gem')]
|
@@ -34,13 +28,22 @@ class TestGemFormat < RubyGemTestCase
|
|
34
28
|
end
|
35
29
|
end
|
36
30
|
|
37
|
-
def
|
31
|
+
def test_class_from_file_by_path_empty
|
32
|
+
util_make_gems
|
33
|
+
|
34
|
+
empty_gem = File.join @tempdir, 'empty.gem'
|
35
|
+
FileUtils.touch empty_gem
|
36
|
+
|
37
|
+
assert_nil Gem::Format.from_file_by_path(empty_gem)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_class_from_file_by_path_nonexistent
|
38
41
|
assert_raises Gem::Exception do
|
39
42
|
Gem::Format.from_file_by_path '/nonexistent'
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
43
|
-
def
|
46
|
+
def test_class_from_io_garbled
|
44
47
|
e = assert_raises Gem::Package::FormatError do
|
45
48
|
# subtly bogus input
|
46
49
|
Gem::Format.from_io(StringIO.new(@simple_gem.upcase))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/gem_path_searcher'
|
3
3
|
|
4
4
|
class Gem::GemPathSearcher
|
@@ -22,6 +22,9 @@ class TestGemGemPathSearcher < RubyGemTestCase
|
|
22
22
|
@foo2 = quick_gem 'foo', '0.2'
|
23
23
|
@bar1 = quick_gem 'bar', '0.1'
|
24
24
|
@bar2 = quick_gem 'bar', '0.2'
|
25
|
+
@nrp = quick_gem 'nil_require_paths', '0.1'
|
26
|
+
@nrp.require_paths = nil
|
27
|
+
|
25
28
|
|
26
29
|
@fetcher = Gem::FakeFetcher.new
|
27
30
|
Gem::RemoteFetcher.fetcher = @fetcher
|
@@ -50,6 +53,10 @@ class TestGemGemPathSearcher < RubyGemTestCase
|
|
50
53
|
assert_equal expected, lib_dirs
|
51
54
|
end
|
52
55
|
|
56
|
+
def test_lib_dirs_for_nil_require_paths
|
57
|
+
assert_nil @gps.lib_dirs_for(@nrp)
|
58
|
+
end
|
59
|
+
|
53
60
|
def test_matching_file_eh
|
54
61
|
refute @gps.matching_file?(@foo1, 'bar')
|
55
62
|
assert @gps.matching_file?(@foo1, 'foo')
|
@@ -63,5 +70,9 @@ class TestGemGemPathSearcher < RubyGemTestCase
|
|
63
70
|
assert_equal [expected], @gps.matching_files(@foo1, 'foo')
|
64
71
|
end
|
65
72
|
|
73
|
+
def test_matching_files_nil_require_paths
|
74
|
+
assert_empty @gps.matching_files(@nrp, 'foo')
|
75
|
+
end
|
76
|
+
|
66
77
|
end
|
67
78
|
|
data/test/test_gem_gem_runner.rb
CHANGED
@@ -0,0 +1,103 @@
|
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/gemcutter_utilities'
|
4
|
+
|
5
|
+
class TestGemGemcutterUtilities < RubyGemTestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super
|
9
|
+
|
10
|
+
ENV['RUBYGEMS_HOST'] = nil
|
11
|
+
Gem.configuration.rubygems_api_key = nil
|
12
|
+
|
13
|
+
@cmd = Gem::Command.new '', 'summary'
|
14
|
+
@cmd.extend Gem::GemcutterUtilities
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_sign_in
|
18
|
+
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
19
|
+
util_sign_in [api_key, 200, 'OK']
|
20
|
+
|
21
|
+
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
|
22
|
+
assert @fetcher.last_request["authorization"]
|
23
|
+
assert_match %r{Signed in.}, @sign_in_ui.output
|
24
|
+
|
25
|
+
credentials = YAML.load_file Gem.configuration.credentials_path
|
26
|
+
assert_equal api_key, credentials[:rubygems_api_key]
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_sign_in_with_host
|
30
|
+
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
31
|
+
util_sign_in [api_key, 200, 'OK'], 'http://example.com'
|
32
|
+
|
33
|
+
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
|
34
|
+
assert @fetcher.last_request["authorization"]
|
35
|
+
assert_match %r{Signed in.}, @sign_in_ui.output
|
36
|
+
|
37
|
+
credentials = YAML.load_file Gem.configuration.credentials_path
|
38
|
+
assert_equal api_key, credentials[:rubygems_api_key]
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_sign_in_skips_with_existing_credentials
|
42
|
+
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
43
|
+
Gem.configuration.rubygems_api_key = api_key
|
44
|
+
|
45
|
+
util_sign_in [api_key, 200, 'OK']
|
46
|
+
|
47
|
+
assert_equal "", @sign_in_ui.output
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_sign_in_with_other_credentials_doesnt_overwrite_other_keys
|
51
|
+
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
52
|
+
other_api_key = 'f46dbb18bb6a9c97cdc61b5b85c186a17403cdcbf'
|
53
|
+
|
54
|
+
FileUtils.mkdir_p File.dirname(Gem.configuration.credentials_path)
|
55
|
+
open Gem.configuration.credentials_path, 'w' do |f|
|
56
|
+
f.write Hash[:other_api_key, other_api_key].to_yaml
|
57
|
+
end
|
58
|
+
util_sign_in [api_key, 200, 'OK']
|
59
|
+
|
60
|
+
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
|
61
|
+
assert_match %r{Signed in.}, @sign_in_ui.output
|
62
|
+
|
63
|
+
credentials = YAML.load_file Gem.configuration.credentials_path
|
64
|
+
assert_equal api_key, credentials[:rubygems_api_key]
|
65
|
+
assert_equal other_api_key, credentials[:other_api_key]
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_sign_in_with_bad_credentials
|
69
|
+
skip 'Always uses $stdin on windows' if Gem.win_platform?
|
70
|
+
|
71
|
+
assert_raises MockGemUi::TermError do
|
72
|
+
util_sign_in ['Access Denied.', 403, 'Forbidden']
|
73
|
+
end
|
74
|
+
|
75
|
+
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
|
76
|
+
assert_match %r{Access Denied.}, @sign_in_ui.output
|
77
|
+
end
|
78
|
+
|
79
|
+
def util_sign_in response, host = nil
|
80
|
+
skip 'Always uses $stdin on windows' if Gem.win_platform?
|
81
|
+
|
82
|
+
email = 'you@example.com'
|
83
|
+
password = 'secret'
|
84
|
+
|
85
|
+
if host
|
86
|
+
ENV['RUBYGEMS_HOST'] = host
|
87
|
+
else
|
88
|
+
host = "https://rubygems.org"
|
89
|
+
end
|
90
|
+
|
91
|
+
@fetcher = Gem::FakeFetcher.new
|
92
|
+
@fetcher.data["#{host}/api/v1/api_key"] = response
|
93
|
+
Gem::RemoteFetcher.fetcher = @fetcher
|
94
|
+
|
95
|
+
@sign_in_ui = MockGemUi.new "#{email}\n#{password}\n"
|
96
|
+
|
97
|
+
use_ui @sign_in_ui do
|
98
|
+
@cmd.sign_in
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
data/test/test_gem_indexer.rb
CHANGED
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
8
|
-
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
9
2
|
require 'rubygems/indexer'
|
10
3
|
|
11
4
|
unless ''.respond_to? :to_xs then
|
@@ -145,19 +138,19 @@ pl-1-i386-linux
|
|
145
138
|
|
146
139
|
assert_equal expected, latest_quick_index
|
147
140
|
|
148
|
-
assert_indexed quickdir, "#{@a1.
|
149
|
-
assert_indexed quickdir, "#{@a2.
|
150
|
-
assert_indexed quickdir, "#{@b2.
|
151
|
-
assert_indexed quickdir, "#{@c1_2.
|
141
|
+
assert_indexed quickdir, "#{@a1.spec_name}.rz"
|
142
|
+
assert_indexed quickdir, "#{@a2.spec_name}.rz"
|
143
|
+
assert_indexed quickdir, "#{@b2.spec_name}.rz"
|
144
|
+
assert_indexed quickdir, "#{@c1_2.spec_name}.rz"
|
152
145
|
|
153
146
|
assert_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
154
|
-
refute_indexed quickdir, "#{@pl1.
|
147
|
+
refute_indexed quickdir, "#{@pl1.spec_name}.rz"
|
155
148
|
|
156
|
-
assert_indexed marshal_quickdir, "#{@a1.
|
157
|
-
assert_indexed marshal_quickdir, "#{@a2.
|
149
|
+
assert_indexed marshal_quickdir, "#{@a1.spec_name}.rz"
|
150
|
+
assert_indexed marshal_quickdir, "#{@a2.spec_name}.rz"
|
158
151
|
|
159
|
-
refute_indexed quickdir,
|
160
|
-
refute_indexed marshal_quickdir,
|
152
|
+
refute_indexed quickdir, @c1_2.spec_name
|
153
|
+
refute_indexed marshal_quickdir, @c1_2.spec_name
|
161
154
|
|
162
155
|
assert_indexed @tempdir, "specs.#{@marshal_version}"
|
163
156
|
assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
@@ -172,7 +165,7 @@ pl-1-i386-linux
|
|
172
165
|
<title>ExampleForge gems</title>
|
173
166
|
<link>http://example.com</link>
|
174
167
|
<description>Recently released gems from http://example.com</description>
|
175
|
-
<generator>RubyGems
|
168
|
+
<generator>RubyGems v#{Gem::RubyGemsVersion}</generator>
|
176
169
|
<docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
|
177
170
|
<item>
|
178
171
|
<title>a-2</title>
|
@@ -325,19 +318,19 @@ eighty characters.</pre>
|
|
325
318
|
assert_indexed quickdir, "latest_index"
|
326
319
|
assert_indexed quickdir, "latest_index.rz"
|
327
320
|
|
328
|
-
assert_indexed quickdir, "#{@a1.
|
329
|
-
assert_indexed quickdir, "#{@a2.
|
330
|
-
assert_indexed quickdir, "#{@b2.
|
331
|
-
assert_indexed quickdir, "#{@c1_2.
|
321
|
+
assert_indexed quickdir, "#{@a1.spec_name}.rz"
|
322
|
+
assert_indexed quickdir, "#{@a2.spec_name}.rz"
|
323
|
+
assert_indexed quickdir, "#{@b2.spec_name}.rz"
|
324
|
+
assert_indexed quickdir, "#{@c1_2.spec_name}.rz"
|
332
325
|
|
333
326
|
assert_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
334
|
-
refute_indexed quickdir, "#{@pl1.
|
327
|
+
refute_indexed quickdir, "#{@pl1.spec_name}.rz"
|
335
328
|
|
336
|
-
assert_indexed marshal_quickdir, "#{@a1.
|
337
|
-
assert_indexed marshal_quickdir, "#{@a2.
|
329
|
+
assert_indexed marshal_quickdir, "#{@a1.spec_name}.rz"
|
330
|
+
assert_indexed marshal_quickdir, "#{@a2.spec_name}.rz"
|
338
331
|
|
339
|
-
refute_indexed quickdir, "#{@c1_2.
|
340
|
-
refute_indexed marshal_quickdir, "#{@c1_2.
|
332
|
+
refute_indexed quickdir, "#{@c1_2.spec_name}"
|
333
|
+
refute_indexed marshal_quickdir, "#{@c1_2.spec_name}"
|
341
334
|
|
342
335
|
refute_indexed @tempdir, "specs.#{@marshal_version}"
|
343
336
|
refute_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
@@ -379,15 +372,15 @@ eighty characters.</pre>
|
|
379
372
|
assert_indexed quickdir, "latest_index"
|
380
373
|
assert_indexed quickdir, "latest_index.rz"
|
381
374
|
|
382
|
-
assert_indexed quickdir, "#{@a1.
|
383
|
-
assert_indexed quickdir, "#{@a2.
|
384
|
-
assert_indexed quickdir, "#{@b2.
|
385
|
-
assert_indexed quickdir, "#{@c1_2.
|
375
|
+
assert_indexed quickdir, "#{@a1.spec_name}.rz"
|
376
|
+
assert_indexed quickdir, "#{@a2.spec_name}.rz"
|
377
|
+
assert_indexed quickdir, "#{@b2.spec_name}.rz"
|
378
|
+
assert_indexed quickdir, "#{@c1_2.spec_name}.rz"
|
386
379
|
|
387
380
|
assert_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
388
381
|
|
389
|
-
assert_indexed marshal_quickdir, "#{@a1.
|
390
|
-
assert_indexed marshal_quickdir, "#{@a2.
|
382
|
+
assert_indexed marshal_quickdir, "#{@a1.spec_name}.rz"
|
383
|
+
assert_indexed marshal_quickdir, "#{@a2.spec_name}.rz"
|
391
384
|
|
392
385
|
assert_indexed @tempdir, "specs.#{@marshal_version}"
|
393
386
|
assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
@@ -421,19 +414,19 @@ eighty characters.</pre>
|
|
421
414
|
refute_indexed quickdir, "latest_index"
|
422
415
|
refute_indexed quickdir, "latest_index.rz"
|
423
416
|
|
424
|
-
refute_indexed quickdir, "#{@a1.
|
425
|
-
refute_indexed quickdir, "#{@a2.
|
426
|
-
refute_indexed quickdir, "#{@b2.
|
427
|
-
refute_indexed quickdir, "#{@c1_2.
|
417
|
+
refute_indexed quickdir, "#{@a1.spec_name}.rz"
|
418
|
+
refute_indexed quickdir, "#{@a2.spec_name}.rz"
|
419
|
+
refute_indexed quickdir, "#{@b2.spec_name}.rz"
|
420
|
+
refute_indexed quickdir, "#{@c1_2.spec_name}.rz"
|
428
421
|
|
429
422
|
refute_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
430
|
-
refute_indexed quickdir, "#{@pl1.
|
423
|
+
refute_indexed quickdir, "#{@pl1.spec_name}.rz"
|
431
424
|
|
432
|
-
assert_indexed marshal_quickdir, "#{@a1.
|
433
|
-
assert_indexed marshal_quickdir, "#{@a2.
|
425
|
+
assert_indexed marshal_quickdir, "#{@a1.spec_name}.rz"
|
426
|
+
assert_indexed marshal_quickdir, "#{@a2.spec_name}.rz"
|
434
427
|
|
435
|
-
refute_indexed quickdir, "#{@c1_2.
|
436
|
-
refute_indexed marshal_quickdir, "#{@c1_2.
|
428
|
+
refute_indexed quickdir, "#{@c1_2.spec_name}"
|
429
|
+
refute_indexed marshal_quickdir, "#{@c1_2.spec_name}"
|
437
430
|
|
438
431
|
assert_indexed @tempdir, "specs.#{@marshal_version}"
|
439
432
|
assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
@@ -475,15 +468,15 @@ eighty characters.</pre>
|
|
475
468
|
assert_indexed quickdir, "latest_index"
|
476
469
|
assert_indexed quickdir, "latest_index.rz"
|
477
470
|
|
478
|
-
assert_indexed quickdir, "#{@a1.
|
479
|
-
assert_indexed quickdir, "#{@a2.
|
480
|
-
assert_indexed quickdir, "#{@b2.
|
481
|
-
assert_indexed quickdir, "#{@c1_2.
|
471
|
+
assert_indexed quickdir, "#{@a1.spec_name}.rz"
|
472
|
+
assert_indexed quickdir, "#{@a2.spec_name}.rz"
|
473
|
+
assert_indexed quickdir, "#{@b2.spec_name}.rz"
|
474
|
+
assert_indexed quickdir, "#{@c1_2.spec_name}.rz"
|
482
475
|
|
483
476
|
assert_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
484
477
|
|
485
|
-
assert_indexed marshal_quickdir, "#{@a1.
|
486
|
-
assert_indexed marshal_quickdir, "#{@a2.
|
478
|
+
assert_indexed marshal_quickdir, "#{@a1.spec_name}.rz"
|
479
|
+
assert_indexed marshal_quickdir, "#{@a2.spec_name}.rz"
|
487
480
|
|
488
481
|
assert_indexed @tempdir, "specs.#{@marshal_version}"
|
489
482
|
assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
@@ -637,14 +630,14 @@ eighty characters.</pre>
|
|
637
630
|
@d2_1_a_tuple = [@d2_1_a.name, @d2_1_a.version, @d2_1_a.original_platform]
|
638
631
|
|
639
632
|
gems = File.join @tempdir, 'gems'
|
640
|
-
FileUtils.mv File.join(@gemhome, 'cache',
|
641
|
-
FileUtils.mv File.join(@gemhome, 'cache',
|
633
|
+
FileUtils.mv File.join(@gemhome, 'cache', @d2_1.file_name), gems
|
634
|
+
FileUtils.mv File.join(@gemhome, 'cache', @d2_1_a.file_name), gems
|
642
635
|
|
643
636
|
use_ui @ui do
|
644
637
|
@indexer.update_index
|
645
638
|
end
|
646
639
|
|
647
|
-
assert_indexed marshal_quickdir, "#{@d2_1.
|
640
|
+
assert_indexed marshal_quickdir, "#{@d2_1.spec_name}.rz"
|
648
641
|
|
649
642
|
specs_index = Marshal.load Gem.read_binary(@indexer.dest_specs_index)
|
650
643
|
|