rubygems-update 2.1.11 → 2.2.0.rc.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +37 -12
- data/History.txt +99 -2
- data/MIT.txt +1 -0
- data/Manifest.txt +59 -19
- data/Rakefile +4 -6
- data/lib/gauntlet_rubygems.rb +1 -1
- data/lib/rubygems.rb +102 -80
- data/lib/rubygems/available_set.rb +2 -2
- data/lib/rubygems/basic_specification.rb +97 -8
- data/lib/rubygems/commands/install_command.rb +58 -15
- data/lib/rubygems/commands/list_command.rb +1 -7
- data/lib/rubygems/commands/outdated_command.rb +1 -1
- data/lib/rubygems/commands/pristine_command.rb +14 -1
- data/lib/rubygems/commands/push_command.rb +9 -4
- data/lib/rubygems/commands/query_command.rb +33 -17
- data/lib/rubygems/commands/search_command.rb +0 -6
- data/lib/rubygems/commands/specification_command.rb +1 -1
- data/lib/rubygems/commands/unpack_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +4 -1
- data/lib/rubygems/commands/which_command.rb +5 -8
- data/lib/rubygems/compatibility.rb +3 -0
- data/lib/rubygems/core_ext/kernel_gem.rb +6 -0
- data/lib/rubygems/defaults.rb +19 -0
- data/lib/rubygems/dependency_installer.rb +28 -9
- data/lib/rubygems/doctor.rb +17 -11
- data/lib/rubygems/errors.rb +16 -3
- data/lib/rubygems/exceptions.rb +52 -5
- data/lib/rubygems/ext.rb +1 -2
- data/lib/rubygems/ext/build_error.rb +6 -0
- data/lib/rubygems/ext/builder.rb +50 -17
- data/lib/rubygems/ext/cmake_builder.rb +1 -1
- data/lib/rubygems/ext/configure_builder.rb +1 -3
- data/lib/rubygems/ext/ext_conf_builder.rb +9 -3
- data/lib/rubygems/ext/rake_builder.rb +2 -5
- data/lib/rubygems/gemcutter_utilities.rb +8 -1
- data/lib/rubygems/installer.rb +14 -4
- data/lib/rubygems/installer_test_case.rb +0 -5
- data/lib/rubygems/package.rb +11 -2
- data/lib/rubygems/psych_additions.rb +1 -1
- data/lib/rubygems/rdoc.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +3 -3
- data/lib/rubygems/request.rb +16 -8
- data/lib/rubygems/request_set.rb +133 -42
- data/lib/rubygems/request_set/gem_dependency_api.rb +493 -11
- data/lib/rubygems/request_set/lockfile.rb +579 -0
- data/lib/rubygems/requirement.rb +58 -30
- data/lib/rubygems/resolver.rb +471 -0
- data/lib/rubygems/resolver/activation_request.rb +165 -0
- data/lib/rubygems/resolver/api_set.rb +110 -0
- data/lib/rubygems/resolver/api_specification.rb +79 -0
- data/lib/rubygems/resolver/best_set.rb +31 -0
- data/lib/rubygems/resolver/composed_set.rb +39 -0
- data/lib/rubygems/resolver/conflict.rb +122 -0
- data/lib/rubygems/{dependency_resolver → resolver}/current_set.rb +1 -4
- data/lib/rubygems/{dependency_resolver → resolver}/dependency_request.rb +37 -7
- data/lib/rubygems/resolver/git_set.rb +119 -0
- data/lib/rubygems/resolver/git_specification.rb +35 -0
- data/lib/rubygems/resolver/index_set.rb +74 -0
- data/lib/rubygems/resolver/index_specification.rb +69 -0
- data/lib/rubygems/resolver/installed_specification.rb +40 -0
- data/lib/rubygems/{dependency_resolver → resolver}/installer_set.rb +18 -17
- data/lib/rubygems/resolver/local_specification.rb +16 -0
- data/lib/rubygems/resolver/lock_set.rb +78 -0
- data/lib/rubygems/resolver/lock_specification.rb +58 -0
- data/lib/rubygems/resolver/requirement_list.rb +81 -0
- data/lib/rubygems/resolver/set.rb +27 -0
- data/lib/rubygems/resolver/spec_specification.rb +58 -0
- data/lib/rubygems/resolver/specification.rb +89 -0
- data/lib/rubygems/resolver/stats.rb +44 -0
- data/lib/rubygems/resolver/vendor_set.rb +83 -0
- data/lib/rubygems/resolver/vendor_specification.rb +24 -0
- data/lib/rubygems/security/trust_dir.rb +16 -2
- data/lib/rubygems/source.rb +71 -18
- data/lib/rubygems/source/git.rb +218 -0
- data/lib/rubygems/source/installed.rb +8 -1
- data/lib/rubygems/source/local.rb +14 -8
- data/lib/rubygems/source/lock.rb +48 -0
- data/lib/rubygems/source/specific_file.rb +14 -3
- data/lib/rubygems/source/vendor.rb +27 -0
- data/lib/rubygems/source_list.rb +74 -12
- data/lib/rubygems/spec_fetcher.rb +36 -4
- data/lib/rubygems/specification.rb +214 -65
- data/lib/rubygems/stub_specification.rb +57 -1
- data/lib/rubygems/syck_hack.rb +3 -3
- data/lib/rubygems/test_case.rb +226 -59
- data/lib/rubygems/test_utilities.rb +198 -0
- data/lib/rubygems/uninstaller.rb +22 -10
- data/lib/rubygems/uri_formatter.rb +20 -0
- data/lib/rubygems/user_interaction.rb +193 -71
- data/lib/rubygems/util.rb +121 -0
- data/lib/rubygems/util/list.rb +4 -0
- data/lib/rubygems/util/stringio.rb +34 -0
- data/lib/rubygems/validator.rb +6 -2
- data/lib/rubygems/version.rb +4 -8
- data/test/rubygems/test_bundled_ca.rb +1 -1
- data/test/rubygems/test_gem.rb +137 -29
- data/test/rubygems/test_gem_available_set.rb +19 -0
- data/test/rubygems/test_gem_commands_build_command.rb +1 -1
- data/test/rubygems/test_gem_commands_cert_command.rb +2 -2
- data/test/rubygems/test_gem_commands_cleanup_command.rb +13 -13
- data/test/rubygems/test_gem_commands_dependency_command.rb +24 -34
- data/test/rubygems/test_gem_commands_fetch_command.rb +43 -48
- data/test/rubygems/test_gem_commands_install_command.rb +244 -279
- data/test/rubygems/test_gem_commands_list_command.rb +3 -3
- data/test/rubygems/test_gem_commands_outdated_command.rb +7 -12
- data/test/rubygems/test_gem_commands_pristine_command.rb +73 -27
- data/test/rubygems/test_gem_commands_push_command.rb +76 -8
- data/test/rubygems/test_gem_commands_query_command.rb +239 -49
- data/test/rubygems/test_gem_commands_sources_command.rb +10 -43
- data/test/rubygems/test_gem_commands_specification_command.rb +24 -47
- data/test/rubygems/test_gem_commands_stale_command.rb +2 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +3 -3
- data/test/rubygems/test_gem_commands_unpack_command.rb +16 -30
- data/test/rubygems/test_gem_commands_update_command.rb +149 -134
- data/test/rubygems/test_gem_commands_which_command.rb +4 -2
- data/test/rubygems/test_gem_dependency_installer.rb +68 -0
- data/test/rubygems/test_gem_dependency_list.rb +17 -17
- data/test/rubygems/test_gem_dependency_resolution_error.rb +28 -0
- data/test/rubygems/test_gem_doctor.rb +1 -1
- data/test/rubygems/test_gem_ext_builder.rb +178 -8
- data/test/rubygems/test_gem_ext_cmake_builder.rb +1 -7
- data/test/rubygems/test_gem_ext_configure_builder.rb +8 -10
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +18 -21
- data/test/rubygems/test_gem_ext_rake_builder.rb +1 -3
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +10 -6
- data/test/rubygems/test_gem_indexer.rb +6 -6
- data/test/rubygems/test_gem_installer.rb +29 -10
- data/test/rubygems/test_gem_local_remote_options.rb +1 -1
- data/test/rubygems/test_gem_package.rb +18 -0
- data/test/rubygems/test_gem_rdoc.rb +1 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
- data/test/rubygems/test_gem_request.rb +37 -10
- data/test/rubygems/test_gem_request_set.rb +271 -9
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +684 -0
- data/test/rubygems/test_gem_request_set_lockfile.rb +849 -0
- data/test/rubygems/test_gem_requirement.rb +21 -0
- data/test/rubygems/{test_gem_dependency_resolver.rb → test_gem_resolver.rb} +231 -70
- data/test/rubygems/test_gem_resolver_activation_request.rb +63 -0
- data/test/rubygems/test_gem_resolver_api_set.rb +167 -0
- data/test/rubygems/test_gem_resolver_api_specification.rb +104 -0
- data/test/rubygems/test_gem_resolver_best_set.rb +30 -0
- data/test/rubygems/test_gem_resolver_conflict.rb +75 -0
- data/test/rubygems/test_gem_resolver_dependency_request.rb +20 -0
- data/test/rubygems/test_gem_resolver_git_set.rb +148 -0
- data/test/rubygems/test_gem_resolver_git_specification.rb +100 -0
- data/test/rubygems/test_gem_resolver_index_set.rb +28 -0
- data/test/rubygems/test_gem_resolver_index_specification.rb +89 -0
- data/test/rubygems/test_gem_resolver_installed_specification.rb +49 -0
- data/test/rubygems/test_gem_resolver_installer_set.rb +22 -0
- data/test/rubygems/test_gem_resolver_local_specification.rb +45 -0
- data/test/rubygems/test_gem_resolver_lock_set.rb +57 -0
- data/test/rubygems/test_gem_resolver_lock_specification.rb +87 -0
- data/test/rubygems/test_gem_resolver_requirement_list.rb +20 -0
- data/test/rubygems/test_gem_resolver_specification.rb +32 -0
- data/test/rubygems/test_gem_resolver_vendor_set.rb +67 -0
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +83 -0
- data/test/rubygems/test_gem_server.rb +4 -4
- data/test/rubygems/test_gem_source.rb +54 -64
- data/test/rubygems/test_gem_source_git.rb +231 -0
- data/test/rubygems/test_gem_source_list.rb +24 -0
- data/test/rubygems/test_gem_source_local.rb +1 -1
- data/test/rubygems/test_gem_source_lock.rb +114 -0
- data/test/rubygems/test_gem_source_vendor.rb +27 -0
- data/test/rubygems/test_gem_spec_fetcher.rb +116 -61
- data/test/rubygems/test_gem_specification.rb +526 -94
- data/test/rubygems/test_gem_stub_specification.rb +123 -10
- data/test/rubygems/test_gem_uninstaller.rb +28 -2
- data/test/rubygems/test_gem_util.rb +31 -0
- data/test/rubygems/test_gem_validator.rb +9 -0
- data/util/update_bundled_ca_certificates.rb +8 -1
- metadata +89 -29
- metadata.gz.sig +2 -4
- data/lib/rubygems/dependency_resolver.rb +0 -254
- data/lib/rubygems/dependency_resolver/activation_request.rb +0 -109
- data/lib/rubygems/dependency_resolver/api_set.rb +0 -65
- data/lib/rubygems/dependency_resolver/api_specification.rb +0 -39
- data/lib/rubygems/dependency_resolver/composed_set.rb +0 -18
- data/lib/rubygems/dependency_resolver/dependency_conflict.rb +0 -85
- data/lib/rubygems/dependency_resolver/index_set.rb +0 -64
- data/lib/rubygems/dependency_resolver/index_specification.rb +0 -60
- data/lib/rubygems/dependency_resolver/installed_specification.rb +0 -52
- data/test/rubygems/test_gem_dependency_resolver_api_specification.rb +0 -33
- data/test/rubygems/test_gem_dependency_resolver_dependency_conflict.rb +0 -36
- data/test/rubygems/test_gem_dependency_resolver_index_set.rb +0 -53
- data/test/rubygems/test_gem_dependency_resolver_index_specification.rb +0 -73
- data/test/rubygems/test_gem_dependency_resolver_installed_specification.rb +0 -19
- data/test/rubygems/test_gem_dependency_resolver_installer_set.rb +0 -28
@@ -22,6 +22,25 @@ class TestGemAvailableSet < Gem::TestCase
|
|
22
22
|
assert_equal [a1], set.all_specs
|
23
23
|
end
|
24
24
|
|
25
|
+
def test_find_all
|
26
|
+
a1, a1_gem = util_gem 'a', 1
|
27
|
+
|
28
|
+
source = Gem::Source::SpecificFile.new a1_gem
|
29
|
+
|
30
|
+
set = Gem::AvailableSet.new
|
31
|
+
set.add a1, source
|
32
|
+
|
33
|
+
dep = Gem::Resolver::DependencyRequest.new dep('a'), nil
|
34
|
+
|
35
|
+
specs = set.find_all dep
|
36
|
+
|
37
|
+
spec = specs.first
|
38
|
+
|
39
|
+
assert_kind_of Gem::Resolver::LocalSpecification, spec
|
40
|
+
|
41
|
+
assert_equal 'a-1', spec.full_name
|
42
|
+
end
|
43
|
+
|
25
44
|
def test_match_platform
|
26
45
|
a1, _ = util_gem 'a', '1' do |g|
|
27
46
|
g.platform = "something-weird-yep"
|
@@ -108,7 +108,7 @@ Added '/CN=alternate/DC=example'
|
|
108
108
|
@cmd.execute
|
109
109
|
end
|
110
110
|
|
111
|
-
output = @build_ui.output.split "\n"
|
111
|
+
output = @build_ui.output.squeeze("\n").split "\n"
|
112
112
|
|
113
113
|
assert_equal "Passphrase for your Private Key: ",
|
114
114
|
output.shift
|
@@ -142,7 +142,7 @@ Added '/CN=alternate/DC=example'
|
|
142
142
|
@cmd.execute
|
143
143
|
end
|
144
144
|
|
145
|
-
output = @build_ui.output.split "\n"
|
145
|
+
output = @build_ui.output.squeeze("\n").split "\n"
|
146
146
|
|
147
147
|
assert_equal "Passphrase for your Private Key: ",
|
148
148
|
output.shift
|
@@ -8,8 +8,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
8
8
|
|
9
9
|
@cmd = Gem::Commands::CleanupCommand.new
|
10
10
|
|
11
|
-
@a_1 =
|
12
|
-
@a_2 =
|
11
|
+
@a_1 = util_spec 'a', 1
|
12
|
+
@a_2 = util_spec 'a', 2
|
13
13
|
|
14
14
|
install_gem @a_1
|
15
15
|
install_gem @a_2
|
@@ -39,8 +39,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_execute_all_dependencies
|
42
|
-
@b_1 =
|
43
|
-
@b_2 =
|
42
|
+
@b_1 = util_spec 'b', 1 do |s| s.add_dependency 'a', '1' end
|
43
|
+
@b_2 = util_spec 'b', 2 do |s| s.add_dependency 'a', '2' end
|
44
44
|
|
45
45
|
install_gem @b_1
|
46
46
|
install_gem @b_2
|
@@ -60,8 +60,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
60
60
|
|
61
61
|
Gem.use_paths @gemhome, gemhome2
|
62
62
|
|
63
|
-
@b_1 =
|
64
|
-
@b_2 =
|
63
|
+
@b_1 = util_spec 'b', 1
|
64
|
+
@b_2 = util_spec 'b', 2
|
65
65
|
|
66
66
|
install_gem @b_1
|
67
67
|
install_gem @b_2
|
@@ -78,7 +78,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def test_execute_all_user
|
81
|
-
@a_1_1 =
|
81
|
+
@a_1_1 = util_spec 'a', '1.1'
|
82
82
|
@a_1_1 = install_gem_user @a_1_1 # pick up user install path
|
83
83
|
|
84
84
|
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
|
@@ -97,7 +97,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
97
97
|
def test_execute_all_user_no_sudo
|
98
98
|
FileUtils.chmod 0555, @gemhome
|
99
99
|
|
100
|
-
@a_1_1 =
|
100
|
+
@a_1_1 = util_spec 'a', '1.1'
|
101
101
|
@a_1_1 = install_gem_user @a_1_1 # pick up user install path
|
102
102
|
|
103
103
|
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
|
@@ -125,10 +125,10 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def test_execute_keeps_older_versions_with_deps
|
128
|
-
@b_1 =
|
129
|
-
@b_2 =
|
128
|
+
@b_1 = util_spec 'b', 1
|
129
|
+
@b_2 = util_spec 'b', 2
|
130
130
|
|
131
|
-
@c =
|
131
|
+
@c = util_spec 'c', 1 do |s|
|
132
132
|
s.add_dependency 'b', '1'
|
133
133
|
end
|
134
134
|
|
@@ -146,9 +146,9 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
146
146
|
def test_execute_ignore_default_gem_verbose
|
147
147
|
Gem.configuration.verbose = :really
|
148
148
|
|
149
|
-
@b_1 =
|
149
|
+
@b_1 = util_spec 'b', 1
|
150
150
|
@b_default = new_default_spec "b", "2"
|
151
|
-
@b_2 =
|
151
|
+
@b_2 = util_spec 'b', 3
|
152
152
|
|
153
153
|
install_gem @b_1
|
154
154
|
install_default_specs @b_default
|
@@ -8,8 +8,6 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
|
|
8
8
|
|
9
9
|
@cmd = Gem::Commands::DependencyCommand.new
|
10
10
|
@cmd.options[:domain] = :local
|
11
|
-
|
12
|
-
util_setup_fake_fetcher true
|
13
11
|
end
|
14
12
|
|
15
13
|
def test_execute
|
@@ -30,6 +28,13 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def test_execute_no_args
|
31
|
+
spec_fetcher do |fetcher|
|
32
|
+
fetcher.spec 'a', 1
|
33
|
+
fetcher.spec 'a', '2.a'
|
34
|
+
fetcher.spec 'dep_x', 1, 'x' => '>= 1'
|
35
|
+
fetcher.legacy_platform
|
36
|
+
end
|
37
|
+
|
33
38
|
@cmd.options[:args] = []
|
34
39
|
|
35
40
|
use_ui @ui do
|
@@ -41,23 +46,11 @@ Gem a-1
|
|
41
46
|
|
42
47
|
Gem a-2.a
|
43
48
|
|
44
|
-
Gem a-2
|
45
|
-
|
46
|
-
Gem a-3.a
|
47
|
-
|
48
|
-
Gem a_evil-9
|
49
|
-
|
50
|
-
Gem b-2
|
51
|
-
|
52
|
-
Gem c-1.2
|
53
|
-
|
54
49
|
Gem dep_x-1
|
55
50
|
x (>= 1)
|
56
51
|
|
57
52
|
Gem pl-1-x86-linux
|
58
53
|
|
59
|
-
Gem x-1
|
60
|
-
|
61
54
|
EOF
|
62
55
|
|
63
56
|
assert_equal expected, @ui.output
|
@@ -78,7 +71,7 @@ Gem x-1
|
|
78
71
|
end
|
79
72
|
|
80
73
|
def test_execute_pipe_format
|
81
|
-
|
74
|
+
util_spec 'foo' do |gem|
|
82
75
|
gem.add_dependency 'bar', '> 1'
|
83
76
|
end
|
84
77
|
|
@@ -94,6 +87,13 @@ Gem x-1
|
|
94
87
|
end
|
95
88
|
|
96
89
|
def test_execute_regexp
|
90
|
+
spec_fetcher do |fetcher|
|
91
|
+
fetcher.spec 'a', 1
|
92
|
+
fetcher.spec 'a', '2.a'
|
93
|
+
fetcher.spec 'a_evil', 9
|
94
|
+
fetcher.spec 'b', 2
|
95
|
+
end
|
96
|
+
|
97
97
|
@cmd.options[:args] = %w[/[ab]/]
|
98
98
|
|
99
99
|
use_ui @ui do
|
@@ -105,10 +105,6 @@ Gem a-1
|
|
105
105
|
|
106
106
|
Gem a-2.a
|
107
107
|
|
108
|
-
Gem a-2
|
109
|
-
|
110
|
-
Gem a-3.a
|
111
|
-
|
112
108
|
Gem a_evil-9
|
113
109
|
|
114
110
|
Gem b-2
|
@@ -168,17 +164,10 @@ ERROR: Only reverse dependencies for local gems are supported.
|
|
168
164
|
end
|
169
165
|
|
170
166
|
def test_execute_remote
|
171
|
-
|
172
|
-
|
167
|
+
spec_fetcher do |fetcher|
|
168
|
+
fetcher.spec 'foo', 2, 'bar' => '> 1'
|
173
169
|
end
|
174
170
|
|
175
|
-
@fetcher = Gem::FakeFetcher.new
|
176
|
-
Gem::RemoteFetcher.fetcher = @fetcher
|
177
|
-
|
178
|
-
util_setup_spec_fetcher foo
|
179
|
-
|
180
|
-
FileUtils.rm File.join(@gemhome, 'specifications', foo.spec_name)
|
181
|
-
|
182
171
|
@cmd.options[:args] = %w[foo]
|
183
172
|
@cmd.options[:domain] = :remote
|
184
173
|
|
@@ -194,7 +183,10 @@ ERROR: Only reverse dependencies for local gems are supported.
|
|
194
183
|
@fetcher = Gem::FakeFetcher.new
|
195
184
|
Gem::RemoteFetcher.fetcher = @fetcher
|
196
185
|
|
197
|
-
|
186
|
+
spec_fetcher do |fetcher|
|
187
|
+
fetcher.spec 'a', 1
|
188
|
+
fetcher.spec 'a', 2
|
189
|
+
end
|
198
190
|
|
199
191
|
@cmd.options[:args] = %w[a]
|
200
192
|
@cmd.options[:domain] = :remote
|
@@ -209,11 +201,9 @@ ERROR: Only reverse dependencies for local gems are supported.
|
|
209
201
|
end
|
210
202
|
|
211
203
|
def test_execute_prerelease
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
util_clear_gems
|
216
|
-
util_setup_spec_fetcher @a2_pre
|
204
|
+
spec_fetcher do |fetcher|
|
205
|
+
fetcher.spec 'a', '2.a'
|
206
|
+
end
|
217
207
|
|
218
208
|
@cmd.options[:args] = %w[a]
|
219
209
|
@cmd.options[:domain] = :remote
|
@@ -12,15 +12,13 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_execute
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
19
|
-
File.read(@a2.cache_file)
|
15
|
+
specs = spec_fetcher do |fetcher|
|
16
|
+
fetcher.gem 'a', 2
|
17
|
+
end
|
20
18
|
|
21
19
|
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
|
22
20
|
|
23
|
-
@cmd.options[:args] = [
|
21
|
+
@cmd.options[:args] = %w[a]
|
24
22
|
|
25
23
|
use_ui @ui do
|
26
24
|
Dir.chdir @tempdir do
|
@@ -28,24 +26,23 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
|
32
|
-
|
29
|
+
a2 = specs['a-2']
|
30
|
+
|
31
|
+
assert_path_exists(File.join(@tempdir, a2.file_name),
|
32
|
+
"#{a2.full_name} not fetched")
|
33
33
|
refute_path_exists File.join(@tempdir, 'cache'),
|
34
34
|
'gem repository directories must not be created'
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_execute_latest
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
File.read(@a1.cache_file)
|
43
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
44
|
-
File.read(@a2.cache_file)
|
38
|
+
specs = spec_fetcher do |fetcher|
|
39
|
+
fetcher.gem 'a', 1
|
40
|
+
fetcher.gem 'a', 2
|
41
|
+
end
|
45
42
|
|
46
43
|
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
|
47
44
|
|
48
|
-
@cmd.options[:args] = [
|
45
|
+
@cmd.options[:args] = %w[a]
|
49
46
|
@cmd.options[:version] = req('>= 0.1')
|
50
47
|
|
51
48
|
use_ui @ui do
|
@@ -54,23 +51,20 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
54
51
|
end
|
55
52
|
end
|
56
53
|
|
57
|
-
|
58
|
-
|
54
|
+
a2 = specs['a-2']
|
55
|
+
assert_path_exists(File.join(@tempdir, a2.file_name),
|
56
|
+
"#{a2.full_name} not fetched")
|
59
57
|
refute_path_exists File.join(@tempdir, 'cache'),
|
60
58
|
'gem repository directories must not be created'
|
61
59
|
end
|
62
60
|
|
63
61
|
def test_execute_prerelease
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
69
|
-
File.read(@a2.cache_file)
|
70
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
71
|
-
File.read(@a2_pre.cache_file)
|
62
|
+
specs = spec_fetcher do |fetcher|
|
63
|
+
fetcher.gem 'a', 2
|
64
|
+
fetcher.gem 'a', '2.a'
|
65
|
+
end
|
72
66
|
|
73
|
-
@cmd.options[:args] = [
|
67
|
+
@cmd.options[:args] = %w[a]
|
74
68
|
@cmd.options[:prerelease] = true
|
75
69
|
|
76
70
|
use_ui @ui do
|
@@ -79,21 +73,19 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
79
73
|
end
|
80
74
|
end
|
81
75
|
|
82
|
-
|
83
|
-
|
76
|
+
a2 = specs['a-2']
|
77
|
+
|
78
|
+
assert_path_exists(File.join(@tempdir, a2.file_name),
|
79
|
+
"#{a2.full_name} not fetched")
|
84
80
|
end
|
85
81
|
|
86
82
|
def test_execute_specific_prerelease
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
92
|
-
File.read(@a2.cache_file)
|
93
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
94
|
-
File.read(@a2_pre.cache_file)
|
83
|
+
specs = spec_fetcher do |fetcher|
|
84
|
+
fetcher.gem 'a', 2
|
85
|
+
fetcher.gem 'a', '2.a'
|
86
|
+
end
|
95
87
|
|
96
|
-
@cmd.options[:args] = [
|
88
|
+
@cmd.options[:args] = %w[a]
|
97
89
|
@cmd.options[:prerelease] = true
|
98
90
|
@cmd.options[:version] = "2.a"
|
99
91
|
|
@@ -103,18 +95,19 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
103
95
|
end
|
104
96
|
end
|
105
97
|
|
106
|
-
|
107
|
-
|
98
|
+
a2_pre = specs['a-2.a']
|
99
|
+
|
100
|
+
assert_path_exists(File.join(@tempdir, a2_pre.file_name),
|
101
|
+
"#{a2_pre.full_name} not fetched")
|
108
102
|
end
|
109
103
|
|
110
104
|
def test_execute_version
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
File.read(@a1.cache_file)
|
105
|
+
specs = spec_fetcher do |fetcher|
|
106
|
+
fetcher.gem 'a', 1
|
107
|
+
fetcher.gem 'a', 2
|
108
|
+
end
|
116
109
|
|
117
|
-
@cmd.options[:args] = [
|
110
|
+
@cmd.options[:args] = %w[a]
|
118
111
|
@cmd.options[:version] = Gem::Requirement.new '1'
|
119
112
|
|
120
113
|
use_ui @ui do
|
@@ -123,8 +116,10 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
123
116
|
end
|
124
117
|
end
|
125
118
|
|
126
|
-
|
127
|
-
|
119
|
+
a1 = specs['a-1']
|
120
|
+
|
121
|
+
assert_path_exists(File.join(@tempdir, a1.file_name),
|
122
|
+
"#{a1.full_name} not fetched")
|
128
123
|
end
|
129
124
|
|
130
125
|
end
|
@@ -13,76 +13,76 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
13
13
|
|
14
14
|
@gemdeps = "tmp_install_gemdeps"
|
15
15
|
@orig_args = Gem::Command.build_args
|
16
|
+
|
17
|
+
common_installer_setup
|
16
18
|
end
|
17
19
|
|
18
20
|
def teardown
|
19
21
|
super
|
20
22
|
|
23
|
+
common_installer_teardown
|
24
|
+
|
21
25
|
Gem::Command.build_args = @orig_args
|
22
26
|
File.unlink @gemdeps if File.file? @gemdeps
|
23
27
|
end
|
24
28
|
|
25
29
|
def test_execute_exclude_prerelease
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
read_binary(@a2.cache_file)
|
31
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
32
|
-
read_binary(@a2_pre.cache_file)
|
30
|
+
spec_fetcher do |fetcher|
|
31
|
+
fetcher.gem 'a', 2
|
32
|
+
fetcher.gem 'a', '2.pre'
|
33
|
+
end
|
33
34
|
|
34
|
-
@cmd.options[:args] = [
|
35
|
+
@cmd.options[:args] = %w[a]
|
35
36
|
|
36
37
|
use_ui @ui do
|
37
|
-
|
38
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
38
39
|
@cmd.execute
|
39
40
|
end
|
40
|
-
assert_equal 0, e.exit_code, @ui.error
|
41
41
|
end
|
42
42
|
|
43
43
|
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_execute_explicit_version_includes_prerelease
|
47
|
-
|
48
|
-
|
47
|
+
specs = spec_fetcher do |fetcher|
|
48
|
+
fetcher.gem 'a', 2
|
49
|
+
fetcher.gem 'a', '2.a'
|
50
|
+
end
|
49
51
|
|
50
|
-
|
51
|
-
read_binary(@a2.cache_file)
|
52
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
53
|
-
read_binary(@a2_pre.cache_file)
|
52
|
+
a2_pre = specs['a-2.a']
|
54
53
|
|
55
|
-
@cmd.handle_options [
|
54
|
+
@cmd.handle_options [a2_pre.name, '--version', a2_pre.version.to_s,
|
56
55
|
"--no-ri", "--no-rdoc"]
|
57
56
|
assert @cmd.options[:prerelease]
|
58
|
-
assert @cmd.options[:version].satisfied_by?(
|
57
|
+
assert @cmd.options[:version].satisfied_by?(a2_pre.version)
|
59
58
|
|
60
59
|
use_ui @ui do
|
61
|
-
|
60
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
62
61
|
@cmd.execute
|
63
62
|
end
|
64
|
-
assert_equal 0, e.exit_code, @ui.error
|
65
63
|
end
|
66
64
|
|
67
65
|
assert_equal %w[a-2.a], @cmd.installed_specs.map { |spec| spec.full_name }
|
68
66
|
end
|
69
67
|
|
70
68
|
def test_execute_local
|
71
|
-
|
69
|
+
specs = spec_fetcher do |fetcher|
|
70
|
+
fetcher.gem 'a', 2
|
71
|
+
end
|
72
|
+
|
72
73
|
@cmd.options[:domain] = :local
|
73
74
|
|
74
|
-
FileUtils.mv
|
75
|
+
FileUtils.mv specs['a-2'].cache_file, @tempdir
|
75
76
|
|
76
|
-
@cmd.options[:args] = [
|
77
|
+
@cmd.options[:args] = %w[a]
|
77
78
|
|
78
79
|
use_ui @ui do
|
79
80
|
orig_dir = Dir.pwd
|
80
81
|
begin
|
81
82
|
Dir.chdir @tempdir
|
82
|
-
|
83
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
83
84
|
@cmd.execute
|
84
85
|
end
|
85
|
-
assert_equal 0, e.exit_code
|
86
86
|
ensure
|
87
87
|
Dir.chdir orig_dir
|
88
88
|
end
|
@@ -90,20 +90,21 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
90
90
|
|
91
91
|
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
92
92
|
|
93
|
-
|
94
|
-
assert_equal "1 gem installed", out.shift
|
95
|
-
assert out.empty?, out.inspect
|
93
|
+
assert_match "1 gem installed", @ui.output
|
96
94
|
end
|
97
95
|
|
98
96
|
def test_execute_no_user_install
|
99
97
|
skip 'skipped on MS Windows (chmod has no effect)' if win_platform?
|
100
98
|
|
101
|
-
|
99
|
+
specs = spec_fetcher do |fetcher|
|
100
|
+
fetcher.gem 'a', 2
|
101
|
+
end
|
102
|
+
|
102
103
|
@cmd.options[:user_install] = false
|
103
104
|
|
104
|
-
FileUtils.mv
|
105
|
+
FileUtils.mv specs['a-2'].cache_file, @tempdir
|
105
106
|
|
106
|
-
@cmd.options[:args] = [
|
107
|
+
@cmd.options[:args] = %w[a]
|
107
108
|
|
108
109
|
use_ui @ui do
|
109
110
|
orig_dir = Dir.pwd
|
@@ -123,13 +124,14 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
123
124
|
end
|
124
125
|
|
125
126
|
def test_execute_local_missing
|
126
|
-
|
127
|
+
spec_fetcher
|
128
|
+
|
127
129
|
@cmd.options[:domain] = :local
|
128
130
|
|
129
131
|
@cmd.options[:args] = %w[no_such_gem]
|
130
132
|
|
131
133
|
use_ui @ui do
|
132
|
-
e = assert_raises Gem::
|
134
|
+
e = assert_raises Gem::MockGemUi::TermError do
|
133
135
|
@cmd.execute
|
134
136
|
end
|
135
137
|
assert_equal 2, e.exit_code
|
@@ -148,13 +150,12 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
148
150
|
end
|
149
151
|
|
150
152
|
def test_execute_nonexistent
|
151
|
-
|
152
|
-
util_setup_spec_fetcher
|
153
|
+
spec_fetcher
|
153
154
|
|
154
155
|
@cmd.options[:args] = %w[nonexistent]
|
155
156
|
|
156
157
|
use_ui @ui do
|
157
|
-
e = assert_raises Gem::
|
158
|
+
e = assert_raises Gem::MockGemUi::TermError do
|
158
159
|
@cmd.execute
|
159
160
|
end
|
160
161
|
assert_equal 2, e.exit_code
|
@@ -164,8 +165,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
164
165
|
end
|
165
166
|
|
166
167
|
def test_execute_bad_source
|
167
|
-
|
168
|
-
util_setup_spec_fetcher
|
168
|
+
spec_fetcher
|
169
169
|
|
170
170
|
# This is needed because we need to exercise the cache path
|
171
171
|
# within SpecFetcher
|
@@ -182,7 +182,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
182
182
|
@cmd.options[:args] = %w[nonexistent]
|
183
183
|
|
184
184
|
use_ui @ui do
|
185
|
-
e = assert_raises Gem::
|
185
|
+
e = assert_raises Gem::MockGemUi::TermError do
|
186
186
|
@cmd.execute
|
187
187
|
end
|
188
188
|
assert_equal 2, e.exit_code
|
@@ -198,13 +198,14 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
198
198
|
misspelled = "nonexistent_with_hint"
|
199
199
|
correctly_spelled = "non_existent_with_hint"
|
200
200
|
|
201
|
-
|
202
|
-
|
201
|
+
spec_fetcher do |fetcher|
|
202
|
+
fetcher.spec correctly_spelled, 2
|
203
|
+
end
|
203
204
|
|
204
205
|
@cmd.options[:args] = [misspelled]
|
205
206
|
|
206
207
|
use_ui @ui do
|
207
|
-
e = assert_raises Gem::
|
208
|
+
e = assert_raises Gem::MockGemUi::TermError do
|
208
209
|
@cmd.execute
|
209
210
|
end
|
210
211
|
|
@@ -222,13 +223,15 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
222
223
|
misspelled = "non-existent_with-hint"
|
223
224
|
correctly_spelled = "nonexistent-with_hint"
|
224
225
|
|
225
|
-
|
226
|
-
|
226
|
+
spec_fetcher do |fetcher|
|
227
|
+
fetcher.spec correctly_spelled, 2
|
228
|
+
fetcher.clear
|
229
|
+
end
|
227
230
|
|
228
231
|
@cmd.options[:args] = [misspelled]
|
229
232
|
|
230
233
|
use_ui @ui do
|
231
|
-
e = assert_raises Gem::
|
234
|
+
e = assert_raises Gem::MockGemUi::TermError do
|
232
235
|
@cmd.execute
|
233
236
|
end
|
234
237
|
|
@@ -258,85 +261,74 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
258
261
|
end
|
259
262
|
|
260
263
|
def test_execute_prerelease_skipped_when_no_flag_set
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
@fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
|
266
|
-
read_binary(@a1.cache_file)
|
267
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
268
|
-
read_binary(@a2_pre.cache_file)
|
264
|
+
spec_fetcher do |fetcher|
|
265
|
+
fetcher.gem 'a', 1
|
266
|
+
fetcher.gem 'a', '3.a'
|
267
|
+
end
|
269
268
|
|
270
269
|
@cmd.options[:prerelease] = false
|
271
|
-
@cmd.options[:args] = [
|
270
|
+
@cmd.options[:args] = %w[a]
|
272
271
|
|
273
272
|
use_ui @ui do
|
274
|
-
|
273
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
275
274
|
@cmd.execute
|
276
275
|
end
|
277
|
-
assert_equal 0, e.exit_code, @ui.error
|
278
276
|
end
|
279
277
|
|
280
278
|
assert_equal %w[a-1], @cmd.installed_specs.map { |spec| spec.full_name }
|
281
279
|
end
|
282
280
|
|
283
281
|
def test_execute_prerelease_wins_over_previous_ver
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
read_binary(@a1.cache_file)
|
290
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
291
|
-
read_binary(@a2_pre.cache_file)
|
282
|
+
spec_fetcher do |fetcher|
|
283
|
+
fetcher.gem 'a', 1
|
284
|
+
fetcher.gem 'a', '2.a'
|
285
|
+
fetcher.clear
|
286
|
+
end
|
292
287
|
|
293
288
|
@cmd.options[:prerelease] = true
|
294
|
-
@cmd.options[:args] = [
|
289
|
+
@cmd.options[:args] = %w[a]
|
295
290
|
|
296
291
|
use_ui @ui do
|
297
|
-
|
292
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
298
293
|
@cmd.execute
|
299
294
|
end
|
300
|
-
assert_equal 0, e.exit_code, @ui.error
|
301
295
|
end
|
302
296
|
|
303
297
|
assert_equal %w[a-2.a], @cmd.installed_specs.map { |spec| spec.full_name }
|
304
298
|
end
|
305
299
|
|
306
300
|
def test_execute_prerelease_skipped_when_non_pre_available
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
312
|
-
read_binary(@a2.cache_file)
|
313
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
|
314
|
-
read_binary(@a2_pre.cache_file)
|
301
|
+
spec_fetcher do |fetcher|
|
302
|
+
fetcher.gem 'a', '2.pre'
|
303
|
+
fetcher.gem 'a', 2
|
304
|
+
end
|
315
305
|
|
316
306
|
@cmd.options[:prerelease] = true
|
317
|
-
@cmd.options[:args] = [
|
307
|
+
@cmd.options[:args] = %w[a]
|
318
308
|
|
319
309
|
use_ui @ui do
|
320
|
-
|
310
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
321
311
|
@cmd.execute
|
322
312
|
end
|
323
|
-
assert_equal 0, e.exit_code, @ui.error
|
324
313
|
end
|
325
314
|
|
326
315
|
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
327
316
|
end
|
328
317
|
|
329
318
|
def test_execute_rdoc
|
330
|
-
|
319
|
+
specs = spec_fetcher do |fetcher|
|
320
|
+
fetcher.gem 'a', 2
|
321
|
+
end
|
331
322
|
|
332
323
|
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
333
324
|
|
334
325
|
@cmd.options[:document] = %w[rdoc ri]
|
335
326
|
@cmd.options[:domain] = :local
|
336
327
|
|
337
|
-
|
328
|
+
a2 = specs['a-2']
|
329
|
+
FileUtils.mv a2.cache_file, @tempdir
|
338
330
|
|
339
|
-
@cmd.options[:args] = [
|
331
|
+
@cmd.options[:args] = %w[a]
|
340
332
|
|
341
333
|
use_ui @ui do
|
342
334
|
# Don't use Dir.chdir with a block, it warnings a lot because
|
@@ -345,34 +337,35 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
345
337
|
|
346
338
|
begin
|
347
339
|
Dir.chdir @tempdir
|
348
|
-
|
340
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
349
341
|
@cmd.execute
|
350
342
|
end
|
351
343
|
ensure
|
352
344
|
Dir.chdir old
|
353
345
|
end
|
354
|
-
|
355
|
-
assert_equal 0, e.exit_code
|
356
346
|
end
|
357
347
|
|
358
348
|
wait_for_child_process_to_exit
|
359
349
|
|
360
|
-
assert_path_exists File.join(
|
361
|
-
assert_path_exists File.join(
|
350
|
+
assert_path_exists File.join(a2.doc_dir, 'ri')
|
351
|
+
assert_path_exists File.join(a2.doc_dir, 'rdoc')
|
362
352
|
end
|
363
353
|
|
364
354
|
def test_execute_saves_build_args
|
365
|
-
|
355
|
+
specs = spec_fetcher do |fetcher|
|
356
|
+
fetcher.gem 'a', 2
|
357
|
+
end
|
366
358
|
|
367
359
|
args = %w!--with-awesome=true --more-awesome=yes!
|
368
360
|
|
369
361
|
Gem::Command.build_args = args
|
370
362
|
|
371
|
-
|
363
|
+
a2 = specs['a-2']
|
364
|
+
FileUtils.mv a2.cache_file, @tempdir
|
372
365
|
|
373
|
-
|
366
|
+
@cmd.options[:domain] = :local
|
374
367
|
|
375
|
-
@cmd.options[:args] = [
|
368
|
+
@cmd.options[:args] = %w[a]
|
376
369
|
|
377
370
|
use_ui @ui do
|
378
371
|
# Don't use Dir.chdir with a block, it warnings a lot because
|
@@ -381,60 +374,56 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
381
374
|
|
382
375
|
begin
|
383
376
|
Dir.chdir @tempdir
|
384
|
-
|
377
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
385
378
|
@cmd.execute
|
386
379
|
end
|
387
380
|
ensure
|
388
381
|
Dir.chdir old
|
389
382
|
end
|
390
|
-
|
391
|
-
assert_equal 0, e.exit_code
|
392
383
|
end
|
393
384
|
|
394
|
-
path =
|
385
|
+
path = a2.build_info_file
|
395
386
|
assert_path_exists path
|
396
387
|
|
397
|
-
assert_equal args,
|
388
|
+
assert_equal args, a2.build_args
|
398
389
|
end
|
399
390
|
|
400
391
|
|
401
392
|
def test_execute_remote
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
406
|
-
read_binary(@a2.cache_file)
|
393
|
+
spec_fetcher do |fetcher|
|
394
|
+
fetcher.gem 'a', 2
|
395
|
+
end
|
407
396
|
|
408
|
-
@cmd.options[:args] = [
|
397
|
+
@cmd.options[:args] = %w[a]
|
409
398
|
|
410
399
|
use_ui @ui do
|
411
|
-
|
412
|
-
|
413
|
-
@cmd.execute
|
414
|
-
end
|
400
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
401
|
+
@cmd.execute
|
415
402
|
end
|
416
|
-
assert_equal 0, e.exit_code
|
417
403
|
end
|
418
404
|
|
419
405
|
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
420
406
|
|
421
|
-
|
422
|
-
assert_equal "1 gem installed", out.shift
|
423
|
-
assert out.empty?, out.inspect
|
407
|
+
assert_match "1 gem installed", @ui.output
|
424
408
|
end
|
425
409
|
|
426
410
|
def test_execute_remote_ignores_files
|
427
|
-
|
428
|
-
|
411
|
+
specs = spec_fetcher do |fetcher|
|
412
|
+
fetcher.gem 'a', 1
|
413
|
+
fetcher.gem 'a', 2
|
414
|
+
end
|
429
415
|
|
430
416
|
@cmd.options[:domain] = :remote
|
431
417
|
|
432
|
-
|
418
|
+
a1 = specs['a-1']
|
419
|
+
a2 = specs['a-2']
|
433
420
|
|
434
|
-
|
435
|
-
read_binary(@a1.cache_file)
|
421
|
+
FileUtils.mv a2.cache_file, @tempdir
|
436
422
|
|
437
|
-
@
|
423
|
+
@fetcher.data["#{@gem_repo}gems/#{a2.file_name}"] =
|
424
|
+
read_binary(a1.cache_file)
|
425
|
+
|
426
|
+
@cmd.options[:args] = [a2.name]
|
438
427
|
|
439
428
|
gemdir = File.join @gemhome, 'specifications'
|
440
429
|
|
@@ -448,18 +437,15 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
448
437
|
|
449
438
|
use_ui @ui do
|
450
439
|
Dir.chdir @tempdir do
|
451
|
-
|
440
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
452
441
|
@cmd.execute
|
453
442
|
end
|
454
|
-
assert_equal 0, e.exit_code
|
455
443
|
end
|
456
444
|
end
|
457
445
|
|
458
446
|
assert_equal %w[a-1], @cmd.installed_specs.map { |spec| spec.full_name }
|
459
447
|
|
460
|
-
|
461
|
-
assert_equal "1 gem installed", out.shift
|
462
|
-
assert out.empty?, out.inspect
|
448
|
+
assert_match "1 gem installed", @ui.output
|
463
449
|
|
464
450
|
fin = Dir["#{gemdir}/*"]
|
465
451
|
|
@@ -467,23 +453,25 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
467
453
|
end
|
468
454
|
|
469
455
|
def test_execute_two
|
470
|
-
|
471
|
-
|
456
|
+
specs = spec_fetcher do |fetcher|
|
457
|
+
fetcher.gem 'a', 2
|
458
|
+
fetcher.gem 'b', 2
|
459
|
+
end
|
472
460
|
|
473
|
-
FileUtils.mv
|
461
|
+
FileUtils.mv specs['a-2'].cache_file, @tempdir
|
462
|
+
FileUtils.mv specs['b-2'].cache_file, @tempdir
|
474
463
|
|
475
|
-
|
464
|
+
@cmd.options[:domain] = :local
|
476
465
|
|
477
|
-
@cmd.options[:args] = [
|
466
|
+
@cmd.options[:args] = %w[a b]
|
478
467
|
|
479
468
|
use_ui @ui do
|
480
469
|
orig_dir = Dir.pwd
|
481
470
|
begin
|
482
471
|
Dir.chdir @tempdir
|
483
|
-
|
472
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
484
473
|
@cmd.execute
|
485
474
|
end
|
486
|
-
assert_equal 0, e.exit_code
|
487
475
|
ensure
|
488
476
|
Dir.chdir orig_dir
|
489
477
|
end
|
@@ -491,9 +479,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
491
479
|
|
492
480
|
assert_equal %w[a-2 b-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
493
481
|
|
494
|
-
|
495
|
-
assert_equal "2 gems installed", out.shift
|
496
|
-
assert out.empty?, out.inspect
|
482
|
+
assert_match "2 gems installed", @ui.output
|
497
483
|
end
|
498
484
|
|
499
485
|
def test_execute_two_version
|
@@ -517,23 +503,23 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
517
503
|
end
|
518
504
|
|
519
505
|
def test_execute_conservative
|
520
|
-
|
521
|
-
|
506
|
+
spec_fetcher do |fetcher|
|
507
|
+
fetcher.gem 'b', 2
|
522
508
|
|
523
|
-
|
524
|
-
read_binary(@b2.cache_file)
|
509
|
+
fetcher.clear
|
525
510
|
|
526
|
-
|
511
|
+
fetcher.gem 'a', 2
|
512
|
+
end
|
527
513
|
|
528
514
|
@cmd.options[:conservative] = true
|
529
515
|
|
530
|
-
@cmd.options[:args] = [
|
516
|
+
@cmd.options[:args] = %w[a b]
|
531
517
|
|
532
518
|
use_ui @ui do
|
533
519
|
orig_dir = Dir.pwd
|
534
520
|
begin
|
535
521
|
Dir.chdir @tempdir
|
536
|
-
assert_raises Gem::SystemExitException do
|
522
|
+
assert_raises Gem::MockGemUi::SystemExitException do
|
537
523
|
@cmd.execute
|
538
524
|
end
|
539
525
|
ensure
|
@@ -543,21 +529,19 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
543
529
|
|
544
530
|
assert_equal %w[b-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
545
531
|
|
546
|
-
out = @ui.output.split "\n"
|
547
532
|
assert_equal "", @ui.error
|
548
|
-
|
549
|
-
assert out.empty?, out.inspect
|
533
|
+
assert_match "1 gem installed", @ui.output
|
550
534
|
end
|
551
535
|
|
552
536
|
def test_parses_requirement_from_gemname
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
537
|
+
spec_fetcher do |fetcher|
|
538
|
+
fetcher.gem 'a', 2
|
539
|
+
fetcher.gem 'b', 2
|
540
|
+
end
|
557
541
|
|
558
|
-
|
542
|
+
@cmd.options[:domain] = :local
|
559
543
|
|
560
|
-
req = "
|
544
|
+
req = "a:10.0"
|
561
545
|
|
562
546
|
@cmd.options[:args] = [req]
|
563
547
|
|
@@ -566,7 +550,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
566
550
|
orig_dir = Dir.pwd
|
567
551
|
begin
|
568
552
|
Dir.chdir @tempdir
|
569
|
-
e = assert_raises Gem::
|
553
|
+
e = assert_raises Gem::MockGemUi::TermError do
|
570
554
|
@cmd.execute
|
571
555
|
end
|
572
556
|
ensure
|
@@ -588,7 +572,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
588
572
|
orig_dir = Dir.pwd
|
589
573
|
begin
|
590
574
|
Dir.chdir @tempdir
|
591
|
-
e = assert_raises Gem::
|
575
|
+
e = assert_raises Gem::MockGemUi::TermError do
|
592
576
|
@cmd.execute
|
593
577
|
end
|
594
578
|
ensure
|
@@ -602,30 +586,24 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
602
586
|
end
|
603
587
|
|
604
588
|
def test_show_source_problems_even_on_success
|
605
|
-
|
606
|
-
|
589
|
+
spec_fetcher do |fetcher|
|
590
|
+
fetcher.gem 'a', 2
|
591
|
+
fetcher.clear
|
592
|
+
end
|
607
593
|
|
608
594
|
Gem.sources << "http://nonexistent.example"
|
609
595
|
|
610
|
-
@
|
611
|
-
read_binary(@a2.cache_file)
|
612
|
-
|
613
|
-
@cmd.options[:args] = [@a2.name]
|
596
|
+
@cmd.options[:args] = %w[a]
|
614
597
|
|
615
598
|
use_ui @ui do
|
616
|
-
|
617
|
-
|
618
|
-
@cmd.execute
|
619
|
-
end
|
599
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
600
|
+
@cmd.execute
|
620
601
|
end
|
621
|
-
assert_equal 0, e.exit_code
|
622
602
|
end
|
623
603
|
|
624
604
|
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
625
605
|
|
626
|
-
|
627
|
-
assert_equal "1 gem installed", out.shift
|
628
|
-
assert out.empty?, out.inspect
|
606
|
+
assert_match "1 gem installed", @ui.output
|
629
607
|
|
630
608
|
e = @ui.error
|
631
609
|
|
@@ -634,11 +612,9 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
634
612
|
end
|
635
613
|
|
636
614
|
def test_execute_uses_from_a_gemdeps
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
641
|
-
read_binary(@a2.cache_file)
|
615
|
+
spec_fetcher do |fetcher|
|
616
|
+
fetcher.gem 'a', 2
|
617
|
+
end
|
642
618
|
|
643
619
|
File.open @gemdeps, "w" do |f|
|
644
620
|
f << "gem 'a'"
|
@@ -647,28 +623,21 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
647
623
|
@cmd.options[:gemdeps] = @gemdeps
|
648
624
|
|
649
625
|
use_ui @ui do
|
650
|
-
|
651
|
-
|
652
|
-
@cmd.execute
|
653
|
-
end
|
626
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
627
|
+
@cmd.execute
|
654
628
|
end
|
655
|
-
assert_equal 0, e.exit_code
|
656
629
|
end
|
657
630
|
|
658
631
|
assert_equal %w[], @cmd.installed_specs.map { |spec| spec.full_name }
|
659
632
|
|
660
|
-
|
661
|
-
assert_equal "Using a (2)", out.shift
|
662
|
-
assert out.empty?, out.inspect
|
633
|
+
assert_match "Using a (2)", @ui.output
|
663
634
|
end
|
664
635
|
|
665
636
|
def test_execute_installs_from_a_gemdeps
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
671
|
-
read_binary(@a2.cache_file)
|
637
|
+
spec_fetcher do |fetcher|
|
638
|
+
fetcher.gem 'a', 2
|
639
|
+
fetcher.clear
|
640
|
+
end
|
672
641
|
|
673
642
|
File.open @gemdeps, "w" do |f|
|
674
643
|
f << "gem 'a'"
|
@@ -677,31 +646,22 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
677
646
|
@cmd.options[:gemdeps] = @gemdeps
|
678
647
|
|
679
648
|
use_ui @ui do
|
680
|
-
|
681
|
-
|
682
|
-
@cmd.execute
|
683
|
-
end
|
649
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
650
|
+
@cmd.execute
|
684
651
|
end
|
685
|
-
assert_equal 0, e.exit_code
|
686
652
|
end
|
687
653
|
|
688
654
|
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
|
689
655
|
|
690
|
-
|
691
|
-
assert_equal "Installing a (2)", out.shift
|
692
|
-
assert out.empty?, out.inspect
|
656
|
+
assert_match "Installing a (2)", @ui.output
|
693
657
|
end
|
694
658
|
|
695
659
|
def test_execute_installs_deps_a_gemdeps
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
util_clear_gems
|
702
|
-
|
703
|
-
add_to_fetcher q, q_gem
|
704
|
-
add_to_fetcher r, r_gem
|
660
|
+
spec_fetcher do |fetcher|
|
661
|
+
fetcher.gem 'q', '1.0'
|
662
|
+
fetcher.gem 'r', '2.0', 'q' => nil
|
663
|
+
fetcher.clear
|
664
|
+
end
|
705
665
|
|
706
666
|
File.open @gemdeps, "w" do |f|
|
707
667
|
f << "gem 'r'"
|
@@ -710,35 +670,27 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
710
670
|
@cmd.options[:gemdeps] = @gemdeps
|
711
671
|
|
712
672
|
use_ui @ui do
|
713
|
-
|
714
|
-
|
715
|
-
@cmd.execute
|
716
|
-
end
|
673
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
674
|
+
@cmd.execute
|
717
675
|
end
|
718
|
-
assert_equal 0, e.exit_code
|
719
676
|
end
|
720
677
|
|
721
678
|
names = @cmd.installed_specs.map { |spec| spec.full_name }
|
722
679
|
|
723
680
|
assert_equal %w[q-1.0 r-2.0], names
|
724
681
|
|
725
|
-
|
726
|
-
|
727
|
-
assert_equal "Installing r (2.0)", out.shift
|
728
|
-
assert out.empty?, out.inspect
|
682
|
+
assert_match "Installing q (1.0)", @ui.output
|
683
|
+
assert_match "Installing r (2.0)", @ui.output
|
729
684
|
end
|
730
685
|
|
731
686
|
def test_execute_uses_deps_a_gemdeps
|
732
|
-
|
733
|
-
|
687
|
+
spec_fetcher do |fetcher|
|
688
|
+
fetcher.gem 'r', '2.0', 'q' => nil
|
734
689
|
|
735
|
-
|
736
|
-
util_setup_spec_fetcher q, r
|
737
|
-
util_clear_gems
|
690
|
+
fetcher.clear
|
738
691
|
|
739
|
-
|
740
|
-
|
741
|
-
Gem::Specification.add_specs q
|
692
|
+
fetcher.spec 'q', '1.0'
|
693
|
+
end
|
742
694
|
|
743
695
|
File.open @gemdeps, "w" do |f|
|
744
696
|
f << "gem 'r'"
|
@@ -747,34 +699,25 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
747
699
|
@cmd.options[:gemdeps] = @gemdeps
|
748
700
|
|
749
701
|
use_ui @ui do
|
750
|
-
|
751
|
-
|
752
|
-
@cmd.execute
|
753
|
-
end
|
702
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
703
|
+
@cmd.execute
|
754
704
|
end
|
755
|
-
assert_equal 0, e.exit_code
|
756
705
|
end
|
757
706
|
|
758
707
|
names = @cmd.installed_specs.map { |spec| spec.full_name }
|
759
708
|
|
760
709
|
assert_equal %w[r-2.0], names
|
761
710
|
|
762
|
-
|
763
|
-
|
764
|
-
assert_equal "Installing r (2.0)", out.shift
|
765
|
-
assert out.empty?, out.inspect
|
711
|
+
assert_match "Using q (1.0)", @ui.output
|
712
|
+
assert_match "Installing r (2.0)", @ui.output
|
766
713
|
end
|
767
714
|
|
768
715
|
def test_execute_installs_deps_a_gemdeps_into_a_path
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
util_clear_gems
|
775
|
-
|
776
|
-
add_to_fetcher q, q_gem
|
777
|
-
add_to_fetcher r, r_gem
|
716
|
+
spec_fetcher do |fetcher|
|
717
|
+
fetcher.gem 'q', '1.0'
|
718
|
+
fetcher.gem 'r', '2.0', 'q' => nil
|
719
|
+
fetcher.clear
|
720
|
+
end
|
778
721
|
|
779
722
|
File.open @gemdeps, "w" do |f|
|
780
723
|
f << "gem 'r'"
|
@@ -784,39 +727,30 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
784
727
|
@cmd.options[:gemdeps] = @gemdeps
|
785
728
|
|
786
729
|
use_ui @ui do
|
787
|
-
|
788
|
-
|
789
|
-
@cmd.execute
|
790
|
-
end
|
730
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
731
|
+
@cmd.execute
|
791
732
|
end
|
792
|
-
assert_equal 0, e.exit_code
|
793
733
|
end
|
794
734
|
|
795
735
|
names = @cmd.installed_specs.map { |spec| spec.full_name }
|
796
736
|
|
797
737
|
assert_equal %w[q-1.0 r-2.0], names
|
798
738
|
|
799
|
-
|
800
|
-
|
801
|
-
assert_equal "Installing r (2.0)", out.shift
|
802
|
-
assert out.empty?, out.inspect
|
739
|
+
assert_match "Installing q (1.0)", @ui.output
|
740
|
+
assert_match "Installing r (2.0)", @ui.output
|
803
741
|
|
804
742
|
assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
|
805
743
|
assert File.file?("gf-path/specifications/r-2.0.gemspec"), "not installed"
|
806
744
|
end
|
807
745
|
|
808
746
|
def test_execute_with_gemdeps_path_ignores_system
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
util_clear_gems
|
815
|
-
|
816
|
-
add_to_fetcher q, q_gem
|
817
|
-
add_to_fetcher r, r_gem
|
747
|
+
specs = spec_fetcher do |fetcher|
|
748
|
+
fetcher.gem 'q', '1.0'
|
749
|
+
fetcher.gem 'r', '2.0', 'q' => nil
|
750
|
+
fetcher.clear
|
751
|
+
end
|
818
752
|
|
819
|
-
Gem::Specification.add_specs q
|
753
|
+
Gem::Specification.add_specs specs['q-1.0']
|
820
754
|
|
821
755
|
File.open @gemdeps, "w" do |f|
|
822
756
|
f << "gem 'r'"
|
@@ -826,38 +760,29 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
826
760
|
@cmd.options[:gemdeps] = @gemdeps
|
827
761
|
|
828
762
|
use_ui @ui do
|
829
|
-
|
830
|
-
|
831
|
-
@cmd.execute
|
832
|
-
end
|
763
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
764
|
+
@cmd.execute
|
833
765
|
end
|
834
|
-
assert_equal 0, e.exit_code
|
835
766
|
end
|
836
767
|
|
837
768
|
names = @cmd.installed_specs.map { |spec| spec.full_name }
|
838
769
|
|
839
770
|
assert_equal %w[q-1.0 r-2.0], names
|
840
771
|
|
841
|
-
|
842
|
-
|
843
|
-
assert_equal "Installing r (2.0)", out.shift
|
844
|
-
assert out.empty?, out.inspect
|
772
|
+
assert_match "Installing q (1.0)", @ui.output
|
773
|
+
assert_match "Installing r (2.0)", @ui.output
|
845
774
|
|
846
775
|
assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
|
847
776
|
assert File.file?("gf-path/specifications/r-2.0.gemspec"), "not installed"
|
848
777
|
end
|
849
778
|
|
850
779
|
def test_execute_uses_deps_a_gemdeps_with_a_path
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
util_setup_spec_fetcher q, r
|
856
|
-
util_clear_gems
|
857
|
-
|
858
|
-
add_to_fetcher r, r_gem
|
780
|
+
specs = spec_fetcher do |fetcher|
|
781
|
+
fetcher.gem 'q', '1.0'
|
782
|
+
fetcher.gem 'r', '2.0', 'q' => nil
|
783
|
+
end
|
859
784
|
|
860
|
-
i = Gem::Installer.new
|
785
|
+
i = Gem::Installer.new specs['q-1.0'].cache_file, :install_dir => "gf-path"
|
861
786
|
i.install
|
862
787
|
|
863
788
|
assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
|
@@ -870,23 +795,63 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
870
795
|
@cmd.options[:gemdeps] = @gemdeps
|
871
796
|
|
872
797
|
use_ui @ui do
|
873
|
-
|
874
|
-
|
875
|
-
@cmd.execute
|
876
|
-
end
|
798
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
799
|
+
@cmd.execute
|
877
800
|
end
|
878
|
-
assert_equal 0, e.exit_code
|
879
801
|
end
|
880
802
|
|
881
803
|
names = @cmd.installed_specs.map { |spec| spec.full_name }
|
882
804
|
|
883
805
|
assert_equal %w[r-2.0], names
|
884
806
|
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
807
|
+
assert_match "Using q (1.0)", @ui.output
|
808
|
+
assert_match "Installing r (2.0)", @ui.output
|
809
|
+
end
|
810
|
+
|
811
|
+
def test_handle_options_file
|
812
|
+
FileUtils.touch 'Gemfile'
|
813
|
+
|
814
|
+
@cmd.handle_options %w[-g Gemfile]
|
815
|
+
|
816
|
+
assert_equal 'Gemfile', @cmd.options[:gemdeps]
|
817
|
+
|
818
|
+
FileUtils.rm 'Gemfile'
|
819
|
+
|
820
|
+
FileUtils.touch 'gem.deps.rb'
|
821
|
+
|
822
|
+
@cmd.handle_options %w[--file gem.deps.rb]
|
823
|
+
|
824
|
+
assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
|
825
|
+
|
826
|
+
FileUtils.rm 'gem.deps.rb'
|
827
|
+
|
828
|
+
FileUtils.touch 'Isolate'
|
829
|
+
|
830
|
+
@cmd.handle_options %w[-g]
|
831
|
+
|
832
|
+
assert_equal 'Isolate', @cmd.options[:gemdeps]
|
833
|
+
|
834
|
+
FileUtils.touch 'Gemfile'
|
835
|
+
|
836
|
+
@cmd.handle_options %w[-g]
|
837
|
+
|
838
|
+
assert_equal 'Gemfile', @cmd.options[:gemdeps]
|
839
|
+
|
840
|
+
FileUtils.touch 'gem.deps.rb'
|
841
|
+
|
842
|
+
@cmd.handle_options %w[-g]
|
843
|
+
|
844
|
+
assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
|
889
845
|
end
|
890
846
|
|
847
|
+
def test_handle_options_without
|
848
|
+
@cmd.handle_options %w[--without test]
|
849
|
+
|
850
|
+
assert_equal [:test], @cmd.options[:without_groups]
|
851
|
+
|
852
|
+
@cmd.handle_options %w[--without test,development]
|
853
|
+
|
854
|
+
assert_equal [:test, :development], @cmd.options[:without_groups]
|
855
|
+
end
|
891
856
|
|
892
857
|
end
|