rubygems-update 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (146) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +8 -1
  3. data/ChangeLog +164 -0
  4. data/History.txt +52 -1
  5. data/Manifest.txt +8 -8
  6. data/README +3 -2
  7. data/Rakefile +49 -5
  8. data/bin/gem +2 -2
  9. data/bin/update_rubygems +9 -11
  10. data/cruise_config.rb +4 -3
  11. data/hide_lib_for_update/note.txt +5 -0
  12. data/lib/rbconfig/datadir.rb +10 -14
  13. data/lib/rubygems.rb +117 -140
  14. data/lib/rubygems/builder.rb +4 -2
  15. data/lib/rubygems/command.rb +51 -48
  16. data/lib/rubygems/command_manager.rb +2 -0
  17. data/lib/rubygems/commands/dependency_command.rb +10 -5
  18. data/lib/rubygems/commands/environment_command.rb +1 -1
  19. data/lib/rubygems/commands/fetch_command.rb +6 -5
  20. data/lib/rubygems/commands/install_command.rb +1 -0
  21. data/lib/rubygems/commands/mirror_command.rb +8 -8
  22. data/lib/rubygems/commands/owner_command.rb +75 -0
  23. data/lib/rubygems/commands/pristine_command.rb +1 -1
  24. data/lib/rubygems/commands/push_command.rb +45 -0
  25. data/lib/rubygems/commands/query_command.rb +4 -1
  26. data/lib/rubygems/commands/rdoc_command.rb +24 -9
  27. data/lib/rubygems/commands/server_command.rb +6 -0
  28. data/lib/rubygems/commands/setup_command.rb +14 -4
  29. data/lib/rubygems/commands/unpack_command.rb +2 -2
  30. data/lib/rubygems/commands/update_command.rb +2 -2
  31. data/lib/rubygems/commands/which_command.rb +7 -9
  32. data/lib/rubygems/config_file.rb +100 -26
  33. data/lib/rubygems/defaults.rb +1 -1
  34. data/lib/rubygems/dependency.rb +133 -75
  35. data/lib/rubygems/dependency_installer.rb +28 -10
  36. data/lib/rubygems/dependency_list.rb +41 -12
  37. data/lib/rubygems/doc_manager.rb +7 -0
  38. data/lib/rubygems/format.rb +16 -20
  39. data/lib/rubygems/gem_openssl.rb +1 -1
  40. data/lib/rubygems/gem_path_searcher.rb +10 -12
  41. data/lib/rubygems/gemcutter_utilities.rb +49 -0
  42. data/lib/rubygems/indexer.rb +2 -2
  43. data/lib/rubygems/install_update_options.rb +1 -9
  44. data/lib/rubygems/installer.rb +35 -76
  45. data/lib/rubygems/local_remote_options.rb +1 -2
  46. data/lib/rubygems/package.rb +0 -1
  47. data/lib/rubygems/package/tar_input.rb +3 -1
  48. data/lib/rubygems/package_task.rb +16 -11
  49. data/lib/rubygems/remote_fetcher.rb +22 -8
  50. data/lib/rubygems/requirement.rb +78 -100
  51. data/lib/rubygems/server.rb +41 -10
  52. data/lib/rubygems/source_index.rb +5 -5
  53. data/lib/rubygems/spec_fetcher.rb +2 -2
  54. data/lib/rubygems/specification.rb +66 -16
  55. data/lib/rubygems/test_utilities.rb +33 -4
  56. data/lib/rubygems/uninstaller.rb +3 -3
  57. data/lib/rubygems/user_interaction.rb +45 -0
  58. data/lib/rubygems/validator.rb +6 -7
  59. data/lib/rubygems/version.rb +206 -149
  60. data/lib/rubygems/version_option.rb +16 -0
  61. data/test/fake_certlib/openssl.rb +1 -1
  62. data/test/functional.rb +0 -7
  63. data/test/gem_installer_test_case.rb +4 -4
  64. data/test/gem_package_tar_test_case.rb +1 -1
  65. data/test/gemutilities.rb +35 -31
  66. data/test/insure_session.rb +0 -8
  67. data/test/mockgemui.rb +0 -8
  68. data/test/simple_gem.rb +2 -8
  69. data/test/test_config.rb +3 -10
  70. data/test/test_gem.rb +9 -14
  71. data/test/test_gem_builder.rb +1 -7
  72. data/test/test_gem_command.rb +1 -8
  73. data/test/test_gem_command_manager.rb +1 -7
  74. data/test/test_gem_commands_build_command.rb +4 -4
  75. data/test/test_gem_commands_cert_command.rb +1 -2
  76. data/test/test_gem_commands_check_command.rb +1 -7
  77. data/test/test_gem_commands_contents_command.rb +1 -1
  78. data/test/test_gem_commands_dependency_command.rb +17 -31
  79. data/test/test_gem_commands_environment_command.rb +1 -1
  80. data/test/test_gem_commands_fetch_command.rb +14 -12
  81. data/test/test_gem_commands_generate_index_command.rb +1 -1
  82. data/test/test_gem_commands_install_command.rb +22 -20
  83. data/test/test_gem_commands_list_command.rb +1 -1
  84. data/test/test_gem_commands_lock_command.rb +1 -1
  85. data/test/test_gem_commands_mirror_command.rb +5 -5
  86. data/test/test_gem_commands_outdated_command.rb +3 -5
  87. data/test/test_gem_commands_owner_command.rb +105 -0
  88. data/test/test_gem_commands_pristine_command.rb +2 -2
  89. data/test/test_gem_commands_push_command.rb +61 -0
  90. data/test/test_gem_commands_query_command.rb +23 -56
  91. data/test/test_gem_commands_server_command.rb +1 -1
  92. data/test/test_gem_commands_sources_command.rb +1 -70
  93. data/test/test_gem_commands_specification_command.rb +3 -4
  94. data/test/test_gem_commands_stale_command.rb +1 -1
  95. data/test/test_gem_commands_uninstall_command.rb +3 -4
  96. data/test/test_gem_commands_unpack_command.rb +1 -1
  97. data/test/test_gem_commands_update_command.rb +13 -13
  98. data/test/test_gem_commands_which_command.rb +66 -0
  99. data/test/test_gem_config_file.rb +13 -7
  100. data/test/test_gem_dependency.rb +82 -134
  101. data/test/test_gem_dependency_installer.rb +55 -30
  102. data/test/test_gem_dependency_list.rb +28 -7
  103. data/test/test_gem_doc_manager.rb +1 -7
  104. data/test/test_gem_ext_configure_builder.rb +2 -2
  105. data/test/test_gem_ext_ext_conf_builder.rb +1 -1
  106. data/test/test_gem_ext_rake_builder.rb +1 -1
  107. data/test/test_gem_format.rb +14 -11
  108. data/test/test_gem_gem_path_searcher.rb +12 -1
  109. data/test/test_gem_gem_runner.rb +1 -1
  110. data/test/test_gem_gemcutter_utilities.rb +103 -0
  111. data/test/test_gem_indexer.rb +44 -51
  112. data/test/test_gem_install_update_options.rb +1 -7
  113. data/test/test_gem_installer.rb +22 -82
  114. data/test/test_gem_local_remote_options.rb +1 -1
  115. data/test/test_gem_package_tar_header.rb +1 -8
  116. data/test/test_gem_package_tar_input.rb +1 -8
  117. data/test/test_gem_package_tar_output.rb +1 -8
  118. data/test/test_gem_package_tar_reader.rb +1 -8
  119. data/test/test_gem_package_tar_reader_entry.rb +1 -8
  120. data/test/test_gem_package_tar_writer.rb +1 -8
  121. data/test/test_gem_package_task.rb +1 -25
  122. data/test/test_gem_platform.rb +4 -4
  123. data/test/test_gem_remote_fetcher.rb +31 -21
  124. data/test/test_gem_requirement.rb +210 -140
  125. data/test/test_gem_server.rb +36 -1
  126. data/test/test_gem_source_index.rb +7 -13
  127. data/test/test_gem_spec_fetcher.rb +17 -47
  128. data/test/test_gem_specification.rb +7 -20
  129. data/test/test_gem_stream_ui.rb +21 -1
  130. data/test/test_gem_uninstaller.rb +1 -2
  131. data/test/test_gem_validator.rb +2 -8
  132. data/test/test_gem_version.rb +110 -254
  133. data/test/test_gem_version_option.rb +1 -1
  134. data/test/test_kernel.rb +1 -7
  135. data/util/CL2notes +1 -1
  136. data/util/gem_prelude.rb.template +64 -41
  137. metadata +33 -71
  138. metadata.gz.sig +0 -0
  139. data/lib/rubygems/digest/digest_adapter.rb +0 -49
  140. data/lib/rubygems/digest/md5.rb +0 -23
  141. data/lib/rubygems/digest/sha1.rb +0 -22
  142. data/lib/rubygems/digest/sha2.rb +0 -22
  143. data/lib/rubygems/timer.rb +0 -28
  144. data/test/test_gem_digest.rb +0 -46
  145. data/test/test_gem_source_info_cache.rb +0 -447
  146. data/test/test_gem_source_info_cache_entry.rb +0 -78
