rubygems-update 1.0.1 → 1.1.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.

Files changed (172) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +248 -0
  3. data/README +2 -0
  4. data/Rakefile +47 -23
  5. data/bin/gem +9 -4
  6. data/bin/update_rubygems +15 -1
  7. data/examples/application/bin/myapp +0 -0
  8. data/lib/rubygems.rb +506 -373
  9. data/lib/rubygems/builder.rb +14 -7
  10. data/lib/rubygems/command.rb +9 -9
  11. data/lib/rubygems/command_manager.rb +1 -0
  12. data/lib/rubygems/commands/cleanup_command.rb +67 -69
  13. data/lib/rubygems/commands/environment_command.rb +16 -10
  14. data/lib/rubygems/commands/fetch_command.rb +7 -9
  15. data/lib/rubygems/commands/install_command.rb +9 -3
  16. data/lib/rubygems/commands/list_command.rb +2 -4
  17. data/lib/rubygems/commands/mirror_command.rb +1 -1
  18. data/lib/rubygems/commands/query_command.rb +52 -5
  19. data/lib/rubygems/commands/sources_command.rb +19 -10
  20. data/lib/rubygems/commands/specification_command.rb +10 -6
  21. data/lib/rubygems/commands/uninstall_command.rb +23 -6
  22. data/lib/rubygems/commands/unpack_command.rb +15 -3
  23. data/lib/rubygems/commands/update_command.rb +27 -25
  24. data/lib/rubygems/custom_require.rb +1 -1
  25. data/lib/rubygems/defaults.rb +8 -1
  26. data/lib/rubygems/dependency_installer.rb +72 -104
  27. data/lib/rubygems/digest/digest_adapter.rb +0 -0
  28. data/lib/rubygems/digest/md5.rb +0 -0
  29. data/lib/rubygems/digest/sha1.rb +0 -0
  30. data/lib/rubygems/digest/sha2.rb +0 -0
  31. data/lib/rubygems/exceptions.rb +22 -1
  32. data/lib/rubygems/format.rb +16 -10
  33. data/lib/rubygems/indexer.rb +46 -33
  34. data/lib/rubygems/indexer/abstract_index_builder.rb +10 -2
  35. data/lib/rubygems/indexer/latest_index_builder.rb +35 -0
  36. data/lib/rubygems/indexer/master_index_builder.rb +9 -8
  37. data/lib/rubygems/indexer/quick_index_builder.rb +5 -3
  38. data/lib/rubygems/install_update_options.rb +7 -1
  39. data/lib/rubygems/installer.rb +8 -5
  40. data/lib/rubygems/package.rb +17 -774
  41. data/lib/rubygems/package/f_sync_dir.rb +24 -0
  42. data/lib/rubygems/package/tar_header.rb +245 -0
  43. data/lib/rubygems/package/tar_input.rb +219 -0
  44. data/lib/rubygems/package/tar_output.rb +143 -0
  45. data/lib/rubygems/package/tar_reader.rb +86 -0
  46. data/lib/rubygems/package/tar_reader/entry.rb +99 -0
  47. data/lib/rubygems/package/tar_writer.rb +180 -0
  48. data/lib/rubygems/remote_fetcher.rb +131 -16
  49. data/lib/rubygems/requirement.rb +2 -0
  50. data/lib/rubygems/rubygems_version.rb +1 -1
  51. data/lib/rubygems/security.rb +1 -0
  52. data/lib/rubygems/server.rb +85 -104
  53. data/lib/rubygems/source_index.rb +412 -329
  54. data/lib/rubygems/source_info_cache.rb +232 -99
  55. data/lib/rubygems/source_info_cache_entry.rb +14 -4
  56. data/lib/rubygems/specification.rb +9 -10
  57. data/lib/rubygems/timer.rb +0 -0
  58. data/lib/rubygems/uninstaller.rb +56 -32
  59. data/lib/rubygems/user_interaction.rb +4 -10
  60. data/lib/rubygems/validator.rb +0 -0
  61. data/scripts/gemdoc.rb +0 -0
  62. data/scripts/specdoc.rb +0 -0
  63. data/setup.rb +56 -19
  64. data/test/gem_installer_test_case.rb +86 -0
  65. data/test/gem_installer_test_case.rbc +0 -0
  66. data/test/gem_package_tar_test_case.rb +146 -0
  67. data/test/gem_package_tar_test_case.rbc +0 -0
  68. data/test/gemutilities.rb +123 -38
  69. data/test/gemutilities.rbc +0 -0
  70. data/test/mockgemui.rb +5 -13
  71. data/test/mockgemui.rbc +0 -0
  72. data/test/private_key.pem +27 -0
  73. data/test/public_cert.pem +20 -0
  74. data/test/simple_gem.rbc +0 -0
  75. data/test/test_config.rbc +0 -0
  76. data/test/test_gem.rb +46 -4
  77. data/test/test_gem.rbc +0 -0
  78. data/test/test_gem_builder.rbc +0 -0
  79. data/test/test_gem_command.rbc +0 -0
  80. data/test/test_gem_command_manager.rb +4 -2
  81. data/test/test_gem_command_manager.rbc +0 -0
  82. data/test/test_gem_commands_build_command.rbc +0 -0
  83. data/test/test_gem_commands_cert_command.rb +5 -1
  84. data/test/test_gem_commands_cert_command.rbc +0 -0
  85. data/test/test_gem_commands_check_command.rbc +0 -0
  86. data/test/test_gem_commands_contents_command.rbc +0 -0
  87. data/test/test_gem_commands_dependency_command.rbc +0 -0
  88. data/test/test_gem_commands_environment_command.rb +17 -1
  89. data/test/test_gem_commands_environment_command.rbc +0 -0
  90. data/test/test_gem_commands_fetch_command.rb +6 -5
  91. data/test/test_gem_commands_fetch_command.rbc +0 -0
  92. data/test/test_gem_commands_generate_index_command.rbc +0 -0
  93. data/test/test_gem_commands_install_command.rb +36 -28
  94. data/test/test_gem_commands_install_command.rbc +0 -0
  95. data/test/test_gem_commands_mirror_command.rbc +0 -0
  96. data/test/test_gem_commands_pristine_command.rbc +0 -0
  97. data/test/test_gem_commands_query_command.rb +143 -19
  98. data/test/test_gem_commands_query_command.rbc +0 -0
  99. data/test/test_gem_commands_server_command.rb +1 -1
  100. data/test/test_gem_commands_server_command.rbc +0 -0
  101. data/test/test_gem_commands_sources_command.rb +67 -9
  102. data/test/test_gem_commands_sources_command.rbc +0 -0
  103. data/test/test_gem_commands_specification_command.rb +3 -2
  104. data/test/test_gem_commands_specification_command.rbc +0 -0
  105. data/test/test_gem_commands_unpack_command.rb +46 -4
  106. data/test/test_gem_commands_unpack_command.rbc +0 -0
  107. data/test/test_gem_commands_update_command.rb +174 -0
  108. data/test/test_gem_commands_update_command.rbc +0 -0
  109. data/test/test_gem_config_file.rbc +0 -0
  110. data/test/test_gem_dependency.rbc +0 -0
  111. data/test/test_gem_dependency_installer.rb +172 -187
  112. data/test/test_gem_dependency_installer.rbc +0 -0
  113. data/test/test_gem_dependency_list.rbc +0 -0
  114. data/test/test_gem_digest.rb +0 -0
  115. data/test/test_gem_digest.rbc +0 -0
  116. data/test/test_gem_doc_manager.rbc +0 -0
  117. data/test/test_gem_ext_configure_builder.rb +9 -6
  118. data/test/test_gem_ext_configure_builder.rbc +0 -0
  119. data/test/test_gem_ext_ext_conf_builder.rbc +0 -0
  120. data/test/test_gem_ext_rake_builder.rbc +0 -0
  121. data/test/test_gem_format.rb +1 -1
  122. data/test/test_gem_format.rbc +0 -0
  123. data/test/test_gem_gem_path_searcher.rbc +0 -0
  124. data/test/test_gem_gem_runner.rbc +0 -0
  125. data/test/test_gem_indexer.rb +7 -2
  126. data/test/test_gem_indexer.rbc +0 -0
  127. data/test/test_gem_install_update_options.rbc +0 -0
  128. data/test/test_gem_installer.rb +5 -84
  129. data/test/test_gem_installer.rbc +0 -0
  130. data/test/test_gem_local_remote_options.rbc +0 -0
  131. data/test/test_gem_outdated_command.rbc +0 -0
  132. data/test/test_gem_package_tar_header.rb +137 -0
  133. data/test/test_gem_package_tar_header.rbc +0 -0
  134. data/test/test_gem_package_tar_input.rb +119 -0
  135. data/test/test_gem_package_tar_input.rbc +0 -0
  136. data/test/test_gem_package_tar_output.rb +104 -0
  137. data/test/test_gem_package_tar_output.rbc +0 -0
  138. data/test/test_gem_package_tar_reader.rb +53 -0
  139. data/test/test_gem_package_tar_reader.rbc +0 -0
  140. data/test/test_gem_package_tar_reader_entry.rb +116 -0
  141. data/test/test_gem_package_tar_reader_entry.rbc +0 -0
  142. data/test/test_gem_package_tar_writer.rb +151 -0
  143. data/test/test_gem_package_tar_writer.rbc +0 -0
  144. data/test/test_gem_platform.rbc +0 -0
  145. data/test/test_gem_remote_fetcher.rb +189 -17
  146. data/test/test_gem_remote_fetcher.rbc +0 -0
  147. data/test/test_gem_requirement.rbc +0 -0
  148. data/test/test_gem_server.rb +13 -12
  149. data/test/test_gem_server.rbc +0 -0
  150. data/test/test_gem_source_index.rb +305 -56
  151. data/test/test_gem_source_index.rbc +0 -0
  152. data/test/test_gem_source_info_cache.rb +179 -53
  153. data/test/test_gem_source_info_cache.rbc +0 -0
  154. data/test/test_gem_source_info_cache_entry.rb +41 -10
  155. data/test/test_gem_source_info_cache_entry.rbc +0 -0
  156. data/test/test_gem_specification.rb +7 -7
  157. data/test/test_gem_specification.rbc +0 -0
  158. data/test/test_gem_stream_ui.rbc +0 -0
  159. data/test/test_gem_uninstaller.rb +43 -0
  160. data/test/test_gem_uninstaller.rbc +0 -0
  161. data/test/test_gem_validator.rbc +0 -0
  162. data/test/test_gem_version.rb +1 -1
  163. data/test/test_gem_version.rbc +0 -0
  164. data/test/test_gem_version_option.rbc +0 -0
  165. data/test/test_kernel.rb +1 -0
  166. data/test/test_kernel.rbc +0 -0
  167. metadata +85 -8
  168. metadata.gz.sig +0 -0
  169. data/lib/rubygems/gem_open_uri.rb +0 -7
  170. data/lib/rubygems/open-uri.rb +0 -773
  171. data/test/test_open_uri.rb +0 -13
  172. data/test/test_package.rb +0 -608
