slimgems 1.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. data/ChangeLog +5811 -0
  2. data/History.txt +887 -0
  3. data/LICENSE.txt +51 -0
  4. data/README.md +87 -0
  5. data/Rakefile +120 -0
  6. data/bin/gem +25 -0
  7. data/bin/update_slimgems +35 -0
  8. data/bootstrap/Rakefile +4 -0
  9. data/hide_lib_for_update/note.txt +5 -0
  10. data/lib/gauntlet_rubygems.rb +50 -0
  11. data/lib/rbconfig/datadir.rb +20 -0
  12. data/lib/rubygems.rb +1220 -0
  13. data/lib/rubygems/builder.rb +102 -0
  14. data/lib/rubygems/command.rb +534 -0
  15. data/lib/rubygems/command_manager.rb +182 -0
  16. data/lib/rubygems/commands/build_command.rb +53 -0
  17. data/lib/rubygems/commands/cert_command.rb +86 -0
  18. data/lib/rubygems/commands/check_command.rb +80 -0
  19. data/lib/rubygems/commands/cleanup_command.rb +106 -0
  20. data/lib/rubygems/commands/contents_command.rb +98 -0
  21. data/lib/rubygems/commands/dependency_command.rb +195 -0
  22. data/lib/rubygems/commands/environment_command.rb +132 -0
  23. data/lib/rubygems/commands/fetch_command.rb +67 -0
  24. data/lib/rubygems/commands/generate_index_command.rb +133 -0
  25. data/lib/rubygems/commands/help_command.rb +172 -0
  26. data/lib/rubygems/commands/install_command.rb +178 -0
  27. data/lib/rubygems/commands/list_command.rb +35 -0
  28. data/lib/rubygems/commands/lock_command.rb +110 -0
  29. data/lib/rubygems/commands/mirror_command.rb +111 -0
  30. data/lib/rubygems/commands/outdated_command.rb +33 -0
  31. data/lib/rubygems/commands/owner_command.rb +75 -0
  32. data/lib/rubygems/commands/pristine_command.rb +93 -0
  33. data/lib/rubygems/commands/push_command.rb +56 -0
  34. data/lib/rubygems/commands/query_command.rb +280 -0
  35. data/lib/rubygems/commands/rdoc_command.rb +91 -0
  36. data/lib/rubygems/commands/search_command.rb +31 -0
  37. data/lib/rubygems/commands/server_command.rb +86 -0
  38. data/lib/rubygems/commands/setup_command.rb +387 -0
  39. data/lib/rubygems/commands/sources_command.rb +157 -0
  40. data/lib/rubygems/commands/specification_command.rb +125 -0
  41. data/lib/rubygems/commands/stale_command.rb +27 -0
  42. data/lib/rubygems/commands/uninstall_command.rb +83 -0
  43. data/lib/rubygems/commands/unpack_command.rb +121 -0
  44. data/lib/rubygems/commands/update_command.rb +212 -0
  45. data/lib/rubygems/commands/which_command.rb +86 -0
  46. data/lib/rubygems/config_file.rb +345 -0
  47. data/lib/rubygems/custom_require.rb +44 -0
  48. data/lib/rubygems/defaults.rb +101 -0
  49. data/lib/rubygems/dependency.rb +227 -0
  50. data/lib/rubygems/dependency_installer.rb +286 -0
  51. data/lib/rubygems/dependency_list.rb +208 -0
  52. data/lib/rubygems/doc_manager.rb +242 -0
  53. data/lib/rubygems/errors.rb +35 -0
  54. data/lib/rubygems/exceptions.rb +91 -0
  55. data/lib/rubygems/ext.rb +18 -0
  56. data/lib/rubygems/ext/builder.rb +56 -0
  57. data/lib/rubygems/ext/configure_builder.rb +25 -0
  58. data/lib/rubygems/ext/ext_conf_builder.rb +24 -0
  59. data/lib/rubygems/ext/rake_builder.rb +39 -0
  60. data/lib/rubygems/format.rb +81 -0
  61. data/lib/rubygems/gem_openssl.rb +92 -0
  62. data/lib/rubygems/gem_path_searcher.rb +100 -0
  63. data/lib/rubygems/gem_runner.rb +79 -0
  64. data/lib/rubygems/gemcutter_utilities.rb +49 -0
  65. data/lib/rubygems/indexer.rb +720 -0
  66. data/lib/rubygems/install_update_options.rb +125 -0
  67. data/lib/rubygems/installer.rb +604 -0
  68. data/lib/rubygems/local_remote_options.rb +135 -0
  69. data/lib/rubygems/old_format.rb +153 -0
  70. data/lib/rubygems/package.rb +97 -0
  71. data/lib/rubygems/package/f_sync_dir.rb +23 -0
  72. data/lib/rubygems/package/tar_header.rb +266 -0
  73. data/lib/rubygems/package/tar_input.rb +222 -0
  74. data/lib/rubygems/package/tar_output.rb +144 -0
  75. data/lib/rubygems/package/tar_reader.rb +106 -0
  76. data/lib/rubygems/package/tar_reader/entry.rb +141 -0
  77. data/lib/rubygems/package/tar_writer.rb +241 -0
  78. data/lib/rubygems/package_task.rb +126 -0
  79. data/lib/rubygems/platform.rb +183 -0
  80. data/lib/rubygems/remote_fetcher.rb +414 -0
  81. data/lib/rubygems/require_paths_builder.rb +18 -0
  82. data/lib/rubygems/requirement.rb +153 -0
  83. data/lib/rubygems/security.rb +814 -0
  84. data/lib/rubygems/server.rb +872 -0
  85. data/lib/rubygems/source_index.rb +597 -0
  86. data/lib/rubygems/source_info_cache.rb +395 -0
  87. data/lib/rubygems/source_info_cache_entry.rb +56 -0
  88. data/lib/rubygems/spec_fetcher.rb +337 -0
  89. data/lib/rubygems/specification.rb +1486 -0
  90. data/lib/rubygems/test_utilities.rb +147 -0
  91. data/lib/rubygems/text.rb +65 -0
  92. data/lib/rubygems/uninstaller.rb +278 -0
  93. data/lib/rubygems/user_interaction.rb +527 -0
  94. data/lib/rubygems/validator.rb +240 -0
  95. data/lib/rubygems/version.rb +316 -0
  96. data/lib/rubygems/version_option.rb +65 -0
  97. data/lib/ubygems.rb +10 -0
  98. data/setup.rb +42 -0
  99. data/test/bogussources.rb +8 -0
  100. data/test/data/gem-private_key.pem +27 -0
  101. data/test/data/gem-public_cert.pem +20 -0
  102. data/test/fake_certlib/openssl.rb +7 -0
  103. data/test/foo/discover.rb +0 -0
  104. data/test/functional.rb +92 -0
  105. data/test/gem_installer_test_case.rb +97 -0
  106. data/test/gem_package_tar_test_case.rb +132 -0
  107. data/test/gemutilities.rb +605 -0
  108. data/test/insure_session.rb +43 -0
  109. data/test/mockgemui.rb +56 -0
  110. data/test/plugin/exception/rubygems_plugin.rb +2 -0
  111. data/test/plugin/load/rubygems_plugin.rb +1 -0
  112. data/test/plugin/standarderror/rubygems_plugin.rb +2 -0
  113. data/test/private_key.pem +27 -0
  114. data/test/public_cert.pem +20 -0
  115. data/test/rubygems_plugin.rb +21 -0
  116. data/test/simple_gem.rb +66 -0
  117. data/test/test_config.rb +12 -0
  118. data/test/test_gem.rb +766 -0
  119. data/test/test_gem_builder.rb +27 -0
  120. data/test/test_gem_command.rb +178 -0
  121. data/test/test_gem_command_manager.rb +207 -0
  122. data/test/test_gem_commands_build_command.rb +74 -0
  123. data/test/test_gem_commands_cert_command.rb +124 -0
  124. data/test/test_gem_commands_check_command.rb +18 -0
  125. data/test/test_gem_commands_contents_command.rb +156 -0
  126. data/test/test_gem_commands_dependency_command.rb +216 -0
  127. data/test/test_gem_commands_environment_command.rb +144 -0
  128. data/test/test_gem_commands_fetch_command.rb +76 -0
  129. data/test/test_gem_commands_generate_index_command.rb +135 -0
  130. data/test/test_gem_commands_install_command.rb +315 -0
  131. data/test/test_gem_commands_list_command.rb +36 -0
  132. data/test/test_gem_commands_lock_command.rb +68 -0
  133. data/test/test_gem_commands_mirror_command.rb +60 -0
  134. data/test/test_gem_commands_outdated_command.rb +40 -0
  135. data/test/test_gem_commands_owner_command.rb +105 -0
  136. data/test/test_gem_commands_pristine_command.rb +108 -0
  137. data/test/test_gem_commands_push_command.rb +81 -0
  138. data/test/test_gem_commands_query_command.rb +426 -0
  139. data/test/test_gem_commands_server_command.rb +59 -0
  140. data/test/test_gem_commands_sources_command.rb +209 -0
  141. data/test/test_gem_commands_specification_command.rb +139 -0
  142. data/test/test_gem_commands_stale_command.rb +38 -0
  143. data/test/test_gem_commands_uninstall_command.rb +83 -0
  144. data/test/test_gem_commands_unpack_command.rb +199 -0
  145. data/test/test_gem_commands_update_command.rb +353 -0
  146. data/test/test_gem_commands_which_command.rb +66 -0
  147. data/test/test_gem_config_file.rb +287 -0
  148. data/test/test_gem_dependency.rb +149 -0
  149. data/test/test_gem_dependency_installer.rb +661 -0
  150. data/test/test_gem_dependency_list.rb +230 -0
  151. data/test/test_gem_doc_manager.rb +31 -0
  152. data/test/test_gem_ext_configure_builder.rb +84 -0
  153. data/test/test_gem_ext_ext_conf_builder.rb +173 -0
  154. data/test/test_gem_ext_rake_builder.rb +81 -0
  155. data/test/test_gem_format.rb +70 -0
  156. data/test/test_gem_gem_path_searcher.rb +78 -0
  157. data/test/test_gem_gem_runner.rb +45 -0
  158. data/test/test_gem_gemcutter_utilities.rb +103 -0
  159. data/test/test_gem_indexer.rb +673 -0
  160. data/test/test_gem_install_update_options.rb +68 -0
  161. data/test/test_gem_installer.rb +857 -0
  162. data/test/test_gem_local_remote_options.rb +97 -0
  163. data/test/test_gem_package_tar_header.rb +130 -0
  164. data/test/test_gem_package_tar_input.rb +112 -0
  165. data/test/test_gem_package_tar_output.rb +97 -0
  166. data/test/test_gem_package_tar_reader.rb +46 -0
  167. data/test/test_gem_package_tar_reader_entry.rb +109 -0
  168. data/test/test_gem_package_tar_writer.rb +144 -0
  169. data/test/test_gem_package_task.rb +59 -0
  170. data/test/test_gem_platform.rb +264 -0
  171. data/test/test_gem_remote_fetcher.rb +740 -0
  172. data/test/test_gem_requirement.rb +292 -0
  173. data/test/test_gem_server.rb +356 -0
  174. data/test/test_gem_silent_ui.rb +113 -0
  175. data/test/test_gem_source_index.rb +461 -0
  176. data/test/test_gem_spec_fetcher.rb +410 -0
  177. data/test/test_gem_specification.rb +1291 -0
  178. data/test/test_gem_stream_ui.rb +218 -0
  179. data/test/test_gem_text.rb +43 -0
  180. data/test/test_gem_uninstaller.rb +146 -0
  181. data/test/test_gem_validator.rb +63 -0
  182. data/test/test_gem_version.rb +181 -0
  183. data/test/test_gem_version_option.rb +89 -0
  184. data/test/test_kernel.rb +59 -0
  185. metadata +413 -0