@@ -253,18 +253,18 @@ class Gem::SourceIndex
253
253
  # change in the index.
254
254
 
255
255
  def index_signature
256
- require 'rubygems/digest/sha2'
256
+ require 'digest'
257
257
 
258
- Gem::SHA256.new.hexdigest(@gems.keys.sort.join(',')).to_s
258
+ Digest::SHA256.new.hexdigest(@gems.keys.sort.join(',')).to_s
259
259
  end
260
260
 
261
261
  ##
262
262
  # The signature for the given gem specification.
263
263
 
264
264
  def gem_signature(gem_full_name)
265
- require 'rubygems/digest/sha2'
265
+ require 'digest'
266
266
 
267
- Gem::SHA256.new.hexdigest(@gems[gem_full_name].to_yaml).to_s
267
+ Digest::SHA256.new.hexdigest(@gems[gem_full_name].to_yaml).to_s
268
268
  end
269
269
 
270
270
  def size
@@ -303,7 +303,7 @@ class Gem::SourceIndex
303
303
  version_requirement = platform_only || Gem::Requirement.default
304
304
  when Gem::Dependency then
305
305
  only_platform = platform_only
306
- version_requirement = gem_pattern.version_requirements
306
+ version_requirement = gem_pattern.requirement
307
307
  gem_pattern = if Regexp === gem_pattern.name then
