rubygems-update 1.1.1 → 1.2.0
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/ChangeLog +267 -1
- data/Rakefile +13 -7
- data/doc/release_notes/rel_1_2_0.rdoc +105 -0
- data/lib/rubygems.rb +82 -14
- data/lib/rubygems/command.rb +1 -1
- data/lib/rubygems/command_manager.rb +3 -2
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +57 -19
- data/lib/rubygems/commands/environment_command.rb +2 -0
- data/lib/rubygems/commands/fetch_command.rb +3 -1
- data/lib/rubygems/commands/install_command.rb +3 -3
- data/lib/rubygems/commands/list_command.rb +30 -28
- data/lib/rubygems/commands/lock_command.rb +1 -1
- data/lib/rubygems/commands/outdated_command.rb +5 -2
- data/lib/rubygems/commands/pristine_command.rb +3 -44
- data/lib/rubygems/commands/query_command.rb +80 -21
- data/lib/rubygems/commands/sources_command.rb +56 -28
- data/lib/rubygems/commands/specification_command.rb +4 -3
- data/lib/rubygems/commands/stale_command.rb +27 -0
- data/lib/rubygems/commands/update_command.rb +35 -22
- data/lib/rubygems/config_file.rb +29 -12
- data/lib/rubygems/custom_require.rb +1 -1
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +63 -9
- data/lib/rubygems/dependency_installer.rb +60 -23
- data/lib/rubygems/dependency_list.rb +1 -1
- data/lib/rubygems/doc_manager.rb +5 -5
- data/lib/rubygems/gem_openssl.rb +1 -1
- data/lib/rubygems/indexer.rb +269 -84
- data/lib/rubygems/install_update_options.rb +6 -0
- data/lib/rubygems/installer.rb +35 -12
- data/lib/rubygems/local_remote_options.rb +26 -5
- data/lib/rubygems/platform.rb +15 -1
- data/lib/rubygems/remote_fetcher.rb +158 -90
- data/lib/rubygems/requirement.rb +16 -12
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +2 -2
- data/lib/rubygems/server.rb +239 -110
- data/lib/rubygems/source_index.rb +44 -18
- data/lib/rubygems/source_info_cache.rb +1 -1
- data/lib/rubygems/spec_fetcher.rb +251 -0
- data/lib/rubygems/specification.rb +120 -38
- data/lib/rubygems/test_utilities.rb +120 -0
- data/lib/rubygems/uninstaller.rb +11 -10
- data/lib/rubygems/user_interaction.rb +149 -74
- data/lib/rubygems/validator.rb +3 -3
- data/lib/rubygems/version.rb +23 -21
- data/setup.rb +105 -100
- data/test/gemutilities.rb +63 -86
- data/test/test_config.rb +0 -5
- data/test/test_gem.rb +22 -2
- data/test/test_gem_command_manager.rb +1 -1
- data/test/test_gem_commands_dependency_command.rb +125 -6
- data/test/test_gem_commands_environment_command.rb +1 -0
- data/test/test_gem_commands_fetch_command.rb +24 -4
- data/test/test_gem_commands_install_command.rb +6 -8
- data/test/{test_gem_outdated_command.rb → test_gem_commands_outdated_command.rb} +5 -2
- data/test/test_gem_commands_pristine_command.rb +13 -4
- data/test/test_gem_commands_query_command.rb +113 -37
- data/test/test_gem_commands_sources_command.rb +101 -31
- data/test/test_gem_commands_specification_command.rb +4 -1
- data/test/test_gem_commands_stale_command.rb +39 -0
- data/test/test_gem_commands_update_command.rb +17 -27
- data/test/test_gem_config_file.rb +38 -1
- data/test/test_gem_dependency.rb +51 -0
- data/test/test_gem_dependency_installer.rb +133 -25
- data/test/test_gem_gem_path_searcher.rb +4 -1
- data/test/test_gem_indexer.rb +124 -19
- data/test/test_gem_installer.rb +32 -2
- data/test/test_gem_local_remote_options.rb +6 -5
- data/test/test_gem_remote_fetcher.rb +14 -9
- data/test/test_gem_server.rb +207 -21
- data/test/test_gem_source_index.rb +203 -63
- data/test/test_gem_source_info_cache.rb +8 -6
- data/test/test_gem_source_info_cache_entry.rb +11 -9
- data/test/test_gem_spec_fetcher.rb +303 -0
- data/test/test_gem_specification.rb +91 -7
- data/test/test_gem_uninstaller.rb +21 -0
- data/test/test_gem_version.rb +14 -5
- data/test/test_kernel.rb +1 -1
- metadata +10 -73
- metadata.gz.sig +0 -0
- data/lib/rubygems/indexer/abstract_index_builder.rb +0 -88
- data/lib/rubygems/indexer/latest_index_builder.rb +0 -35
- data/lib/rubygems/indexer/marshal_index_builder.rb +0 -17
- data/lib/rubygems/indexer/master_index_builder.rb +0 -54
- data/lib/rubygems/indexer/quick_index_builder.rb +0 -50
- data/test/gem_installer_test_case.rbc +0 -0
- data/test/gem_package_tar_test_case.rbc +0 -0
- data/test/gemutilities.rbc +0 -0
- data/test/mockgemui.rbc +0 -0
- data/test/simple_gem.rbc +0 -0
- data/test/test_config.rbc +0 -0
- data/test/test_gem.rbc +0 -0
- data/test/test_gem_builder.rbc +0 -0
- data/test/test_gem_command.rbc +0 -0
- data/test/test_gem_command_manager.rbc +0 -0
- data/test/test_gem_commands_build_command.rbc +0 -0
- data/test/test_gem_commands_cert_command.rbc +0 -0
- data/test/test_gem_commands_check_command.rbc +0 -0
- data/test/test_gem_commands_contents_command.rbc +0 -0
- data/test/test_gem_commands_dependency_command.rbc +0 -0
- data/test/test_gem_commands_environment_command.rbc +0 -0
- data/test/test_gem_commands_fetch_command.rbc +0 -0
- data/test/test_gem_commands_generate_index_command.rbc +0 -0
- data/test/test_gem_commands_install_command.rbc +0 -0
- data/test/test_gem_commands_mirror_command.rbc +0 -0
- data/test/test_gem_commands_pristine_command.rbc +0 -0
- data/test/test_gem_commands_query_command.rbc +0 -0
- data/test/test_gem_commands_server_command.rbc +0 -0
- data/test/test_gem_commands_sources_command.rbc +0 -0
- data/test/test_gem_commands_specification_command.rbc +0 -0
- data/test/test_gem_commands_unpack_command.rbc +0 -0
- data/test/test_gem_commands_update_command.rbc +0 -0
- data/test/test_gem_config_file.rbc +0 -0
- data/test/test_gem_dependency.rbc +0 -0
- data/test/test_gem_dependency_installer.rbc +0 -0
- data/test/test_gem_dependency_list.rbc +0 -0
- data/test/test_gem_digest.rbc +0 -0
- data/test/test_gem_doc_manager.rbc +0 -0
- data/test/test_gem_ext_configure_builder.rbc +0 -0
- data/test/test_gem_ext_ext_conf_builder.rbc +0 -0
- data/test/test_gem_ext_rake_builder.rbc +0 -0
- data/test/test_gem_format.rbc +0 -0
- data/test/test_gem_gem_path_searcher.rbc +0 -0
- data/test/test_gem_gem_runner.rbc +0 -0
- data/test/test_gem_indexer.rbc +0 -0
- data/test/test_gem_install_update_options.rbc +0 -0
- data/test/test_gem_installer.rbc +0 -0
- data/test/test_gem_local_remote_options.rbc +0 -0
- data/test/test_gem_outdated_command.rbc +0 -0
- data/test/test_gem_package_tar_header.rbc +0 -0
- data/test/test_gem_package_tar_input.rbc +0 -0
- data/test/test_gem_package_tar_output.rbc +0 -0
- data/test/test_gem_package_tar_reader.rbc +0 -0
- data/test/test_gem_package_tar_reader_entry.rbc +0 -0
- data/test/test_gem_package_tar_writer.rbc +0 -0
- data/test/test_gem_platform.rbc +0 -0
- data/test/test_gem_remote_fetcher.rbc +0 -0
- data/test/test_gem_requirement.rbc +0 -0
- data/test/test_gem_server.rbc +0 -0
- data/test/test_gem_source_index.rbc +0 -0
- data/test/test_gem_source_info_cache.rbc +0 -0
- data/test/test_gem_source_info_cache_entry.rbc +0 -0
- data/test/test_gem_specification.rbc +0 -0
- data/test/test_gem_stream_ui.rbc +0 -0
- data/test/test_gem_uninstaller.rbc +0 -0
- data/test/test_gem_validator.rbc +0 -0
- data/test/test_gem_version.rbc +0 -0
- data/test/test_gem_version_option.rbc +0 -0
- data/test/test_kernel.rbc +0 -0
@@ -8,10 +8,12 @@ class TestGemCommandsSourcesCommand < RubyGemTestCase
|
|
8
8
|
super
|
9
9
|
|
10
10
|
@cmd = Gem::Commands::SourcesCommand.new
|
11
|
+
|
12
|
+
@new_repo = "http://beta-gems.example.com"
|
11
13
|
end
|
12
14
|
|
13
15
|
def test_execute
|
14
|
-
|
16
|
+
util_setup_spec_fetcher
|
15
17
|
@cmd.handle_options []
|
16
18
|
|
17
19
|
use_ui @ui do
|
@@ -34,43 +36,49 @@ class TestGemCommandsSourcesCommand < RubyGemTestCase
|
|
34
36
|
si = Gem::SourceIndex.new
|
35
37
|
si.add_spec @a1
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
+
specs = si.map do |_, spec|
|
40
|
+
[spec.name, spec.version, spec.original_platform]
|
41
|
+
end
|
39
42
|
|
40
|
-
|
43
|
+
specs_dump_gz = StringIO.new
|
44
|
+
Zlib::GzipWriter.wrap specs_dump_gz do |io|
|
45
|
+
Marshal.dump specs, io
|
46
|
+
end
|
41
47
|
|
42
|
-
|
48
|
+
@fetcher.data["#{@new_repo}/specs.#{@marshal_version}.gz"] =
|
49
|
+
specs_dump_gz.string
|
50
|
+
|
51
|
+
@cmd.handle_options %W[--add #{@new_repo}]
|
52
|
+
|
53
|
+
util_setup_spec_fetcher
|
43
54
|
|
44
55
|
use_ui @ui do
|
45
56
|
@cmd.execute
|
46
57
|
end
|
47
58
|
|
59
|
+
assert_equal [@gem_repo, @new_repo], Gem.sources
|
60
|
+
|
48
61
|
expected = <<-EOF
|
49
|
-
|
50
|
-
http://beta-gems.example.com added to sources
|
62
|
+
#{@new_repo} added to sources
|
51
63
|
EOF
|
52
64
|
|
53
65
|
assert_equal expected, @ui.output
|
54
66
|
assert_equal '', @ui.error
|
55
|
-
|
56
|
-
Gem::SourceInfoCache.cache.flush
|
57
|
-
assert_equal %W[http://beta-gems.example.com #{@gem_repo}],
|
58
|
-
Gem::SourceInfoCache.cache_data.keys.sort
|
59
67
|
end
|
60
68
|
|
61
69
|
def test_execute_add_nonexistent_source
|
62
70
|
util_setup_fake_fetcher
|
63
71
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
72
|
+
uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz"
|
73
|
+
@fetcher.data[uri] = proc do
|
74
|
+
raise Gem::RemoteFetcher::FetchError.new('it died', uri)
|
75
|
+
end
|
68
76
|
|
69
|
-
Gem::RemoteFetcher.
|
77
|
+
Gem::RemoteFetcher.fetcher = @fetcher
|
70
78
|
|
71
79
|
@cmd.handle_options %w[--add http://beta-gems.example.com]
|
72
80
|
|
73
|
-
|
81
|
+
util_setup_spec_fetcher
|
74
82
|
|
75
83
|
use_ui @ui do
|
76
84
|
@cmd.execute
|
@@ -78,7 +86,7 @@ http://beta-gems.example.com added to sources
|
|
78
86
|
|
79
87
|
expected = <<-EOF
|
80
88
|
Error fetching http://beta-gems.example.com:
|
81
|
-
\tit died
|
89
|
+
\tit died (#{uri})
|
82
90
|
EOF
|
83
91
|
|
84
92
|
assert_equal expected, @ui.output
|
@@ -88,12 +96,14 @@ Error fetching http://beta-gems.example.com:
|
|
88
96
|
def test_execute_add_bad_uri
|
89
97
|
@cmd.handle_options %w[--add beta-gems.example.com]
|
90
98
|
|
91
|
-
|
99
|
+
util_setup_spec_fetcher
|
92
100
|
|
93
101
|
use_ui @ui do
|
94
102
|
@cmd.execute
|
95
103
|
end
|
96
104
|
|
105
|
+
assert_equal [@gem_repo], Gem.sources
|
106
|
+
|
97
107
|
expected = <<-EOF
|
98
108
|
beta-gems.example.com is not a URI
|
99
109
|
EOF
|
@@ -102,6 +112,34 @@ beta-gems.example.com is not a URI
|
|
102
112
|
assert_equal '', @ui.error
|
103
113
|
end
|
104
114
|
|
115
|
+
def test_execute_add_legacy
|
116
|
+
util_setup_fake_fetcher
|
117
|
+
util_setup_source_info_cache
|
118
|
+
|
119
|
+
si = Gem::SourceIndex.new
|
120
|
+
si.add_spec @a1
|
121
|
+
|
122
|
+
@fetcher.data["#{@new_repo}/yaml"] = ''
|
123
|
+
|
124
|
+
@cmd.handle_options %W[--add #{@new_repo}]
|
125
|
+
|
126
|
+
use_ui @ui do
|
127
|
+
@cmd.execute
|
128
|
+
end
|
129
|
+
|
130
|
+
assert_equal [@gem_repo], Gem.sources
|
131
|
+
|
132
|
+
expected = <<-EOF
|
133
|
+
WARNING: RubyGems 1.2+ index not found for:
|
134
|
+
\t#{@new_repo}
|
135
|
+
|
136
|
+
Will cause RubyGems to revert to legacy indexes, degrading performance.
|
137
|
+
EOF
|
138
|
+
|
139
|
+
assert_equal "#{@new_repo} added to sources\n", @ui.output
|
140
|
+
assert_equal expected, @ui.error
|
141
|
+
end
|
142
|
+
|
105
143
|
def test_execute_clear_all
|
106
144
|
@cmd.handle_options %w[--clear-all]
|
107
145
|
|
@@ -116,11 +154,19 @@ beta-gems.example.com is not a URI
|
|
116
154
|
assert File.exist?(cache.latest_system_cache_file),
|
117
155
|
'latest system cache file'
|
118
156
|
|
157
|
+
util_setup_spec_fetcher
|
158
|
+
|
159
|
+
fetcher = Gem::SpecFetcher.fetcher
|
160
|
+
|
161
|
+
# HACK figure out how to force directory creation via fetcher
|
162
|
+
#assert File.directory?(fetcher.dir), 'cache dir exists'
|
163
|
+
|
119
164
|
use_ui @ui do
|
120
165
|
@cmd.execute
|
121
166
|
end
|
122
167
|
|
123
168
|
expected = <<-EOF
|
169
|
+
*** Removed specs cache ***
|
124
170
|
*** Removed user source cache ***
|
125
171
|
*** Removed latest user source cache ***
|
126
172
|
*** Removed system source cache ***
|
@@ -135,12 +181,13 @@ beta-gems.example.com is not a URI
|
|
135
181
|
assert !File.exist?(cache.latest_system_cache_file),
|
136
182
|
'latest system cache file'
|
137
183
|
|
184
|
+
assert !File.exist?(fetcher.dir), 'cache dir removed'
|
138
185
|
end
|
139
186
|
|
140
187
|
def test_execute_remove
|
141
188
|
@cmd.handle_options %W[--remove #{@gem_repo}]
|
142
189
|
|
143
|
-
|
190
|
+
util_setup_spec_fetcher
|
144
191
|
|
145
192
|
use_ui @ui do
|
146
193
|
@cmd.execute
|
@@ -150,9 +197,6 @@ beta-gems.example.com is not a URI
|
|
150
197
|
|
151
198
|
assert_equal expected, @ui.output
|
152
199
|
assert_equal '', @ui.error
|
153
|
-
|
154
|
-
Gem::SourceInfoCache.cache.flush
|
155
|
-
assert_equal [], Gem::SourceInfoCache.cache_data.keys
|
156
200
|
end
|
157
201
|
|
158
202
|
def test_execute_remove_no_network
|
@@ -160,7 +204,7 @@ beta-gems.example.com is not a URI
|
|
160
204
|
|
161
205
|
util_setup_fake_fetcher
|
162
206
|
|
163
|
-
@fetcher.data["#{@gem_repo}
|
207
|
+
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
|
164
208
|
raise Gem::RemoteFetcher::FetchError
|
165
209
|
end
|
166
210
|
|
@@ -172,34 +216,60 @@ beta-gems.example.com is not a URI
|
|
172
216
|
|
173
217
|
assert_equal expected, @ui.output
|
174
218
|
assert_equal '', @ui.error
|
175
|
-
|
176
|
-
Gem::SourceInfoCache.cache.flush
|
177
|
-
assert_equal [], Gem::SourceInfoCache.cache_data.keys
|
178
219
|
end
|
179
220
|
|
180
221
|
def test_execute_update
|
181
222
|
@cmd.handle_options %w[--update]
|
182
223
|
|
224
|
+
util_setup_fake_fetcher
|
225
|
+
source_index = util_setup_spec_fetcher @a1
|
226
|
+
|
227
|
+
specs = source_index.map do |name, spec|
|
228
|
+
[spec.name, spec.version, spec.original_platform]
|
229
|
+
end
|
230
|
+
|
231
|
+
@fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] =
|
232
|
+
util_gzip Marshal.dump(specs)
|
233
|
+
|
234
|
+
latest_specs = source_index.latest_specs.map do |spec|
|
235
|
+
[spec.name, spec.version, spec.original_platform]
|
236
|
+
end
|
237
|
+
|
238
|
+
@fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] =
|
239
|
+
util_gzip Marshal.dump(latest_specs)
|
240
|
+
|
241
|
+
use_ui @ui do
|
242
|
+
@cmd.execute
|
243
|
+
end
|
244
|
+
|
245
|
+
assert_equal "source cache successfully updated\n", @ui.output
|
246
|
+
assert_equal '', @ui.error
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_execute_update_legacy
|
250
|
+
@cmd.handle_options %w[--update]
|
251
|
+
|
252
|
+
util_setup_fake_fetcher
|
183
253
|
util_setup_source_info_cache
|
184
254
|
Gem::SourceInfoCache.reset
|
185
255
|
|
186
|
-
util_setup_fake_fetcher
|
187
256
|
si = Gem::SourceIndex.new
|
188
257
|
si.add_spec @a1
|
189
|
-
@fetcher.data["#{@gem_repo}
|
258
|
+
@fetcher.data["#{@gem_repo}yaml"] = YAML.dump si
|
259
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] = si.dump
|
190
260
|
|
191
261
|
use_ui @ui do
|
192
262
|
@cmd.execute
|
193
263
|
end
|
194
264
|
|
195
265
|
expected = <<-EOF
|
196
|
-
Bulk updating Gem source index for: #{@gem_repo}
|
266
|
+
Bulk updating Gem source index for: #{@gem_repo}
|
197
267
|
source cache successfully updated
|
198
268
|
EOF
|
199
269
|
|
200
270
|
assert_equal expected, @ui.output
|
201
271
|
assert_equal '', @ui.error
|
202
272
|
end
|
203
|
-
|
273
|
+
|
204
274
|
end
|
205
275
|
|
@@ -74,7 +74,10 @@ class TestGemCommandsSpecificationCommand < RubyGemTestCase
|
|
74
74
|
def test_execute_remote
|
75
75
|
foo = quick_gem 'foo'
|
76
76
|
|
77
|
-
|
77
|
+
@fetcher = Gem::FakeFetcher.new
|
78
|
+
Gem::RemoteFetcher.fetcher = @fetcher
|
79
|
+
|
80
|
+
util_setup_spec_fetcher foo
|
78
81
|
|
79
82
|
FileUtils.rm File.join(@gemhome, 'specifications',
|
80
83
|
"#{foo.full_name}.gemspec")
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
3
|
+
require 'rubygems/commands/stale_command'
|
4
|
+
|
5
|
+
class TestGemCommandsStaleCommand < RubyGemTestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super
|
9
|
+
@cmd = Gem::Commands::StaleCommand.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_execute_sorts
|
13
|
+
files = %w[lib/foo_bar.rb Rakefile]
|
14
|
+
foo_bar = quick_gem 'foo_bar' do |gem|
|
15
|
+
gem.files = files
|
16
|
+
end
|
17
|
+
bar_baz = quick_gem 'bar_baz' do |gem|
|
18
|
+
gem.files = files
|
19
|
+
end
|
20
|
+
|
21
|
+
files.each do |file|
|
22
|
+
filename = bar_baz.full_gem_path + "/#{file}"
|
23
|
+
FileUtils.mkdir_p(File.dirname(filename))
|
24
|
+
FileUtils.touch(filename, :mtime => Time.now)
|
25
|
+
|
26
|
+
filename = foo_bar.full_gem_path + "/#{file}"
|
27
|
+
FileUtils.mkdir_p(File.dirname(filename))
|
28
|
+
FileUtils.touch(filename, :mtime => Time.now - 86400)
|
29
|
+
end
|
30
|
+
|
31
|
+
use_ui @ui do
|
32
|
+
@cmd.execute
|
33
|
+
end
|
34
|
+
lines = @ui.output.split("\n")
|
35
|
+
assert_equal("#{foo_bar.name}-#{foo_bar.version}", lines[0].split.first)
|
36
|
+
assert_equal("#{bar_baz.name}-#{bar_baz.version}", lines[1].split.first)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -14,14 +14,16 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
14
14
|
@a1_path = File.join @gemhome, 'cache', "#{@a1.full_name}.gem"
|
15
15
|
@a2_path = File.join @gemhome, 'cache', "#{@a2.full_name}.gem"
|
16
16
|
|
17
|
-
@
|
18
|
-
|
19
|
-
@fetcher.data["#{@gem_repo}
|
20
|
-
|
17
|
+
util_setup_spec_fetcher @a1, @a2
|
18
|
+
|
19
|
+
@fetcher.data["#{@gem_repo}gems/#{@a1.full_name}.gem"] =
|
20
|
+
read_binary @a1_path
|
21
|
+
@fetcher.data["#{@gem_repo}gems/#{@a2.full_name}.gem"] =
|
22
|
+
read_binary @a2_path
|
21
23
|
end
|
22
24
|
|
23
25
|
def test_execute
|
24
|
-
|
26
|
+
util_clear_gems
|
25
27
|
|
26
28
|
Gem::Installer.new(@a1_path).install
|
27
29
|
|
@@ -33,7 +35,6 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
33
35
|
|
34
36
|
out = @ui.output.split "\n"
|
35
37
|
assert_equal "Updating installed gems", out.shift
|
36
|
-
assert_match %r|Bulk updating|, out.shift
|
37
38
|
assert_equal "Updating #{@a2.name}", out.shift
|
38
39
|
assert_equal "Successfully installed #{@a2.full_name}", out.shift
|
39
40
|
assert_equal "Gems updated: #{@a2.name}", out.shift
|
@@ -73,16 +74,15 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
73
74
|
util_build_gem @a2
|
74
75
|
util_build_gem @c2
|
75
76
|
|
76
|
-
@fetcher.data["#{@gem_repo}
|
77
|
-
|
78
|
-
@fetcher.data["#{@gem_repo}
|
79
|
-
@fetcher.data["#{@gem_repo}
|
80
|
-
@fetcher.data["#{@gem_repo}/gems/#{@b2.full_name}.gem"] = read_binary @b2_path
|
81
|
-
@fetcher.data["#{@gem_repo}/gems/#{@c1_2.full_name}.gem"] =
|
77
|
+
@fetcher.data["#{@gem_repo}gems/#{@a1.full_name}.gem"] = read_binary @a1_path
|
78
|
+
@fetcher.data["#{@gem_repo}gems/#{@a2.full_name}.gem"] = read_binary @a2_path
|
79
|
+
@fetcher.data["#{@gem_repo}gems/#{@b2.full_name}.gem"] = read_binary @b2_path
|
80
|
+
@fetcher.data["#{@gem_repo}gems/#{@c1_2.full_name}.gem"] =
|
82
81
|
read_binary @c1_2_path
|
83
|
-
@fetcher.data["#{@gem_repo}
|
82
|
+
@fetcher.data["#{@gem_repo}gems/#{@c2.full_name}.gem"] = read_binary @c2_path
|
84
83
|
|
85
|
-
|
84
|
+
util_setup_spec_fetcher @a1, @a2, @b2, @c1_2, @c2
|
85
|
+
util_clear_gems
|
86
86
|
|
87
87
|
Gem::Installer.new(@c1_2_path).install
|
88
88
|
Gem::Installer.new(@a1_path).install
|
@@ -95,9 +95,7 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
95
95
|
|
96
96
|
out = @ui.output.split "\n"
|
97
97
|
assert_equal "Updating installed gems", out.shift
|
98
|
-
assert_match %r|Bulk updating|, out.shift
|
99
98
|
assert_equal "Updating #{@a2.name}", out.shift
|
100
|
-
assert_match %r|Bulk updating|, out.shift
|
101
99
|
assert_equal "Successfully installed #{@c2.full_name}", out.shift
|
102
100
|
assert_equal "Successfully installed #{@b2.full_name}", out.shift
|
103
101
|
assert_equal "Successfully installed #{@a2.full_name}", out.shift
|
@@ -108,7 +106,7 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
108
106
|
end
|
109
107
|
|
110
108
|
def test_execute_named
|
111
|
-
|
109
|
+
util_clear_gems
|
112
110
|
|
113
111
|
Gem::Installer.new(@a1_path).install
|
114
112
|
|
@@ -120,7 +118,6 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
120
118
|
|
121
119
|
out = @ui.output.split "\n"
|
122
120
|
assert_equal "Updating installed gems", out.shift
|
123
|
-
assert_match %r|Bulk updating|, out.shift
|
124
121
|
assert_equal "Updating #{@a2.name}", out.shift
|
125
122
|
assert_equal "Successfully installed #{@a2.full_name}", out.shift
|
126
123
|
assert_equal "Gems updated: #{@a2.name}", out.shift
|
@@ -129,7 +126,7 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
129
126
|
end
|
130
127
|
|
131
128
|
def test_execute_named_up_to_date
|
132
|
-
|
129
|
+
util_clear_gems
|
133
130
|
|
134
131
|
Gem::Installer.new(@a2_path).install
|
135
132
|
|
@@ -141,14 +138,13 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
141
138
|
|
142
139
|
out = @ui.output.split "\n"
|
143
140
|
assert_equal "Updating installed gems", out.shift
|
144
|
-
assert_match %r|Bulk updating|, out.shift
|
145
141
|
assert_equal "Nothing to update", out.shift
|
146
142
|
|
147
143
|
assert out.empty?, out.inspect
|
148
144
|
end
|
149
145
|
|
150
146
|
def test_execute_up_to_date
|
151
|
-
|
147
|
+
util_clear_gems
|
152
148
|
|
153
149
|
Gem::Installer.new(@a2_path).install
|
154
150
|
|
@@ -160,16 +156,10 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
|
|
160
156
|
|
161
157
|
out = @ui.output.split "\n"
|
162
158
|
assert_equal "Updating installed gems", out.shift
|
163
|
-
assert_match %r|Bulk updating|, out.shift
|
164
159
|
assert_equal "Nothing to update", out.shift
|
165
160
|
|
166
161
|
assert out.empty?, out.inspect
|
167
162
|
end
|
168
163
|
|
169
|
-
def util_remove_gems
|
170
|
-
FileUtils.rm_r File.join(@gemhome, 'gems')
|
171
|
-
FileUtils.rm_r File.join(@gemhome, 'specifications')
|
172
|
-
end
|
173
|
-
|
174
164
|
end
|
175
165
|
|
@@ -17,9 +17,23 @@ class TestGemConfigFile < RubyGemTestCase
|
|
17
17
|
@temp_conf = File.join @tempdir, '.gemrc'
|
18
18
|
|
19
19
|
@cfg_args = %W[--config-file #{@temp_conf}]
|
20
|
+
|
21
|
+
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
|
22
|
+
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
23
|
+
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
|
24
|
+
File.join(@tempdir, 'system-gemrc')
|
25
|
+
|
20
26
|
util_config_file
|
21
27
|
end
|
22
28
|
|
29
|
+
def teardown
|
30
|
+
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
31
|
+
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
|
32
|
+
@orig_SYSTEM_WIDE_CONFIG_FILE
|
33
|
+
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
23
37
|
def test_initialize
|
24
38
|
assert_equal @temp_conf, @cfg.config_file_name
|
25
39
|
|
@@ -28,7 +42,7 @@ class TestGemConfigFile < RubyGemTestCase
|
|
28
42
|
assert_equal false, @cfg.benchmark
|
29
43
|
assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold
|
30
44
|
assert_equal true, @cfg.verbose
|
31
|
-
assert_equal
|
45
|
+
assert_equal [@gem_repo], Gem.sources
|
32
46
|
|
33
47
|
File.open @temp_conf, 'w' do |fp|
|
34
48
|
fp.puts ":backtrace: true"
|
@@ -58,6 +72,12 @@ class TestGemConfigFile < RubyGemTestCase
|
|
58
72
|
assert_equal @temp_conf, @cfg.config_file_name
|
59
73
|
end
|
60
74
|
|
75
|
+
def test_initialize_handle_arguments_config_file_with_other_params
|
76
|
+
util_config_file %W[--config-file #{@temp_conf} --backtrace]
|
77
|
+
|
78
|
+
assert_equal @temp_conf, @cfg.config_file_name
|
79
|
+
end
|
80
|
+
|
61
81
|
def test_initialize_handle_arguments_config_file_equals
|
62
82
|
util_config_file %W[--config-file=#{@temp_conf}]
|
63
83
|
|
@@ -202,6 +222,23 @@ class TestGemConfigFile < RubyGemTestCase
|
|
202
222
|
assert_equal %w[http://even-more-gems.example.com], Gem.sources
|
203
223
|
end
|
204
224
|
|
225
|
+
def test_global_config_file
|
226
|
+
File.open(@temp_conf, 'w') do |fp|
|
227
|
+
fp.puts ":backtrace: true"
|
228
|
+
end
|
229
|
+
|
230
|
+
File.open(File.join(Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE),
|
231
|
+
'w') do |fp|
|
232
|
+
fp.puts ":backtrace: false"
|
233
|
+
fp.puts ":bulk_threshold: 2048"
|
234
|
+
end
|
235
|
+
|
236
|
+
util_config_file
|
237
|
+
|
238
|
+
assert_equal 2048, @cfg.bulk_threshold
|
239
|
+
assert @cfg.backtrace
|
240
|
+
end
|
241
|
+
|
205
242
|
def util_config_file(args = @cfg_args)
|
206
243
|
@cfg = Gem::ConfigFile.new args
|
207
244
|
end
|