@@ -0,0 +1,56 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/local_remote_options'
3
+ require 'rubygems/gemcutter_utilities'
4
+
5
+ class Gem::Commands::PushCommand < Gem::Command
6
+ include Gem::LocalRemoteOptions
7
+ include Gem::GemcutterUtilities
8
+
9
+ def description # :nodoc:
10
+ "Push a gem up to rubygems.org"
11
+ end
12
+
13
+ def arguments # :nodoc:
14
+ "GEM built gem to push up"
15
+ end
16
+
17
+ def usage # :nodoc:
18
+ "#{program_name} GEM"
19
+ end
20
+
21
+ def initialize
22
+ super 'push', description
23
+ add_proxy_option
24
+
25
+ add_option(
26
+ '--host HOST',
27
+ 'Push to another gemcutter-compatible host'
28
+ ) do |value, options|
29
+ options[:host] = value
30
+ end
31
+ end
32
+
33
+ def execute
34
+ sign_in
35
+ send_gem get_one_gem_name
36
+ end
37
+
38
+ def send_gem name
39
+ say "Pushing gem to #{options[:host] || Gem.host}..."
40
+
41
+ args = [:post, "api/v1/gems"]
42
+
43
+ args << options[:host] if options[:host]
44
+
45
+ response = rubygems_api_request(*args) do |request|
46
+ request.body = Gem.read_binary name
47
+ request.add_field "Content-Length", request.body.size
48
+ request.add_field "Content-Type", "application/octet-stream"
49
+ request.add_field "Authorization", Gem.configuration.rubygems_api_key
50
+ end
51
+
52
+ with_response response
53
+ end
54
+
55
+ end
56
+
@@ -0,0 +1,280 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/local_remote_options'
3
+ require 'rubygems/spec_fetcher'
4
+ require 'rubygems/version_option'
5
+ require 'rubygems/text'
6
+
7
+ class Gem::Commands::QueryCommand < Gem::Command
8
+
9
+ include Gem::Text
10
+ include Gem::LocalRemoteOptions
11
+ include Gem::VersionOption
12
+
13
+ def initialize(name = 'query',
14
+ summary = 'Query gem information in local or remote repositories')
15
+ super name, summary,
16
+ :name => //, :domain => :local, :details => false, :versions => true,
17
+ :installed => false, :version => Gem::Requirement.default
18
+
19
+ add_option('-i', '--[no-]installed',
20
+ 'Check for installed gem') do |value, options|
21
+ options[:installed] = value
22
+ end
23
+
24
+ add_version_option command, "for use with --installed"
25
+
26
+ add_option('-n', '--name-matches REGEXP',
27
+ 'Name of gem(s) to query on matches the',
28
+ 'provided REGEXP') do |value, options|
29
+ options[:name] = /#{value}/i
30
+ end
31
+
32
+ add_option('-d', '--[no-]details',
33
+ 'Display detailed information of gem(s)') do |value, options|
34
+ options[:details] = value
35
+ end
36
+
37
+ add_option( '--[no-]versions',
38
+ 'Display only gem names') do |value, options|
39
+ options[:versions] = value
40
+ options[:details] = false unless value
41
+ end
42
+
43
+ add_option('-a', '--all',
44
+ 'Display all gem versions') do |value, options|
45
+ options[:all] = value
46
+ end
47
+
48
+ add_option( '--[no-]prerelease',
49
+ 'Display prerelease versions') do |value, options|
50
+ options[:prerelease] = value
51
+ end
52
+
53
+ add_local_remote_options
54
+ end
55
+
56
+ def defaults_str # :nodoc:
57
+ "--local --name-matches // --no-details --versions --no-installed"
58
+ end
59
+
60
+ def execute
61
+ exit_code = 0
62
+
63
+ name = options[:name]
64
+ prerelease = options[:prerelease]
65
+
66
+ if options[:installed] then
67
+ if name.source.empty? then
68
+ alert_error "You must specify a gem name"
69
+ exit_code |= 4
70
+ elsif installed? name, options[:version] then
71
+ say "true"
72
+ else
73
+ say "false"
74
+ exit_code |= 1
75
+ end
76
+
77
+ raise Gem::SystemExitException, exit_code
78
+ end
79
+
80
+ dep = Gem::Dependency.new name, Gem::Requirement.default
81
+
82
+ if local? then
83
+ if prerelease and not both? then
84
+ alert_warning "prereleases are always shown locally"
85
+ end
86
+
87
+ if ui.outs.tty? or both? then
88
+ say
89
+ say "*** LOCAL GEMS ***"
90
+ say
91
+ end
92
+
93
+ specs = Gem.source_index.search dep
94
+
95
+ spec_tuples = specs.map do |spec|
96
+ [[spec.name, spec.version, spec.original_platform, spec], :local]
97
+ end
98
+
99
+ output_query_results spec_tuples
100
+ end
101
+
102
+ if remote? then
103
+ if ui.outs.tty? or both? then
104
+ say
105
+ say "*** REMOTE GEMS ***"
106
+ say
107
+ end
108
+
109
+ all = options[:all]
110
+
111
+ begin
112
+ fetcher = Gem::SpecFetcher.fetcher
113
+ spec_tuples = fetcher.find_matching dep, all, false, prerelease
114
+
115
+ spec_tuples += fetcher.find_matching dep, false, false, true if
116
+ prerelease and all
117
+ rescue Gem::RemoteFetcher::FetchError => e
118
+ if prerelease then
119
+ raise Gem::OperationNotSupportedError,
120
+ "Prereleases not supported on legacy repositories"
121
+ end
122
+
123
+ raise unless fetcher.warn_legacy e do
124
+ require 'rubygems/source_info_cache'
125
+
126
+ dep.name = '' if dep.name == //
127
+
128
+ specs = Gem::SourceInfoCache.search_with_source dep, false, all
129
+
130
+ spec_tuples = specs.map do |spec, source_uri|
131
+ [[spec.name, spec.version, spec.original_platform, spec],
132
+ source_uri]
133
+ end
134
+ end
135
+ end
136
+
137
+ output_query_results spec_tuples
138
+ end
139
+ end
140
+
141
+ private
142
+
143
+ ##
144
+ # Check if gem +name+ version +version+ is installed.
145
+
146
+ def installed?(name, version = Gem::Requirement.default)
147
+ dep = Gem::Dependency.new name, version
148
+ !Gem.source_index.search(dep).empty?
149
+ end
150
+
151
+ def output_query_results(spec_tuples)
152
+ output = []
153
+ versions = Hash.new { |h,name| h[name] = [] }
154
+
155
+ spec_tuples.each do |spec_tuple, source_uri|
156
+ versions[spec_tuple.first] << [spec_tuple, source_uri]
157
+ end
158
+
159
+ versions = versions.sort_by do |(name,_),_|
160
+ name.downcase
161
+ end
162
+
163
+ versions.each do |gem_name, matching_tuples|
164
+ matching_tuples = matching_tuples.sort_by do |(_, version,_),_|
165
+ version
166
+ end.reverse
167
+
168
+ platforms = Hash.new { |h,version| h[version] = [] }
169
+
170
+ matching_tuples.map do |(_, version, platform,_),_|
171
+ platforms[version] << platform if platform
172
+ end
173
+
174
+ seen = {}
175
+
176
+ matching_tuples.delete_if do |(_, version,_),_|
177
+ if seen[version] then
178
+ true
179
+ else
180
+ seen[version] = true
181
+ false
182
+ end
183
+ end
184
+
185
+ entry = gem_name.dup
186
+
187
+ if options[:versions] then
188
+ list = if platforms.empty? or options[:details] then
189
+ matching_tuples.map { |(_, version,_),_| version }.uniq
190
+ else
191
+ platforms.sort.reverse.map do |version, pls|
192
+ if pls == [Gem::Platform::RUBY] then
193
+ version
194
+ else
195
+ ruby = pls.delete Gem::Platform::RUBY
196
+ platform_list = [ruby, *pls.sort].compact
197
+ "#{version} #{platform_list.join ' '}"
198
+ end
199
+ end
200
+ end.join ', '
201
+
202
+ entry << " (#{list})"
203
+ end
204
+
205
+ if options[:details] then
206
+ detail_tuple = matching_tuples.first
207
+
208
+ spec = if detail_tuple.first.length == 4 then
209
+ detail_tuple.first.last
210
+ else
211
+ uri = URI.parse detail_tuple.last
212
+ Gem::SpecFetcher.fetcher.fetch_spec detail_tuple.first, uri
213
+ end
214
+
215
+ entry << "\n"
216
+
217
+ non_ruby = platforms.any? do |_, pls|
218
+ pls.any? { |pl| pl != Gem::Platform::RUBY }
219
+ end
220
+
221
+ if non_ruby then
222
+ if platforms.length == 1 then
223
+ title = platforms.values.length == 1 ? 'Platform' : 'Platforms'
224
+ entry << " #{title}: #{platforms.values.sort.join ', '}\n"
225
+ else
226
+ entry << " Platforms:\n"
227
+ platforms.sort_by do |version,|
228
+ version
229
+ end.each do |version, pls|
230
+ label = " #{version}: "
231
+ data = format_text pls.sort.join(', '), 68, label.length
232
+ data[0, label.length] = label
233
+ entry << data << "\n"
234
+ end
235
+ end
236
+ end
237
+
238
+ authors = "Author#{spec.authors.length > 1 ? 's' : ''}: "
239
+ authors << spec.authors.join(', ')
240
+ entry << format_text(authors, 68, 4)
241
+
242
+ if spec.rubyforge_project and not spec.rubyforge_project.empty? then
243
+ rubyforge = "Rubyforge: http://rubyforge.org/projects/#{spec.rubyforge_project}"
244
+ entry << "\n" << format_text(rubyforge, 68, 4)
245
+ end
246
+
247
+ if spec.homepage and not spec.homepage.empty? then
248
+ entry << "\n" << format_text("Homepage: #{spec.homepage}", 68, 4)
249
+ end
250
+
251
+ if spec.license and not spec.license.empty? then
252
+ licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: "
253
+ licenses << spec.licenses.join(', ')
254
+ entry << "\n" << format_text(licenses, 68, 4)
255
+ end
256
+
257
+ if spec.loaded_from then
258
+ if matching_tuples.length == 1 then
259
+ loaded_from = File.dirname File.dirname(spec.loaded_from)
260
+ entry << "\n" << " Installed at: #{loaded_from}"
261
+ else
262
+ label = 'Installed at'
263
+ matching_tuples.each do |(_,version,_,s),|
264
+ loaded_from = File.dirname File.dirname(s.loaded_from)
265
+ entry << "\n" << " #{label} (#{version}): #{loaded_from}"
266
+ label = ' ' * label.length
267
+ end
268
+ end
269
+ end
270
+
271
+ entry << "\n\n" << format_text(spec.summary, 68, 4)
272
+ end
273
+ output << entry
274
+ end
275
+
276
+ say output.join(options[:details] ? "\n\n" : "\n")
277
+ end
278
+
279
+ end
280
+
@@ -0,0 +1,91 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/version_option'
3
+ require 'rubygems/doc_manager'
4
+
5
+ class Gem::Commands::RdocCommand < Gem::Command
6
+ include Gem::VersionOption
7
+
8
+ def initialize
9
+ super 'rdoc', 'Generates RDoc for pre-installed gems',
10
+ :version => Gem::Requirement.default,
11
+ :include_rdoc => true, :include_ri => true, :overwrite => false
12
+
13
+ add_option('--all',
14
+ 'Generate RDoc/RI documentation for all',
15
+ 'installed gems') do |value, options|
16
+ options[:all] = value
17
+ end
18
+
19
+ add_option('--[no-]rdoc',
20
+ 'Generate RDoc HTML') do |value, options|
21
+ options[:include_rdoc] = value
22
+ end
23
+
24
+ add_option('--[no-]ri',
25
+ 'Generate RI data') do |value, options|
26
+ options[:include_ri] = value
27
+ end
28
+
29
+ add_option('--[no-]overwrite',
30
+ 'Overwrite installed documents') do |value, options|
31
+ options[:overwrite] = value
32
+ end
33
+
34
+ add_version_option
35
+ end
36
+
37
+ def arguments # :nodoc:
38
+ "GEMNAME gem to generate documentation for (unless --all)"
39
+ end
40
+
41
+ def defaults_str # :nodoc:
42
+ "--version '#{Gem::Requirement.default}' --rdoc --ri --no-overwrite"
43
+ end
44
+
45
+ def description # :nodoc:
46
+ <<-DESC
47
+ The rdoc command builds RDoc and RI documentation for installed gems. Use
48
+ --overwrite to force rebuilding of documentation.
49
+ DESC
50
+ end
51
+
52
+ def usage # :nodoc:
53
+ "#{program_name} [args]"
54
+ end
55
+
56
+ def execute
57
+ if options[:all] then
58
+ specs = Gem::SourceIndex.from_installed_gems.collect { |name, spec|
59
+ spec
60
+ }
61
+ else
62
+ gem_name = get_one_gem_name
63
+ dep = Gem::Dependency.new gem_name, options[:version]
64
+ specs = Gem::SourceIndex.from_installed_gems.search dep
65
+ end
66
+
67
+ if specs.empty?
68
+ raise "Failed to find gem #{gem_name} to generate RDoc for #{options[:version]}"
69
+ end
70
+
71
+ if options[:include_ri]
72
+ specs.sort.each do |spec|
73
+ doc = Gem::DocManager.new(spec)
74
+ doc.generate_ri if options[:overwrite] || !doc.ri_installed?
75
+ end
76
+
77
+ Gem::DocManager.update_ri_cache
78
+ end
79
+
80
+ if options[:include_rdoc]
81
+ specs.sort.each do |spec|
82
+ doc = Gem::DocManager.new(spec)
83
+ doc.generate_rdoc if options[:overwrite] || !doc.rdoc_installed?
84
+ end
85
+ end
86
+
87
+ true
88
+ end
89
+
90
+ end
91
+
@@ -0,0 +1,31 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/commands/query_command'
3
+
4
+ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
5
+
6
+ def initialize
7
+ super 'search', 'Display all gems whose name contains STRING'
8
+
9
+ remove_option '--name-matches'
10
+ end
11
+
12
+ def arguments # :nodoc:
13
+ "STRING fragment of gem name to search for"
14
+ end
15
+
16
+ def defaults_str # :nodoc:
17
+ "--local --no-details"
18
+ end
19
+
20
+ def usage # :nodoc:
21
+ "#{program_name} [STRING]"
22
+ end
23
+
24
+ def execute
25
+ string = get_one_optional_argument
26
+ options[:name] = /#{string}/i
27
+ super
28
+ end
29
+
30
+ end
31
+