308
308
  gem_pattern.name
309
309
  elsif gem_pattern.name.empty? then
@@ -197,7 +197,7 @@ class Gem::SpecFetcher
197
197
 
198
198
  if type == :all
199
199
  list.values.map do |gems|
200
- gems.reject! { |g| g[1].prerelease? }
200
+ gems.reject! { |g| !g[1] || g[1].prerelease? }
201
201
  end
202
202
  end
203
203
 
@@ -242,7 +242,7 @@ class Gem::SpecFetcher
242
242
  FileUtils.mkdir_p cache_dir
243
243
 
244
244
  open local_file, 'wb' do |io|
245
- Marshal.dump specs, io
245
+ io << spec_dump
246
246
  end
247
247
  rescue
248
248
  end
@@ -17,7 +17,7 @@ class Date; end # for ruby_code if date.rb wasn't required
17
17
  # defined in a .gemspec file or a Rakefile, and looks like this:
18
18
  #
19
19
  # spec = Gem::Specification.new do |s|
20
- # s.name = 'rfoo'
20
+ # s.name = 'example'
21
21
  # s.version = '1.0'
22
22
  # s.summary = 'Example gem specification'
23
23
  # ...
@@ -409,15 +409,19 @@ class Gem::Specification
409
409
  # :startdoc:
410
410
 
411
411
  ##