@@ -0,0 +1,146 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
2
+ require 'rubygems/package'
3
+
4
+ class File
5
+
6
+ # straight from setup.rb
7
+ def self.dir?(path)
8
+ # for corrupted windows stat()
9
+ File.directory?((path[-1,1] == '/') ? path : path + '/')
10
+ end
11
+
12
+ def self.read_b(name)
13
+ File.open(name, "rb") { |f| f.read }
14
+ end
15
+
16
+ end
17
+
18
+ class TarTestCase < RubyGemTestCase
19
+
20
+ def ASCIIZ(str, length)
21
+ str + "\0" * (length - str.length)
22
+ end
23
+
24
+ def SP(s)
25
+ s + " "
26
+ end
27
+
28
+ def SP_Z(s)
29
+ s + " \0"
30
+ end
31
+
32
+ def Z(s)
33
+ s + "\0"
34
+ end
35
+
36
+ def assert_headers_equal(expected, actual)
37
+ expected = expected.to_s unless String === expected
38
+ actual = actual.to_s unless String === actual
39
+
40
+ fields = %w[
41
+ name 100
42
+ mode 8
43
+ uid 8
44
+ gid 8
45
+ size 12
46
+ mtime 12
47
+ checksum 8
48
+ typeflag 1
49
+ linkname 100
50
+ magic 6
51
+ version 2
52
+ uname 32
53
+ gname 32
54
+ devmajor 8
55
+ devminor 8
56
+ prefix 155
57
+ ]
58
+
59
+ offset = 0
60
+
61
+ until fields.empty? do
62
+ name = fields.shift
63
+ length = fields.shift.to_i
64
+
65
+ if name == "checksum" then
66
+ chksum_off = offset
67
+ offset += length
68
+ next
69
+ end
70
+
71
+ assert_equal expected[offset, length], actual[offset, length],
72
+ "Field #{name} of the tar header differs."
73
+
74
+ offset += length
75
+ end
76
+
77
+ assert_equal expected[chksum_off, 8], actual[chksum_off, 8]
78
+ end
79
+
80
+ def calc_checksum(header)
81
+ sum = header.unpack("C*").inject{|s,a| s + a}
82
+ SP(Z(to_oct(sum, 6)))
83
+ end
84
+
85
+ def header(type, fname, dname, length, mode, checksum = nil)
86
+ checksum ||= " " * 8
87
+
88
+ arr = [ # struct tarfile_entry_posix
89
+ ASCIIZ(fname, 100), # char name[100]; ASCII + (Z unless filled)
90
+ Z(to_oct(mode, 7)), # char mode[8]; 0 padded, octal null
91
+ Z(to_oct(0, 7)), # char uid[8]; ditto
92
+ Z(to_oct(0, 7)), # char gid[8]; ditto
93
+ Z(to_oct(length, 11)), # char size[12]; 0 padded, octal, null
94
+ Z(to_oct(0, 11)), # char mtime[12]; 0 padded, octal, null
95
+ checksum, # char checksum[8]; 0 padded, octal, null, space
96
+ type, # char typeflag[1]; file: "0" dir: "5"
97
+ "\0" * 100, # char linkname[100]; ASCII + (Z unless filled)
98
+ "ustar\0", # char magic[6]; "ustar\0"
99
+ "00", # char version[2]; "00"
100
+ ASCIIZ("wheel", 32), # char uname[32]; ASCIIZ
101
+ ASCIIZ("wheel", 32), # char gname[32]; ASCIIZ
102
+ Z(to_oct(0, 7)), # char devmajor[8]; 0 padded, octal, null
103
+ Z(to_oct(0, 7)), # char devminor[8]; 0 padded, octal, null
104
+ ASCIIZ(dname, 155) # char prefix[155]; ASCII + (Z unless filled)
105
+ ]
106
+
107
+ format = "C100C8C8C8C12C12C8CC100C6C2C32C32C8C8C155"
108
+ h = if RUBY_VERSION >= "1.9" then
109
+ arr.join
110
+ else
111
+ arr = arr.join("").split(//).map{|x| x[0]}
112
+ arr.pack format
113
+ end
114
+ ret = h + "\0" * (512 - h.size)
115
+ assert_equal(512, ret.size)
116
+ ret
117
+ end
118
+
119
+ def tar_dir_header(name, prefix, mode)
120
+ h = header("5", name, prefix, 0, mode)
121
+ checksum = calc_checksum(h)
122
+ header("5", name, prefix, 0, mode, checksum)
123
+ end
124
+
125
+ def tar_file_header(fname, dname, mode, length)
126
+ h = header("0", fname, dname, length, mode)
127
+ checksum = calc_checksum(h)
128
+ header("0", fname, dname, length, mode, checksum)
129
+ end
130
+
131
+ def to_oct(n, pad_size)
132
+ "%0#{pad_size}o" % n
133
+ end
134
+
135
+ def util_entry(tar)
136
+ io = TempIO.new tar
137
+ header = Gem::Package::TarHeader.from io
138
+ entry = Gem::Package::TarReader::Entry.new header, io
139
+ end
140
+
141
+ def util_dir_entry
142
+ util_entry tar_dir_header("foo", "bar", 0)
143
+ end
144
+
145
+ end
146
+
@@ -10,9 +10,10 @@ at_exit { $SAFE = 1 }
10
10
  require 'fileutils'
11
11
  require 'test/unit'
12
12
  require 'tmpdir'
13
+ require 'tempfile'
13
14
  require 'uri'
14
- require 'rubygems/gem_open_uri'
15
15
  require 'rubygems/source_info_cache'
16
+ require 'rubygems/package'
16
17
 
17
18
  require File.join(File.expand_path(File.dirname(__FILE__)), 'mockgemui')
18
19
 
@@ -56,6 +57,20 @@ class FakeFetcher
56
57
  data.respond_to?(:call) ? data.call : data.length
57
58
  end
58
59
 
60
+ def download spec, source_uri, install_dir = Gem.dir
61
+ name = "#{spec.full_name}.gem"
62
+ path = File.join(install_dir, 'cache', name)
63
+
64
+ if source_uri =~ /^http/ then
65
+ File.open(path, "wb") do |f|
66
+ f.write fetch_path(File.join(source_uri, "gems", name))
67
+ end
68
+ else
69
+ FileUtils.cp source_uri, path
70
+ end
71
+
72
+ path
73
+ end
59
74
  end
60
75
 
61
76
  class RubyGemTestCase < Test::Unit::TestCase
@@ -76,6 +91,7 @@ class RubyGemTestCase < Test::Unit::TestCase
76
91
  @gemhome = File.join @tempdir, "gemhome"
77
92
  @gemcache = File.join(@gemhome, "source_cache")
78
93
  @usrcache = File.join(@gemhome, ".gem", "user_cache")
94
+ @latest_usrcache = File.join(@gemhome, ".gem", "latest_user_cache")
79
95
 
80
96
  FileUtils.mkdir_p @gemhome
81
97
 
@@ -101,6 +117,11 @@ class RubyGemTestCase < Test::Unit::TestCase
101
117
  end
102
118
 
103
119
  @marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
120
+
121
+ @private_key = File.expand_path File.join(File.dirname(__FILE__),
122
+ 'private_key.pem')
123
+ @public_cert = File.expand_path File.join(File.dirname(__FILE__),
124
+ 'public_cert.pem')
104
125
  end
105
126
 
106
127
  def teardown
@@ -135,25 +156,52 @@ class RubyGemTestCase < Test::Unit::TestCase
135
156
  end
136
157
 
137
158
  def prep_cache_files(lc)
138
- [ [lc.system_cache_file, 'sys'],
139
- [lc.user_cache_file, 'usr'],
140
- ].each do |fn, data|
141
- FileUtils.mkdir_p File.dirname(fn).untaint
142
- open(fn.dup.untaint, "wb") { |f| f.write(Marshal.dump({'key' => data})) }
159
+ @usr_si ||= Gem::SourceIndex.new
160
+ @usr_sice ||= Gem::SourceInfoCacheEntry.new @usr_si, 0
161
+
162
+ @sys_si ||= Gem::SourceIndex.new
163
+ @sys_sice ||= Gem::SourceInfoCacheEntry.new @sys_si, 0
164
+
165
+ latest_si = Gem::SourceIndex.new
166
+ latest_si.add_specs(*@sys_si.latest_specs)
167
+ latest_sys_sice = Gem::SourceInfoCacheEntry.new latest_si, 0
168
+
169
+ latest_si = Gem::SourceIndex.new
170
+ latest_si.add_specs(*@usr_si.latest_specs)
171
+ latest_usr_sice = Gem::SourceInfoCacheEntry.new latest_si, 0
172
+
173
+ [ [lc.system_cache_file, @sys_sice],
174
+ [lc.latest_system_cache_file, latest_sys_sice],
175
+ [lc.user_cache_file, @usr_sice],
176
+ [lc.latest_user_cache_file, latest_usr_sice],
177
+ ].each do |filename, data|
178
+ FileUtils.mkdir_p File.dirname(filename).untaint
179
+
180
+ open filename.dup.untaint, 'wb' do |f|
181
+ f.write Marshal.dump({ @gem_repo => data })
182
+ end
183
+ end
184
+ end
185
+
186
+ def read_cache(path)
187
+ open path.dup.untaint, 'rb' do |io|
188
+ Marshal.load io.read
143
189
  end
144
190
  end
145
191
 
146
- def read_cache(fn)
147
- open(fn.dup.untaint) { |f| Marshal.load f.read }
192
+ def read_binary(path)
193
+ Gem.read_binary path
148
194
  end
149
195
 
150
196
  def write_file(path)
151
197
  path = File.join(@gemhome, path)
152
198
  dir = File.dirname path
153
199
  FileUtils.mkdir_p dir
154
- File.open(path, "w") { |io|
155
- yield(io)
156
- }
200
+
201
+ open path, 'wb' do |io|
202
+ yield io
203
+ end
204
+
157
205
  path
158
206
  end
159
207
 
@@ -204,16 +252,34 @@ class RubyGemTestCase < Test::Unit::TestCase
204
252
  end
205
253
  end
206
254
 
255
+ def util_gem(name, version, &block)
256
+ spec = quick_gem(name, version, &block)
257
+
258
+ util_build_gem spec
259
+
260
+ cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
261
+ FileUtils.mv File.join(@gemhome, 'cache', "#{spec.original_name}.gem"),
262
+ cache_file
263
+ FileUtils.rm File.join(@gemhome, 'specifications',
264
+ "#{spec.full_name}.gemspec")
265
+
266
+ spec.loaded_from = nil
267
+ spec.loaded = false
268
+
269
+ [spec, cache_file]
270
+ end
271
+
207
272
  def util_make_gems
208
- spec = proc do |s|
273
+ init = proc do |s|
209
274
  s.files = %w[lib/code.rb]
210
275
  s.require_paths = %w[lib]
211
276
  end
212
277
 
213
- @a1 = quick_gem('a', '1', &spec)
214
- @a2 = quick_gem('a', '2', &spec)
215
- @b2 = quick_gem('b', '2', &spec)
216
- @c1_2 = quick_gem('c', '1.2', &spec)
278
+ @a1 = quick_gem('a', '1', &init)
279
+ @a2 = quick_gem('a', '2', &init)
280
+ @a_evil9 = quick_gem('a_evil', '9', &init)
281
+ @b2 = quick_gem('b', '2', &init)
282
+ @c1_2 = quick_gem('c', '1.2', &init)
217
283
  @pl1 = quick_gem 'pl', '1' do |s| # l for legacy
218
284
  s.files = %w[lib/code.rb]
219
285
  s.require_paths = %w[lib]
@@ -227,7 +293,7 @@ class RubyGemTestCase < Test::Unit::TestCase
227
293
  write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb]) do end
