rubygems-update 1.4.2 → 1.5.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/.autotest +4 -5
- data/{test/foo/discover.rb → .gemtest} +0 -0
- data/ChangeLog +13 -0
- data/History.txt +35 -1
- data/Manifest.txt +89 -88
- data/README.rdoc +21 -10
- data/Rakefile +31 -17
- data/UPGRADING.rdoc +81 -0
- data/ci_build.sh +27 -0
- data/cruise_config.rb +20 -13
- data/lib/rbconfig/datadir.rb +1 -1
- data/lib/rubygems.rb +102 -45
- data/lib/rubygems/builder.rb +5 -11
- data/lib/rubygems/command_manager.rb +0 -1
- data/lib/rubygems/commands/check_command.rb +2 -17
- data/lib/rubygems/commands/cleanup_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +5 -18
- data/lib/rubygems/commands/environment_command.rb +5 -4
- data/lib/rubygems/commands/fetch_command.rb +0 -1
- data/lib/rubygems/commands/generate_index_command.rb +1 -10
- data/lib/rubygems/commands/help_command.rb +0 -5
- data/lib/rubygems/commands/query_command.rb +4 -24
- data/lib/rubygems/commands/setup_command.rb +4 -19
- data/lib/rubygems/commands/sources_command.rb +15 -37
- data/lib/rubygems/commands/specification_command.rb +1 -2
- data/lib/rubygems/commands/unpack_command.rb +19 -7
- data/lib/rubygems/commands/update_command.rb +29 -44
- data/lib/rubygems/config_file.rb +25 -19
- data/lib/rubygems/custom_require.rb +4 -6
- data/lib/rubygems/dependency.rb +1 -43
- data/lib/rubygems/dependency_installer.rb +1 -1
- data/lib/rubygems/doc_manager.rb +3 -1
- data/lib/rubygems/ext/builder.rb +3 -1
- data/lib/rubygems/ext/rake_builder.rb +10 -2
- data/lib/rubygems/format.rb +7 -4
- data/lib/rubygems/gem_runner.rb +1 -1
- data/lib/rubygems/indexer.rb +11 -74
- data/lib/rubygems/install_update_options.rb +13 -8
- data/lib/rubygems/installer.rb +139 -95
- data/{test/gem_installer_test_case.rb → lib/rubygems/installer_test_case.rb} +41 -2
- data/{test/mockgemui.rb → lib/rubygems/mock_gem_ui.rb} +8 -1
- data/lib/rubygems/old_format.rb +2 -1
- data/lib/rubygems/package.rb +17 -2
- data/lib/rubygems/package/tar_input.rb +7 -3
- data/lib/rubygems/package/tar_output.rb +2 -0
- data/lib/rubygems/package/tar_reader/entry.rb +4 -0
- data/{test/gem_package_tar_test_case.rb → lib/rubygems/package/tar_test_case.rb} +5 -2
- data/lib/rubygems/package_task.rb +6 -4
- data/lib/rubygems/remote_fetcher.rb +10 -2
- data/lib/rubygems/require_paths_builder.rb +2 -1
- data/lib/rubygems/server.rb +3 -44
- data/lib/rubygems/source_index.rb +3 -216
- data/lib/rubygems/spec_fetcher.rb +15 -63
- data/lib/rubygems/specification.rb +1 -1
- data/{test/gemutilities.rb → lib/rubygems/test_case.rb} +219 -90
- data/lib/rubygems/test_utilities.rb +7 -20
- data/lib/rubygems/uninstaller.rb +27 -28
- data/lib/rubygems/user_interaction.rb +81 -42
- data/lib/rubygems/validator.rb +0 -73
- data/test/{bogussources.rb → rubygems/bogussources.rb} +0 -0
- data/test/{data → rubygems/data}/gem-private_key.pem +0 -0
- data/test/{data → rubygems/data}/gem-public_cert.pem +0 -0
- data/test/{fake_certlib → rubygems/fake_certlib}/openssl.rb +0 -0
- data/test/rubygems/foo/discover.rb +0 -0
- data/test/{functional.rb → rubygems/functional.rb} +0 -0
- data/test/{insure_session.rb → rubygems/insure_session.rb} +0 -0
- data/test/{plugin → rubygems/plugin}/exception/rubygems_plugin.rb +0 -0
- data/test/{plugin → rubygems/plugin}/load/rubygems_plugin.rb +0 -0
- data/test/{plugin → rubygems/plugin}/standarderror/rubygems_plugin.rb +0 -0
- data/test/{private_key.pem → rubygems/private_key.pem} +0 -0
- data/test/{public_cert.pem → rubygems/public_cert.pem} +0 -0
- data/test/rubygems/{commands → rubygems/commands}/crash_command.rb +0 -0
- data/test/{rubygems_plugin.rb → rubygems/rubygems_plugin.rb} +0 -0
- data/test/rubygems/sff/discover.rb +0 -0
- data/test/{simple_gem.rb → rubygems/simple_gem.rb} +2 -2
- data/test/{test_config.rb → rubygems/test_config.rb} +2 -2
- data/test/{test_gem.rb → rubygems/test_gem.rb} +12 -2
- data/test/{test_gem_builder.rb → rubygems/test_gem_builder.rb} +2 -2
- data/test/{test_gem_command.rb → rubygems/test_gem_command.rb} +3 -3
- data/test/{test_gem_command_manager.rb → rubygems/test_gem_command_manager.rb} +15 -6
- data/test/{test_gem_commands_build_command.rb → rubygems/test_gem_commands_build_command.rb} +2 -2
- data/test/{test_gem_commands_cert_command.rb → rubygems/test_gem_commands_cert_command.rb} +2 -2
- data/test/{test_gem_commands_check_command.rb → rubygems/test_gem_commands_check_command.rb} +2 -2
- data/test/{test_gem_commands_contents_command.rb → rubygems/test_gem_commands_contents_command.rb} +3 -3
- data/test/{test_gem_commands_dependency_command.rb → rubygems/test_gem_commands_dependency_command.rb} +4 -4
- data/test/{test_gem_commands_environment_command.rb → rubygems/test_gem_commands_environment_command.rb} +12 -3
- data/test/{test_gem_commands_fetch_command.rb → rubygems/test_gem_commands_fetch_command.rb} +2 -2
- data/test/{test_gem_commands_generate_index_command.rb → rubygems/test_gem_commands_generate_index_command.rb} +7 -11
- data/test/{test_gem_commands_install_command.rb → rubygems/test_gem_commands_install_command.rb} +2 -2
- data/test/{test_gem_commands_list_command.rb → rubygems/test_gem_commands_list_command.rb} +2 -2
- data/test/{test_gem_commands_lock_command.rb → rubygems/test_gem_commands_lock_command.rb} +2 -2
- data/test/{test_gem_commands_outdated_command.rb → rubygems/test_gem_commands_outdated_command.rb} +2 -2
- data/test/{test_gem_commands_owner_command.rb → rubygems/test_gem_commands_owner_command.rb} +5 -5
- data/test/{test_gem_commands_pristine_command.rb → rubygems/test_gem_commands_pristine_command.rb} +2 -2
- data/test/{test_gem_commands_push_command.rb → rubygems/test_gem_commands_push_command.rb} +3 -3
- data/test/{test_gem_commands_query_command.rb → rubygems/test_gem_commands_query_command.rb} +2 -2
- data/test/{test_gem_commands_server_command.rb → rubygems/test_gem_commands_server_command.rb} +2 -2
- data/test/{test_gem_commands_sources_command.rb → rubygems/test_gem_commands_sources_command.rb} +8 -8
- data/test/{test_gem_commands_specification_command.rb → rubygems/test_gem_commands_specification_command.rb} +3 -3
- data/test/{test_gem_commands_stale_command.rb → rubygems/test_gem_commands_stale_command.rb} +2 -2
- data/test/{test_gem_commands_uninstall_command.rb → rubygems/test_gem_commands_uninstall_command.rb} +16 -10
- data/test/{test_gem_commands_unpack_command.rb → rubygems/test_gem_commands_unpack_command.rb} +42 -2
- data/test/{test_gem_commands_update_command.rb → rubygems/test_gem_commands_update_command.rb} +2 -2
- data/test/{test_gem_commands_which_command.rb → rubygems/test_gem_commands_which_command.rb} +3 -3
- data/test/{test_gem_config_file.rb → rubygems/test_gem_config_file.rb} +2 -2
- data/test/{test_gem_dependency.rb → rubygems/test_gem_dependency.rb} +3 -27
- data/test/{test_gem_dependency_installer.rb → rubygems/test_gem_dependency_installer.rb} +2 -2
- data/test/{test_gem_dependency_list.rb → rubygems/test_gem_dependency_list.rb} +3 -3
- data/test/{test_gem_doc_manager.rb → rubygems/test_gem_doc_manager.rb} +2 -2
- data/test/{test_gem_ext_configure_builder.rb → rubygems/test_gem_ext_configure_builder.rb} +4 -4
- data/test/{test_gem_ext_ext_conf_builder.rb → rubygems/test_gem_ext_ext_conf_builder.rb} +46 -2
- data/test/{test_gem_ext_rake_builder.rb → rubygems/test_gem_ext_rake_builder.rb} +2 -2
- data/test/{test_gem_format.rb → rubygems/test_gem_format.rb} +24 -6
- data/test/{test_gem_gem_path_searcher.rb → rubygems/test_gem_gem_path_searcher.rb} +2 -2
- data/test/{test_gem_gem_runner.rb → rubygems/test_gem_gem_runner.rb} +2 -2
- data/test/{test_gem_gemcutter_utilities.rb → rubygems/test_gem_gemcutter_utilities.rb} +4 -4
- data/test/{test_gem_indexer.rb → rubygems/test_gem_indexer.rb} +4 -121
- data/test/{test_gem_install_update_options.rb → rubygems/test_gem_install_update_options.rb} +3 -3
- data/test/{test_gem_installer.rb → rubygems/test_gem_installer.rb} +106 -13
- data/test/{test_gem_local_remote_options.rb → rubygems/test_gem_local_remote_options.rb} +2 -2
- data/test/{test_gem_package_tar_header.rb → rubygems/test_gem_package_tar_header.rb} +2 -2
- data/test/{test_gem_package_tar_input.rb → rubygems/test_gem_package_tar_input.rb} +21 -4
- data/test/{test_gem_package_tar_output.rb → rubygems/test_gem_package_tar_output.rb} +2 -2
- data/test/{test_gem_package_tar_reader.rb → rubygems/test_gem_package_tar_reader.rb} +2 -2
- data/test/{test_gem_package_tar_reader_entry.rb → rubygems/test_gem_package_tar_reader_entry.rb} +12 -2
- data/test/{test_gem_package_tar_writer.rb → rubygems/test_gem_package_tar_writer.rb} +2 -2
- data/test/{test_gem_package_task.rb → rubygems/test_gem_package_task.rb} +15 -2
- data/test/{test_gem_platform.rb → rubygems/test_gem_platform.rb} +2 -2
- data/test/{test_gem_remote_fetcher.rb → rubygems/test_gem_remote_fetcher.rb} +7 -7
- data/test/{test_gem_requirement.rb → rubygems/test_gem_requirement.rb} +2 -2
- data/test/{test_gem_security.rb → rubygems/test_gem_security.rb} +3 -4
- data/test/{test_gem_server.rb → rubygems/test_gem_server.rb} +2 -132
- data/test/rubygems/test_gem_silent_ui.rb +113 -0
- data/test/{test_gem_source_index.rb → rubygems/test_gem_source_index.rb} +2 -61
- data/test/{test_gem_spec_fetcher.rb → rubygems/test_gem_spec_fetcher.rb} +2 -2
- data/test/{test_gem_specification.rb → rubygems/test_gem_specification.rb} +4 -4
- data/test/{test_gem_stream_ui.rb → rubygems/test_gem_stream_ui.rb} +24 -2
- data/test/{test_gem_text.rb → rubygems/test_gem_text.rb} +2 -2
- data/test/{test_gem_uninstaller.rb → rubygems/test_gem_uninstaller.rb} +15 -12
- data/test/{test_gem_validator.rb → rubygems/test_gem_validator.rb} +3 -3
- data/test/{test_gem_version.rb → rubygems/test_gem_version.rb} +2 -2
- data/test/{test_gem_version_option.rb → rubygems/test_gem_version_option.rb} +2 -2
- data/test/{test_kernel.rb → rubygems/test_kernel.rb} +7 -10
- metadata +281 -177
- metadata.gz.sig +0 -0
- data/lib/rubygems/commands/mirror_command.rb +0 -111
- data/lib/rubygems/source_info_cache.rb +0 -394
- data/lib/rubygems/source_info_cache_entry.rb +0 -56
- data/test/test_gem_commands_mirror_command.rb +0 -60
@@ -131,30 +131,17 @@ end
|
|
131
131
|
#--
|
132
132
|
# This class was added to flush out problems in Rubinius' IO implementation.
|
133
133
|
|
134
|
-
class TempIO
|
135
|
-
|
136
|
-
@@count = 0
|
137
|
-
|
134
|
+
class TempIO < Tempfile
|
138
135
|
def initialize(string = '')
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
end
|
144
|
-
|
145
|
-
def method_missing(meth, *args, &block)
|
146
|
-
@tempfile.send(meth, *args, &block)
|
147
|
-
end
|
148
|
-
|
149
|
-
def respond_to?(meth)
|
150
|
-
@tempfile.respond_to? meth
|
136
|
+
super "TempIO"
|
137
|
+
binmode
|
138
|
+
write string
|
139
|
+
rewind
|
151
140
|
end
|
152
141
|
|
153
142
|
def string
|
154
|
-
|
155
|
-
|
156
|
-
Gem.read_binary @tempfile.path
|
143
|
+
flush
|
144
|
+
Gem.read_binary path
|
157
145
|
end
|
158
|
-
|
159
146
|
end
|
160
147
|
|
data/lib/rubygems/uninstaller.rb
CHANGED
@@ -121,43 +121,42 @@ class Gem::Uninstaller
|
|
121
121
|
# +gemspec+.
|
122
122
|
|
123
123
|
def remove_executables(spec)
|
124
|
-
return if spec.nil?
|
124
|
+
return if spec.nil? or spec.executables.empty?
|
125
125
|
|
126
|
-
|
127
|
-
bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path)
|
126
|
+
bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path)
|
128
127
|
|
129
|
-
|
130
|
-
|
131
|
-
|
128
|
+
list = @source_index.find_name(spec.name).delete_if { |s|
|
129
|
+
s.version == spec.version
|
130
|
+
}
|
132
131
|
|
133
|
-
|
132
|
+
executables = spec.executables.clone
|
134
133
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
end
|
134
|
+
list.each do |s|
|
135
|
+
s.executables.each do |exe_name|
|
136
|
+
executables.delete exe_name
|
139
137
|
end
|
138
|
+
end
|
140
139
|
|
141
|
-
|
140
|
+
return if executables.empty?
|
142
141
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
142
|
+
remove = if @force_executables.nil? then
|
143
|
+
ask_yes_no("Remove executables:\n" \
|
144
|
+
"\t#{spec.executables.join ', '}\n\n" \
|
145
|
+
"in addition to the gem?",
|
146
|
+
true)
|
147
|
+
else
|
148
|
+
@force_executables
|
149
|
+
end
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
151
|
+
unless remove then
|
152
|
+
say "Executables and scripts will remain installed."
|
153
|
+
else
|
154
|
+
raise Gem::FilePermissionError, bindir unless File.writable? bindir
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
end
|
156
|
+
spec.executables.each do |exe_name|
|
157
|
+
say "Removing #{exe_name}"
|
158
|
+
FileUtils.rm_f File.join(bindir, exe_name)
|
159
|
+
FileUtils.rm_f File.join(bindir, "#{exe_name}.bat")
|
161
160
|
end
|
162
161
|
end
|
163
162
|
end
|
@@ -66,7 +66,7 @@ module Gem::DefaultUserInteraction
|
|
66
66
|
end
|
67
67
|
|
68
68
|
##
|
69
|
-
# Make the default UI
|
69
|
+
# Make the default UI accessible without the "ui." prefix. Classes
|
70
70
|
# including this module may use the interaction methods on the default UI
|
71
71
|
# directly. Classes may also reference the ui and ui= methods.
|
72
72
|
#
|
@@ -218,48 +218,66 @@ class Gem::StreamUI
|
|
218
218
|
result
|
219
219
|
end
|
220
220
|
|
221
|
-
|
222
|
-
|
221
|
+
if RUBY_VERSION > '1.9.2' then
|
222
|
+
##
|
223
|
+
# Ask for a password. Does not echo response to terminal.
|
223
224
|
|
224
|
-
|
225
|
-
|
225
|
+
def ask_for_password(question)
|
226
|
+
return nil if not @ins.tty?
|
226
227
|
|
227
|
-
|
228
|
-
@outs.flush
|
228
|
+
require 'io/console'
|
229
229
|
|
230
|
-
|
231
|
-
|
230
|
+
@outs.print(question + " ")
|
231
|
+
@outs.flush
|
232
232
|
|
233
|
-
|
234
|
-
|
233
|
+
password = @ins.noecho {@ins.gets}
|
234
|
+
password.chomp! if password
|
235
|
+
password
|
236
|
+
end
|
237
|
+
else
|
238
|
+
##
|
239
|
+
# Ask for a password. Does not echo response to terminal.
|
235
240
|
|
236
|
-
|
237
|
-
|
238
|
-
char = nil
|
239
|
-
password = ''
|
241
|
+
def ask_for_password(question)
|
242
|
+
return nil if not @ins.tty?
|
240
243
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
else
|
246
|
-
password << char.chr
|
247
|
-
end
|
244
|
+
@outs.print(question + " ")
|
245
|
+
@outs.flush
|
246
|
+
|
247
|
+
Gem.win_platform? ? ask_for_password_on_windows : ask_for_password_on_unix
|
248
248
|
end
|
249
249
|
|
250
|
-
|
251
|
-
password
|
252
|
-
|
250
|
+
##
|
251
|
+
# Asks for a password that works on windows. Ripped from the Heroku gem.
|
252
|
+
|
253
|
+
def ask_for_password_on_windows
|
254
|
+
require "Win32API"
|
255
|
+
char = nil
|
256
|
+
password = ''
|
257
|
+
|
258
|
+
while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
|
259
|
+
break if char == 10 || char == 13 # received carriage return or newline
|
260
|
+
if char == 127 || char == 8 # backspace and delete
|
261
|
+
password.slice!(-1, 1)
|
262
|
+
else
|
263
|
+
password << char.chr
|
264
|
+
end
|
265
|
+
end
|
253
266
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
password
|
260
|
-
|
261
|
-
|
262
|
-
|
267
|
+
puts
|
268
|
+
password
|
269
|
+
end
|
270
|
+
|
271
|
+
##
|
272
|
+
# Asks for a password that works on unix
|
273
|
+
|
274
|
+
def ask_for_password_on_unix
|
275
|
+
system "stty -echo"
|
276
|
+
password = @ins.gets
|
277
|
+
password.chomp! if password
|
278
|
+
system "stty echo"
|
279
|
+
password
|
280
|
+
end
|
263
281
|
end
|
264
282
|
|
265
283
|
##
|
@@ -453,12 +471,20 @@ class Gem::StreamUI
|
|
453
471
|
end
|
454
472
|
|
455
473
|
def fetch(file_name, total_bytes)
|
456
|
-
@file_name
|
474
|
+
@file_name = file_name
|
475
|
+
@total_bytes = total_bytes.to_i
|
476
|
+
@units = @total_bytes.zero? ? 'B' : '%'
|
477
|
+
|
457
478
|
update_display(false)
|
458
479
|
end
|
459
480
|
|
460
481
|
def update(bytes)
|
461
|
-
new_progress =
|
482
|
+
new_progress = if @units == 'B' then
|
483
|
+
bytes
|
484
|
+
else
|
485
|
+
((bytes.to_f * 100) / total_bytes.to_f).ceil
|
486
|
+
end
|
487
|
+
|
462
488
|
return if new_progress == @progress
|
463
489
|
|
464
490
|
@progress = new_progress
|
@@ -466,7 +492,7 @@ class Gem::StreamUI
|
|
466
492
|
end
|
467
493
|
|
468
494
|
def done
|
469
|
-
@progress = 100
|
495
|
+
@progress = 100 if @units == '%'
|
470
496
|
update_display(true, true)
|
471
497
|
end
|
472
498
|
|
@@ -474,8 +500,9 @@ class Gem::StreamUI
|
|
474
500
|
|
475
501
|
def update_display(show_progress = true, new_line = false)
|
476
502
|
return unless @out.tty?
|
477
|
-
|
478
|
-
|
503
|
+
|
504
|
+
if show_progress then
|
505
|
+
@out.print "\rFetching: %s (%3d%s)" % [@file_name, @progress, @units]
|
479
506
|
else
|
480
507
|
@out.print "Fetching: %s" % @file_name
|
481
508
|
end
|
@@ -497,9 +524,21 @@ end
|
|
497
524
|
##
|
498
525
|
# SilentUI is a UI choice that is absolutely silent.
|
499
526
|
|
500
|
-
class Gem::SilentUI
|
501
|
-
|
502
|
-
|
527
|
+
class Gem::SilentUI < Gem::StreamUI
|
528
|
+
|
529
|
+
def initialize
|
530
|
+
|
531
|
+
reader, writer = nil, nil
|
532
|
+
|
533
|
+
if Gem.win_platform?
|
534
|
+
reader = File.open('nul', 'r')
|
535
|
+
writer = File.open('nul', 'w')
|
536
|
+
else
|
537
|
+
reader = File.open('/dev/null', 'r')
|
538
|
+
writer = File.open('/dev/null', 'w')
|
539
|
+
end
|
540
|
+
|
541
|
+
super reader, writer, writer
|
503
542
|
end
|
504
543
|
end
|
505
544
|
|
data/lib/rubygems/validator.rb
CHANGED
@@ -7,12 +7,6 @@
|
|
7
7
|
require 'rubygems/format'
|
8
8
|
require 'rubygems/installer'
|
9
9
|
|
10
|
-
begin
|
11
|
-
gem 'test-unit'
|
12
|
-
rescue Gem::LoadError
|
13
|
-
# Ignore - use the test-unit library that's part of the standard library
|
14
|
-
end
|
15
|
-
|
16
10
|
##
|
17
11
|
# Validator performs various gem file and gem database validation
|
18
12
|
|
@@ -167,73 +161,6 @@ class Gem::Validator
|
|
167
161
|
errors
|
168
162
|
end
|
169
163
|
|
170
|
-
if RUBY_VERSION < '1.9' then
|
171
|
-
class TestRunner
|
172
|
-
def initialize(suite, ui)
|
173
|
-
@suite = suite
|
174
|
-
@ui = ui
|
175
|
-
end
|
176
|
-
|
177
|
-
def self.run(suite, ui)
|
178
|
-
require 'test/unit/ui/testrunnermediator'
|
179
|
-
return new(suite, ui).start
|
180
|
-
end
|
181
|
-
|
182
|
-
def start
|
183
|
-
@mediator = Test::Unit::UI::TestRunnerMediator.new(@suite)
|
184
|
-
@mediator.add_listener(Test::Unit::TestResult::FAULT, &method(:add_fault))
|
185
|
-
return @mediator.run_suite
|
186
|
-
end
|
187
|
-
|
188
|
-
def add_fault(fault)
|
189
|
-
if Gem.configuration.verbose then
|
190
|
-
@ui.say fault.long_display
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
autoload :TestRunner, 'test/unit/ui/testrunnerutilities'
|
196
|
-
end
|
197
|
-
|
198
|
-
##
|
199
|
-
# Runs unit tests for a given gem specification
|
200
|
-
|
201
|
-
def unit_test(gem_spec)
|
202
|
-
start_dir = Dir.pwd
|
203
|
-
Dir.chdir(gem_spec.full_gem_path)
|
204
|
-
$: << gem_spec.full_gem_path
|
205
|
-
# XXX: why do we need this gem_spec when we've already got 'spec'?
|
206
|
-
test_files = gem_spec.test_files
|
207
|
-
|
208
|
-
if test_files.empty? then
|
209
|
-
say "There are no unit tests to run for #{gem_spec.full_name}"
|
210
|
-
return nil
|
211
|
-
end
|
212
|
-
|
213
|
-
gem gem_spec.name, "= #{gem_spec.version.version}"
|
214
|
-
|
215
|
-
test_files.each do |f| require f end
|
216
|
-
|
217
|
-
if RUBY_VERSION < '1.9' then
|
218
|
-
suite = Test::Unit::TestSuite.new("#{gem_spec.name}-#{gem_spec.version}")
|
219
|
-
|
220
|
-
ObjectSpace.each_object(Class) do |klass|
|
221
|
-
suite << klass.suite if (klass < Test::Unit::TestCase)
|
222
|
-
end
|
223
|
-
|
224
|
-
result = TestRunner.run suite, ui
|
225
|
-
|
226
|
-
alert_error result.to_s unless result.passed?
|
227
|
-
else
|
228
|
-
result = MiniTest::Unit.new
|
229
|
-
result.run
|
230
|
-
end
|
231
|
-
|
232
|
-
result
|
233
|
-
ensure
|
234
|
-
Dir.chdir(start_dir)
|
235
|
-
end
|
236
|
-
|
237
164
|
def remove_leading_dot_dir(path)
|
238
165
|
path.sub(/^\.\//, "")
|
239
166
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
SIMPLE_GEM = <<-GEMDATA
|
2
|
-
MD5SUM = "
|
2
|
+
MD5SUM = "989bf34a1cbecd52e0ea66b662b3a405"
|
3
3
|
if $0 == __FILE__
|
4
4
|
require 'optparse'
|
5
5
|
|
@@ -7,7 +7,7 @@ SIMPLE_GEM = <<-GEMDATA
|
|
7
7
|
ARGV.options do |opts|
|
8
8
|
opts.on_tail("--help", "show this message") {puts opts; exit}
|
9
9
|
opts.on('--dir=DIRNAME', "Installation directory for the Gem") {|options[:directory]|}
|
10
|
-
opts.on('--force', "Force Gem to
|
10
|
+
opts.on('--force', "Force Gem to install, bypassing dependency checks") {|options[:force]|}
|
11
11
|
opts.on('--gen-rdoc', "Generate RDoc documentation for the Gem") {|options[:gen_rdoc]|}
|
12
12
|
opts.parse!
|
13
13
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require 'rubygems/test_case'
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rubygems/gem_openssl'
|
4
4
|
require 'rubygems/installer'
|
5
5
|
require 'pathname'
|
6
6
|
require 'tmpdir'
|
7
7
|
|
8
|
-
class TestGem <
|
8
|
+
class TestGem < Gem::TestCase
|
9
9
|
|
10
10
|
def setup
|
11
11
|
super
|
@@ -301,6 +301,7 @@ class TestGem < RubyGemTestCase
|
|
301
301
|
]
|
302
302
|
|
303
303
|
assert_equal expected, Gem.find_files('sff/discover')
|
304
|
+
assert_equal expected, Gem.find_files('sff/**.rb'), '[ruby-core:31730]'
|
304
305
|
ensure
|
305
306
|
assert_equal cwd, $LOAD_PATH.shift
|
306
307
|
end
|
@@ -329,11 +330,18 @@ class TestGem < RubyGemTestCase
|
|
329
330
|
assert_equal true, Gem.loaded_specs.keys.include?('foo')
|
330
331
|
end
|
331
332
|
|
333
|
+
def util_path
|
334
|
+
ENV.delete "GEM_HOME"
|
335
|
+
ENV.delete "GEM_PATH"
|
336
|
+
end
|
337
|
+
|
332
338
|
def test_self_path
|
333
339
|
assert_equal [Gem.dir], Gem.path
|
334
340
|
end
|
335
341
|
|
336
342
|
def test_self_path_default
|
343
|
+
util_path
|
344
|
+
|
337
345
|
if defined? APPLE_GEM_HOME
|
338
346
|
orig_APPLE_GEM_HOME = APPLE_GEM_HOME
|
339
347
|
Object.send :remove_const, :APPLE_GEM_HOME
|
@@ -347,6 +355,8 @@ class TestGem < RubyGemTestCase
|
|
347
355
|
|
348
356
|
unless win_platform?
|
349
357
|
def test_self_path_APPLE_GEM_HOME
|
358
|
+
util_path
|
359
|
+
|
350
360
|
Gem.clear_paths
|
351
361
|
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
352
362
|
Gem.const_set :APPLE_GEM_HOME, apple_gem_home
|