412
- # Specification constructor. Assigns the default values to the attributes
413
- # and yields itself for further initialization.
412
+ # Specification constructor. Assigns the default values to the
413
+ # attributes and yields itself for further
414
+ # initialization. Optionally takes +name+ and +version+.
414
415
 
415
- def initialize
416
+ def initialize name = nil, version = nil
416
417
  @new_platform = nil
417
418
  assign_defaults
418
419
  @loaded = false
419
420
  @loaded_from = nil
420
421
 
422
+ self.name = name if name
423
+ self.version = version if version
424
+
421
425
  yield self if block_given?
422
426
 
423
427
  @@gather.call(self) if @@gather
@@ -498,7 +502,7 @@ class Gem::Specification
498
502
 
499
503
  def self.load(filename)
500
504
  gemspec = nil
501
- fail "NESTED Specification.load calls not allowed!" if @@gather
505
+ raise "NESTED Specification.load calls not allowed!" if @@gather
502
506
  @@gather = proc { |gs| gemspec = gs }
503
507
  data = File.read(filename)
504
508
  eval(data)
@@ -598,10 +602,12 @@ class Gem::Specification
598
602
  end
599
603
 
600
604
  ##
601
- # The default (generated) file name of the gem.
605
+ # The default (generated) file name of the gem. See also #spec_name.
606
+ #
607
+ # spec.file_name # => "example-1.0.gem"
602
608
 
603
609
  def file_name
604
- full_name + ".gem"
610
+ full_name + '.gem'
605
611
  end
606
612
 
607
613
  ##
@@ -620,7 +626,7 @@ class Gem::Specification
620
626
 
621
627
  def satisfies_requirement?(dependency)
622
628
  return @name == dependency.name &&
623
- dependency.version_requirements.satisfied_by?(@version)
629
+ dependency.requirement.satisfied_by?(@version)
624
630
  end
625
631
 
626
632
  ##
@@ -630,6 +636,15 @@ class Gem::Specification
630
636
  [@name, @version, @new_platform == Gem::Platform::RUBY ? -1 : 1]
631
637
  end
632
638
 
639
+ ##
640
+ # The default name of the gemspec. See also #file_name
641
+ #
642
+ # spec.spec_name # => "example-1.0.gemspec"
643
+
644
+ def spec_name
645
+ full_name + '.gemspec'
646
+ end
647
+
633
648
  def <=>(other) # :nodoc:
634
649
  sort_obj <=> other.sort_obj
635
650
  end
@@ -1033,14 +1048,18 @@ class Gem::Specification
1033
1048
  ##
1034
1049
  # :attr_accessor: rubygems_version
1035
1050
  #
1036
- # The version of RubyGems used to create this gem
1051
+ # The version of RubyGems used to create this gem.
1052
+ #
1053
+ # Do not set this, it is set automatically when the gem is packaged.
1037
1054
 
1038
1055
  required_attribute :rubygems_version, Gem::RubyGemsVersion
1039
1056
 
1040
1057
  ##
1041
1058
  # :attr_accessor: specification_version
1042
1059
  #
1043
- # The Gem::Specification version of this gemspec
1060
+ # The Gem::Specification version of this gemspec.
1061
+ #
1062
+ # Do not set this, it is set automatically when the gem is packaged.
1044
1063
 
1045
1064
  required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION
1046
1065
 
@@ -1062,6 +1081,8 @@ class Gem::Specification
1062
1081
  # :attr_accessor: date
1063
1082
  #
1064
1083
  # The date this gem was created
1084
+ #
1085
+ # Do not set this, it is set automatically when the gem is packaged.
1065
1086
 
1066
1087
  required_attribute :date, TODAY
1067
1088
 
@@ -1069,13 +1090,20 @@ class Gem::Specification
1069
1090
  # :attr_accessor: summary
1070
1091
  #
1071
1092
  # A short summary of this gem's description. Displayed in `gem list -d`.
1093
+ #
1094
+ # The description should be more detailed than the summary. For example,
1095
+ # you might wish to copy the entire README into the description.
1096
+ #
1097
+ # As of RubyGems 1.3.2 newlines are no longer stripped.
1072
1098
 