228
294
  write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb]) do end
229
295
 
230
- [@a1, @a2, @b2, @c1_2, @pl1].each { |spec| util_build_gem spec }
296
+ [@a1, @a2, @a_evil9, @b2, @c1_2, @pl1].each { |spec| util_build_gem spec }
231
297
 
232
298
  FileUtils.rm_r File.join(@gemhome, 'gems', @pl1.original_name)
233
299
 
@@ -256,32 +322,19 @@ class RubyGemTestCase < Test::Unit::TestCase
256
322
  @fetcher = FakeFetcher.new
257
323
  @fetcher.uri = @uri
258
324
 
259
- @gem1 = quick_gem 'gem_one' do |gem|
260
- gem.files = %w[Rakefile lib/gem_one.rb]
261
- end
262
-
263
- @gem2 = quick_gem 'gem_two' do |gem|
264
- gem.files = %w[Rakefile lib/gem_two.rb]
265
- end
266
-
267
- @gem3 = quick_gem 'gem_three' do |gem| # missing gem
268
- gem.files = %w[Rakefile lib/gem_three.rb]
269
- end
270
-
271
- # this gem has a higher version and longer name than the gem we want
272
- @gem4 = quick_gem 'gem_one_evil', '666' do |gem|
273
- gem.files = %w[Rakefile lib/gem_one.rb]
274
- end
325
+ util_make_gems
275
326
 
276
- @all_gems = [@gem1, @gem2, @gem3, @gem4].sort
327
+ @all_gems = [@a1, @a2, @a_evil9, @b2, @c1_2].sort
277
328
  @all_gem_names = @all_gems.map { |gem| gem.full_name }
278
329
 
279
- gem_names = [@gem1.full_name, @gem2.full_name, @gem4.full_name]
330
+ gem_names = [@a1.full_name, @a2.full_name, @b2.full_name]
280
331
  @gem_names = gem_names.sort.join("\n")
281
332
 
282
- @source_index = Gem::SourceIndex.new @gem1.full_name => @gem1,
283
- @gem2.full_name => @gem2,
284
- @gem4.full_name => @gem4
333
+ @source_index = Gem::SourceIndex.new
334
+ @source_index.add_spec @a1
335
+ @source_index.add_spec @a2
336
+ @source_index.add_spec @a_evil9
337
+ @source_index.add_spec @c1_2
285
338
 
286
339
  Gem::RemoteFetcher.instance_variable_set :@fetcher, @fetcher
287
340
  end
@@ -294,7 +347,12 @@ class RubyGemTestCase < Test::Unit::TestCase
294
347
 
295
348
  sice = Gem::SourceInfoCacheEntry.new si, 0
296
349
  sic = Gem::SourceInfoCache.new