1073
1099
  required_attribute :summary
1074
1100
 
1075
1101
  ##
1076
1102
  # :attr_accessor: require_paths
1077
1103
  #
1078
- # Paths in the gem to add to $LOAD_PATH when this gem is activated
1104
+ # Paths in the gem to add to $LOAD_PATH when this gem is activated.
1105
+ #
1106
+ # The default 'lib' is typically sufficient.
1079
1107
 
1080
1108
  required_attribute :require_paths, ['lib']
1081
1109
 
@@ -1085,6 +1113,13 @@ class Gem::Specification
1085
1113
  # :attr_accessor: email
1086
1114
  #
1087
1115
  # A contact email for this gem
1116
+ #
1117
+ # If you are providing multiple authors and multiple emails they should be
1118
+ # in the same order such that:
1119
+ #
1120
+ # Hash[*spec.authors.zip(spec.emails).flatten]
1121
+ #
1122
+ # Gives a hash of author name to email address.
1088
1123
 
1089
1124
  attribute :email
1090
1125
 
@@ -1122,6 +1157,8 @@ class Gem::Specification
1122
1157
  # :attr_accessor: default_executable
1123
1158
  #
1124
1159
  # The default executable for this gem.
1160
+ #
1161
+ # This is not used.
1125
1162
 
1126
1163
  attribute :default_executable
1127
1164
 
@@ -1149,7 +1186,7 @@ class Gem::Specification
1149
1186
  ##
1150
1187
  # :attr_accessor: required_ruby_version
1151
1188
  #
1152
- # The ruby of version required by this gem
1189
+ # The version of ruby required by this gem
1153
1190
 
1154
1191
  attribute :required_ruby_version, Gem::Requirement.default
1155
1192
 
@@ -1164,6 +1201,9 @@ class Gem::Specification
1164
1201
  # :attr_accessor: platform
1165
1202
  #
1166
1203
  # The platform this gem runs on. See Gem::Platform for details.
1204
+ #
1205
+ # Setting this to any value other than Gem::Platform::RUBY or
1206
+ # Gem::Platform::CURRENT is probably wrong.
1167
1207
 
1168
1208
  attribute :platform, Gem::Platform::RUBY
1169
1209
 
@@ -1192,7 +1232,14 @@ class Gem::Specification
1192
1232
  ##
1193
1233
  # :attr_accessor: authors
1194
1234
  #
1195
- # The list of authors who wrote this gem
1235
+ # The list of author names who wrote this gem.
1236
+ #
1237
+ # If you are providing multiple authors and multiple emails they should be
1238
+ # in the same order such that:
1239
+ #
1240
+ # Hash[*spec.authors.zip(spec.emails).flatten]
1241
+ #
1242
+ # Gives a hash of author name to email address.
1196
1243
 
1197
1244
  array_attribute :authors
1198
1245
 
@@ -1228,21 +1275,21 @@ class Gem::Specification
1228
1275
  ##
1229
1276
  # :attr_accessor: rdoc_options
1230
1277
  #
1231
- # An ARGV-style array of options to RDoc
1278
+ # An ARGV style array of options to RDoc
1232
1279
 
1233
1280
  array_attribute :rdoc_options
1234
1281
 
1235
1282
  ##
1236
1283
  # :attr_accessor: extra_rdoc_files
1237
1284
  #
1238
- # Extra files to add to RDoc
1285
+ # Extra files to add to RDoc such as README or doc/examples.txt
1239
1286
 
1240
1287
  array_attribute :extra_rdoc_files
1241
1288
 
1242
1289
  ##
1243
1290
  # :attr_accessor: executables
1244
1291
  #
1245
- # Executables included in the gem
1292
+ # Executables included in the gem.
1246
1293
 
1247
1294
  array_attribute :executables
1248
1295
 
@@ -1266,6 +1313,9 @@ class Gem::Specification
1266
1313
  # :attr_reader: dependencies
1267
1314
  #
1268
1315
  # A list of Gem::Dependency objects this gem depends on.
1316
+ #
1317
+ # Use #add_dependency or #add_development_dependency to add dependencies to
1318
+ # a gem.
1269
1319
 
1270
1320
  array_attribute :dependencies
1271
1321
 
@@ -23,6 +23,7 @@ require 'rubygems/remote_fetcher'
23
23
  class Gem::FakeFetcher
24
24
 
25
25
  attr_reader :data
26
+ attr_reader :last_request
26
27
  attr_accessor :paths
27
28
 
28
29
  def initialize
@@ -30,16 +31,20 @@ class Gem::FakeFetcher
30
31
  @paths = []
31
32
  end
32
33
 
33
- def fetch_path path, mtime = nil
34
+ def find_data(path)
34
35
  path = path.to_s
35
36
  @paths << path
36
- raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
37
+ raise ArgumentError, 'need full URI' unless path =~ %r'^https?://'
37
38
 
38
39
  unless @data.key? path then
39
40
  raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
40
41
  end
41
42
 
42
- data = @data[path]
43
+ @data[path]
44
+ end
45
+
46
+ def fetch_path path, mtime = nil
47
+ data = find_data(path)
43
48
 
44
49
  if data.respond_to?(:call) then
45
50
  data.call
@@ -52,6 +57,30 @@ class Gem::FakeFetcher
52
57
  end
53
58
  end
54
59
 
60
+ # Thanks, FakeWeb!
61
+ def open_uri_or_path(path)
62
+ data = find_data(path)
63
+ body, code, msg = data
64
+
65
+ response = Net::HTTPResponse.send(:response_class, code.to_s).new("1.0", code.to_s, msg)
66
+ response.instance_variable_set(:@body, body)
67
+ response.instance_variable_set(:@read, true)
68
+ response
69
+ end
70
+
71
+ def request(uri, request_class, last_modified = nil)
72
+ data = find_data(uri)
73
+ body, code, msg = data
74
+
75
+ @last_request = request_class.new uri.request_uri
76
+ yield @last_request if block_given?
77
+
78
+ response = Net::HTTPResponse.send(:response_class, code.to_s).new("1.0", code.to_s, msg)
79
+ response.instance_variable_set(:@body, body)
80
+ response.instance_variable_set(:@read, true)
81
+ response
82
+ end
83
+
55
84
  def fetch_size(path)
56
85
  path = path.to_s
57
86
  @paths << path
@@ -68,7 +97,7 @@ class Gem::FakeFetcher
68
97
  end
69
98
 
70
99
  def download spec, source_uri, install_dir = Gem.dir
71
- name = "#{spec.full_name}.gem"
100
+ name = spec.file_name
72
101
  path = File.join(install_dir, 'cache', name)
73
102
 
74
103
  Gem.ensure_gem_subdirectories install_dir
@@ -202,7 +202,7 @@ class Gem::Uninstaller
202
202
  spec.name, spec.version, spec.original_platform].join '-'
203
203
 
204
204
  spec_dir = File.join spec.installation_path, 'specifications'
205
- gemspec = File.join spec_dir, "#{spec.full_name}.gemspec"
205
+ gemspec = File.join spec_dir, spec.spec_name
206
206
 
207
207
  unless File.exist? gemspec then
208
208
  gemspec = File.join spec_dir, "#{original_platform_name}.gemspec"
@@ -211,7 +211,7 @@ class Gem::Uninstaller
211
211
  FileUtils.rm_rf gemspec
212
212
 
213
213
  cache_dir = File.join spec.installation_path, 'cache'
214
- gem = File.join cache_dir, "#{spec.full_name}.gem"
214
+ gem = File.join cache_dir, spec.file_name
215
215
 
216
216
  unless File.exist? gem then
217
217
  gem = File.join cache_dir, "#{original_platform_name}.gem"
@@ -251,7 +251,7 @@ class Gem::Uninstaller
251
251
  spec.dependent_gems.each do |gem,dep,satlist|
252
252
  msg <<