350
+
297
351
  sic.set_cache_data( { @gem_repo => sice } )
352
+ sic.update
353
+ sic.write_cache
354
+ sic.reset_cache_data
355
+
298
356
  Gem::SourceInfoCache.instance_variable_set :@cache, sic
299
357
  si
300
358
  end
@@ -313,3 +371,30 @@ class RubyGemTestCase < Test::Unit::TestCase
313
371
 
314
372
  end
315
373
 
374
+ class TempIO
375
+
376
+ @@count = 0
377
+
378
+ def initialize(string = '')
379
+ @tempfile = Tempfile.new "TempIO-#{@@count ++ 1}"
380
+ @tempfile.binmode
381
+ @tempfile.write string
382
+ @tempfile.rewind
383
+ end
384
+
385
+ def method_missing(meth, *args, &block)
386
+ @tempfile.send(meth, *args, &block)
387
+ end
388
+
389
+ def respond_to?(meth)
390
+ @tempfile.respond_to? meth
391
+ end
392
+
393
+ def string
394
+ @tempfile.flush
395
+
396
+ Gem.read_binary @tempfile.path
397
+ end
398
+
399
+ end
400
+
Binary file
@@ -15,9 +15,8 @@ class MockGemUi < Gem::StreamUI
15
15
  def initialize(input="")
16
16
  super(StringIO.new(input), StringIO.new, StringIO.new)
17
17
  @terminated = false
18
- @banged = false
19
18
  end
20
-
19
+
21
20
  def input
22
21
  @ins.string
23
22
  end
@@ -30,22 +29,15 @@ class MockGemUi < Gem::StreamUI
30
29
  @errs.string
31
30
  end
32
31
 
33
- def banged?
34
- @banged
35
- end
36
-
37
32
  def terminated?
38
33
  @terminated
39
34
  end
40
35
 
41
- def terminate_interaction!(status=1)
42
- @terminated = true
43
- @banged = true
44
- fail TermError
45
- end
46
-
47
36
  def terminate_interaction(status=0)
48
37
  @terminated = true
49
- fail TermError
38
+
39
+ raise TermError
50
40
  end
41
+
51
42
  end
43
+
Binary file
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpAIBAAKCAQEAm24C6xixiAxO+i1f3L8XRMwrmLkt6BvT60mZ7g8HsklH3af7
3
+ KNHA6vo/G6sujs2UsNO4HY8BTEneiVOXXWQlcsJ+Z5wEPlIu4zFueAmLefx+n9lE
4
+ ulNIUDoyUenKX4spoMRnX8k4lXL05ho/6JFq0JdDY2DmAaQ4vvTz5mh9kZiybtHQ
5
+ fzcpbA51uY+sjdQRCPDHyUUfh0SmWJlLYMwcBdVeCiGUPBLi+iP5x1btO4uiJK6Q
6
+ IMaV1H3SUCYtKGQKl7qwFd8k8ZBcHYOtmK61tupg3vqWQc0em6SxPj5lws8+1MVK
7
+ twBNIDx24jF4ntxBRNKMZ7FN5SHbobAgDYkPAQIDAQABAoIBAGQilgK8X/PUajVH
8
+ clEXU3hhSV0VQHwfIYKeYms6h6zXBVPKW0dLC0zXeDztJgueasMZQ67XaPCrTpGO
9
+ px/l2zJ6F1HM8/bqn4aDXDY9f/xRLYryQRMBgL8fHzgitNylHWaT4j2Vt7yg2SI9
10
+ mxrMRNKqASJPVR+Nm3l6+n9gpjVb99wEucWplPPHI6KhXLYPZOqSwt+zaH5roz3k
11
+ UQmMs0Bs4hF1SzVl0n+KNoXHOwswVrmBWXgWvm2OhnwY2e26jfejc8toJc/ShAJ7
12
+ C9exnrdimcgEKbd22Sum4G00CDYhcrG5LHHqkgwifcAEVctrvBZBZHGgpxlO8a8U
13
+ eF2Vr7kCgYEAykdrBlzp7Fn9xzUInBQ3NXTTYAq51lpuJdmHQmPuTSY0buoHkd9f
14
+ xbUCZ2qR9QAesrx4hI0qGLetc8IOKDoWx2rPepCCvO3Kx61o1SB5fAvBue03qVoq
15
+ HqACX3Uk24Em8zAz9xuP13ETH/wU7sUbUxRHMCre6ZDmlxn4g5l+Nl8CgYEAxLVl
16
+ 22yBx0dfRr3UsHY9rxll2gIlnfnYfiJzq8wetzt/TfztRV5ILz7FyWqL5d7IoqkA
17
+ fT2V4HAasRJASnKohwJe7z5M/H2ExwkGNFvY+jefb2CoUl5WouK9AlhbqBk3zmHi
18
+ sY5GqQkAp/kHMntEin+sErJw6mkgAGdser3a9p8CgYEAqi31w++tunRnxw4+RRnY
19
+ 7Pdx0k6T1NxV6TAe1ONAHNY0rM/mOHqml65W7GzDiU1lhlh8SIB/VzZJDqfHw15D
20
+ xdh94A7uf0bMILwrA4wDyTIW9Xa3Kpq57vQNqwPiU25QN69pOM+Ob+IpBfLOJafc
21
+ +kOINOUMj5Kh/aQS6Zzci58CgYEAk24dlFKEBjbRCvU2FrfYTYcsljPru7ZJc2gg
22
+ 588J6m0WYf5CWy5pzbcviGFpzvSlzXv7GOLylQ+QgcxbETFUbDPzsT4xd0AgJwj1
23
+ dIKuYgMUZOa94VZBer2TydEtiRS1heJJhKhM/1329u4nXceTvHYqIq1JAfeee48I
24
+ eAoZtaMCgYBz1FjWFQnMTD5nmyPEEZneoBPAR5+9jwOps+IYOoHtazoMFszzd0qo
25
+ JZW3Ihn9KRrVSxfFApKS/ZwjiZ+tJUk7DE/v/0l0sszefY7s8b0pL1lpeZSoL71e
26
+ QoG1WLXUiDV3BRlmyOAF1h3p12KRTLgwubN51ajECwcs3QwE+ZT8Gg==
27
+ -----END RSA PRIVATE KEY-----