253
253
  ("#{gem.name}-#{gem.version} depends on " +
254
- "[#{dep.name} (#{dep.version_requirements})]")
254
+ "[#{dep.name} (#{dep.requirement})]")
255
255
  end
256
256
  msg << 'If you remove this gems, one or more dependencies will not be met.'
257
257
  msg << 'Continue with Uninstall?'
@@ -112,6 +112,7 @@ module Gem::UserInteraction
112
112
  :alert_error,
113
113
  :alert_warning,
114
114
  :ask,
115
+ :ask_for_password,
115
116
  :ask_yes_no,
116
117
  :choose_from_list,
117
118
  :say,
@@ -217,6 +218,50 @@ class Gem::StreamUI
217
218
  result
218
219
  end
219
220
 
221
+ ##
222
+ # Ask for a password. Does not echo response to terminal.
223
+
224
+ def ask_for_password(question)
225
+ return nil if not @ins.tty?
226
+
227
+ @outs.print(question + " ")
228
+ @outs.flush
229
+
230
+ Gem.win_platform? ? ask_for_password_on_windows : ask_for_password_on_unix
231
+ end
232
+
233
+ ##
234
+ # Asks for a password that works on windows. Ripped from the Heroku gem.
235
+
236
+ def ask_for_password_on_windows
237
+ require "Win32API"
238
+ char = nil
239
+ password = ''
240
+
241
+ while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
242
+ break if char == 10 || char == 13 # received carriage return or newline
243
+ if char == 127 || char == 8 # backspace and delete
244
+ password.slice!(-1, 1)
245
+ else
246
+ password << char.chr
247
+ end
248
+ end
249
+
250
+ puts
251
+ password
252
+ end
253
+
254
+ ##
255
+ # Asks for a password that works on unix
256
+
257
+ def ask_for_password_on_unix
258
+ system "stty -echo"
259
+ password = @ins.gets
260
+ password.chomp! if password
261
+ system "stty echo"
262
+ password
263
+ end
264
+
220
265
  ##
221
266
  # Display a statement.
222
267
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  require 'find'
8
8
 
9
- require 'rubygems/digest/md5'
9
+ require 'digest'
10
10
  require 'rubygems/format'
11
11
  require 'rubygems/installer'
12
12
 
@@ -40,7 +40,7 @@ class Gem::Validator
40
40
  sum_data = gem_data.gsub(/MD5SUM = "([a-z0-9]+)"/,
41
41
  "MD5SUM = \"#{"F" * 32}\"")
42
42
 
43
- unless Gem::MD5.hexdigest(sum_data) == $1.to_s then
43
+ unless Digest::MD5.hexdigest(sum_data) == $1.to_s then
44
44
  raise Gem::VerificationError, 'invalid checksum for gem file'
45
45
  end
46
46
  end
@@ -93,9 +93,8 @@ class Gem::Validator
93
93
  next unless gems.include? gem_spec.name unless gems.empty?
94
94
 
95
95
  install_dir = gem_spec.installation_path
96
- gem_path = File.join(install_dir, "cache", gem_spec.full_name) + ".gem"
97
- spec_path = File.join(install_dir, "specifications",
98
- gem_spec.full_name) + ".gemspec"
96
+ gem_path = File.join install_dir, "cache", gem_spec.file_name
97
+ spec_path = File.join install_dir, "specifications", gem_spec.spec_name
99
98
  gem_directory = gem_spec.full_gem_path
100
99
 
101
100
  unless File.directory? gem_directory then
@@ -139,8 +138,8 @@ class Gem::Validator
139
138
  next unless data # HACK `gem check -a mkrf`
140
139
 
141
140
  open File.join(gem_directory, entry['path']), Gem.binary_mode do |f|
142
- unless Gem::MD5.hexdigest(f.read).to_s ==
143
- Gem::MD5.hexdigest(data).to_s then
141
+ unless Digest::MD5.hexdigest(f.read).to_s ==
142
+ Digest::MD5.hexdigest(data).to_s then
144
143
  errors[gem_name][entry['path']] = "Modified from original"
145
144
  end
146
145
  end