rubygems-update 1.3.1 → 1.3.2

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.
Files changed (128) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +24 -0
  3. data/.document +4 -3
  4. data/ChangeLog +382 -1
  5. data/Manifest.txt +214 -0
  6. data/README +1 -49
  7. data/Rakefile +124 -191
  8. data/bin/gem +1 -4
  9. data/cruise_config.rb +22 -0
  10. data/doc/release_notes/rel_1_3_1.rdoc +3 -3
  11. data/doc/release_notes/rel_1_3_2.rdoc +119 -0
  12. data/lib/gauntlet_rubygems.rb +50 -0
  13. data/lib/rubygems.rb +250 -25
  14. data/lib/rubygems/builder.rb +62 -60
  15. data/lib/rubygems/command.rb +421 -319
  16. data/lib/rubygems/command_manager.rb +153 -125
  17. data/lib/rubygems/commands/check_command.rb +12 -7
  18. data/lib/rubygems/commands/cleanup_command.rb +11 -2
  19. data/lib/rubygems/commands/contents_command.rb +42 -18
  20. data/lib/rubygems/commands/generate_index_command.rb +91 -15
  21. data/lib/rubygems/commands/install_command.rb +33 -47
  22. data/lib/rubygems/commands/query_command.rb +36 -20
  23. data/lib/rubygems/commands/rdoc_command.rb +62 -68
  24. data/lib/rubygems/commands/search_command.rb +26 -32
  25. data/lib/rubygems/commands/setup_command.rb +353 -0
  26. data/lib/rubygems/commands/sources_command.rb +5 -0
  27. data/lib/rubygems/commands/specification_command.rb +23 -3
  28. data/lib/rubygems/commands/uninstall_command.rb +71 -61
  29. data/lib/rubygems/commands/unpack_command.rb +14 -12
  30. data/lib/rubygems/commands/update_command.rb +26 -5
  31. data/lib/rubygems/defaults.rb +16 -3
  32. data/lib/rubygems/dependency.rb +38 -7
  33. data/lib/rubygems/dependency_installer.rb +7 -4
  34. data/lib/rubygems/digest/digest_adapter.rb +42 -33
  35. data/lib/rubygems/digest/sha1.rb +6 -1
  36. data/lib/rubygems/digest/sha2.rb +5 -0
  37. data/lib/rubygems/doc_manager.rb +31 -11
  38. data/lib/rubygems/ext/ext_conf_builder.rb +2 -1
  39. data/lib/rubygems/ext/rake_builder.rb +6 -2
  40. data/lib/rubygems/format.rb +63 -63
  41. data/lib/rubygems/gem_openssl.rb +14 -2
  42. data/lib/rubygems/gem_path_searcher.rb +7 -3
  43. data/lib/rubygems/gem_runner.rb +59 -39
  44. data/lib/rubygems/indexer.rb +450 -109
  45. data/lib/rubygems/install_update_options.rb +13 -1
  46. data/lib/rubygems/installer.rb +25 -22
  47. data/lib/rubygems/local_remote_options.rb +5 -3
  48. data/lib/rubygems/old_format.rb +124 -120
  49. data/lib/rubygems/package/tar_header.rb +25 -3
  50. data/lib/rubygems/package/tar_input.rb +5 -5
  51. data/lib/rubygems/package/tar_output.rb +2 -0
  52. data/lib/rubygems/package/tar_reader.rb +19 -0
  53. data/lib/rubygems/package/tar_reader/entry.rb +43 -0
  54. data/lib/rubygems/package/tar_writer.rb +65 -3
  55. data/lib/rubygems/package_task.rb +117 -0
  56. data/lib/rubygems/platform.rb +12 -8
  57. data/lib/rubygems/remote_fetcher.rb +43 -24
  58. data/lib/rubygems/require_paths_builder.rb +14 -12
  59. data/lib/rubygems/requirement.rb +15 -6
  60. data/lib/rubygems/rubygems_version.rb +14 -1
  61. data/lib/rubygems/source_index.rb +38 -16
  62. data/lib/rubygems/source_info_cache_entry.rb +2 -2
  63. data/lib/rubygems/spec_fetcher.rb +43 -20
  64. data/lib/rubygems/specification.rb +1122 -947
  65. data/lib/rubygems/text.rb +30 -0
  66. data/lib/rubygems/timer.rb +14 -11
  67. data/lib/rubygems/uninstaller.rb +25 -5
  68. data/lib/rubygems/user_interaction.rb +294 -264
  69. data/lib/rubygems/validator.rb +70 -36
  70. data/lib/rubygems/version.rb +97 -33
  71. data/lib/rubygems/version_option.rb +1 -0
  72. data/setup.rb +11 -306
  73. data/test/foo/discover.rb +0 -0
  74. data/test/gem_installer_test_case.rb +22 -11
  75. data/test/gem_package_tar_test_case.rb +0 -14
  76. data/test/gemutilities.rb +89 -8
  77. data/test/mockgemui.rb +2 -1
  78. data/test/rubygems_plugin.rb +16 -0
  79. data/test/test_gem.rb +107 -36
  80. data/test/test_gem_command.rb +3 -13
  81. data/test/test_gem_command_manager.rb +1 -14
  82. data/test/test_gem_commands_cert_command.rb +1 -1
  83. data/test/test_gem_commands_contents_command.rb +63 -0
  84. data/test/test_gem_commands_environment_command.rb +1 -1
  85. data/test/test_gem_commands_generate_index_command.rb +104 -1
  86. data/test/test_gem_commands_install_command.rb +95 -0
  87. data/test/test_gem_commands_pristine_command.rb +3 -3
  88. data/test/test_gem_commands_query_command.rb +46 -0
  89. data/test/test_gem_commands_sources_command.rb +9 -5
  90. data/test/test_gem_commands_specification_command.rb +31 -0
  91. data/test/test_gem_commands_uninstall_command.rb +3 -2
  92. data/test/test_gem_commands_unpack_command.rb +3 -2
  93. data/test/test_gem_commands_update_command.rb +12 -7
  94. data/test/test_gem_dependency.rb +62 -11
  95. data/test/test_gem_dependency_installer.rb +18 -5
  96. data/test/test_gem_dependency_list.rb +6 -6
  97. data/test/test_gem_doc_manager.rb +7 -1
  98. data/test/test_gem_ext_configure_builder.rb +8 -10
  99. data/test/test_gem_ext_ext_conf_builder.rb +14 -8
  100. data/test/test_gem_gem_path_searcher.rb +1 -1
  101. data/test/test_gem_gem_runner.rb +11 -0
  102. data/test/test_gem_indexer.rb +398 -21
  103. data/test/test_gem_install_update_options.rb +20 -6
  104. data/test/test_gem_installer.rb +22 -14
  105. data/test/test_gem_local_remote_options.rb +2 -1
  106. data/test/test_gem_package_tar_header.rb +3 -3
  107. data/test/test_gem_package_tar_input.rb +3 -3
  108. data/test/test_gem_package_tar_output.rb +2 -2
  109. data/test/test_gem_package_task.rb +70 -0
  110. data/test/test_gem_platform.rb +12 -6
  111. data/test/test_gem_remote_fetcher.rb +23 -1
  112. data/test/test_gem_source_index.rb +32 -21
  113. data/test/test_gem_spec_fetcher.rb +77 -5
  114. data/test/test_gem_specification.rb +274 -1
  115. data/test/test_gem_uninstaller.rb +34 -4
  116. data/test/test_gem_version.rb +94 -4
  117. data/test/test_gem_version_option.rb +13 -0
  118. data/test/test_kernel.rb +4 -4
  119. data/util/CL2notes +56 -0
  120. data/util/gem_prelude.rb.template +251 -0
  121. metadata +30 -20
  122. metadata.gz.sig +3 -4
  123. data/TODO +0 -1
  124. data/scripts/buildtests.rb +0 -31
  125. data/scripts/gemdoc.rb +0 -67
  126. data/scripts/runtest.rb +0 -40
  127. data/scripts/specdoc.rb +0 -171
  128. data/scripts/upload_gemdoc.rb +0 -140
@@ -1,37 +1,31 @@
1
1
  require 'rubygems/command'
2
2
  require 'rubygems/commands/query_command'
3
3
 
4
- module Gem
5
- module Commands
6
-
7
- class SearchCommand < QueryCommand
8
-
9
- def initialize
10
- super(
11
- 'search',
12
- 'Display all gems whose name contains STRING'
13
- )
14
- remove_option('--name-matches')
15
- end
16
-
17
- def arguments # :nodoc:
18
- "STRING fragment of gem name to search for"
19
- end
20
-
21
- def defaults_str # :nodoc:
22
- "--local --no-details"
23
- end
24
-
25
- def usage # :nodoc:
26
- "#{program_name} [STRING]"
27
- end
28
-
29
- def execute
30
- string = get_one_optional_argument
31
- options[:name] = /#{string}/i
32
- super
33
- end
34
- end
35
-
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"
36
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
+
37
30
  end
31
+
@@ -0,0 +1,353 @@
1
+ require 'rubygems/command'
2
+ require 'fileutils'
3
+ require 'rbconfig'
4
+ require 'tmpdir'
5
+ require 'pathname'
6
+
7
+ ##
8
+ # Installs RubyGems itself. This command is ordinarily only available from a
9
+ # RubyGems checkout or tarball.
10
+
11
+ class Gem::Commands::SetupCommand < Gem::Command
12
+
13
+ def initialize
14
+ super 'setup', 'Install RubyGems',
15
+ :format_executable => true, :rdoc => true, :ri => true,
16
+ :site_or_vendor => :sitelibdir,
17
+ :destdir => '', :prefix => ''
18
+
19
+ add_option '--prefix=PREFIX',
20
+ 'Prefix path for installing RubyGems',
21
+ 'Will not affect gem repository location' do |prefix, options|
22
+ options[:prefix] = File.expand_path prefix
23
+ end
24
+
25
+ add_option '--destdir=DESTDIR',
26
+ 'Root directory to install RubyGems into',
27
+ 'Mainly used for packaging RubyGems' do |destdir, options|
28
+ options[:destdir] = File.expand_path destdir
29
+ end
30
+
31
+ add_option '--[no-]vendor',
32
+ 'Install into vendorlibdir not sitelibdir',
33
+ '(Requires Ruby 1.8.7)' do |vendor, options|
34
+ if vendor and Gem.ruby_version < Gem::Version.new('1.8.7') then
35
+ raise OptionParser::InvalidOption,
36
+ "requires ruby 1.8.7+ (you have #{Gem.ruby_version})"
37
+ end
38
+
39
+ options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir
40
+ end
41
+
42
+ add_option '--[no-]format_executable',
43
+ 'Makes `gem` match ruby',
44
+ 'If ruby is ruby18, gem will be gem18' do |value, options|
45
+ options[:format_executable] = value
46
+ end
47
+
48
+ add_option '--[no-]rdoc',
49
+ 'Generate RDoc documentation for RubyGems' do |value, options|
50
+ options[:rdoc] = value
51
+ end
52
+
53
+ add_option '--[no-]ri',
54
+ 'Generate RI documentation for RubyGems' do |value, options|
55
+ options[:ri] = value
56
+ end
57
+ end
58
+
59
+ def check_ruby_version
60
+ required_version = Gem::Version.new '1.8.3'
61
+
62
+ unless Gem.ruby_version > required_version then
63
+ alert_error "Ruby version > #{required_version} required, is #{Gem.ruby_version}"
64
+ terminate_interaction 1
65
+ end
66
+ end
67
+
68
+ def defaults_str # :nodoc:
69
+ "--format-executable --rdoc --ri"
70
+ end
71
+
72
+ def description # :nodoc:
73
+ <<-EOF
74
+ Installs RubyGems itself.
75
+
76
+ RubyGems installs RDoc for itself in GEM_HOME. By default this is:
77
+ #{Gem.dir}
78
+
79
+ If you prefer a different directory, set the GEM_HOME environment variable.
80
+
81
+ RubyGems will install the gem command with a name matching ruby's
82
+ prefix and suffix. If ruby was installed as `ruby18`, gem will be
83
+ installed as `gem18`.
84
+
85
+ By default, this RubyGems will install gem as:
86
+ #{Gem.default_exec_format % 'gem'}
87
+ EOF
88
+ end
89
+
90
+ def execute
91
+ install_destdir = options[:destdir]
92
+
93
+ unless install_destdir.empty? then
94
+ ENV['GEM_HOME'] ||= File.join(install_destdir,
95
+ Gem.default_dir.gsub(/^[a-zA-Z]:/, ''))
96
+ end
97
+
98
+ check_ruby_version
99
+
100
+ if Gem.configuration.really_verbose then
101
+ extend FileUtils::Verbose
102
+ else
103
+ extend FileUtils
104
+ end
105
+
106
+ lib_dir, bin_dir = make_destination_dirs install_destdir
107
+
108
+ install_lib lib_dir
109
+
110
+ install_executables bin_dir
111
+
112
+ remove_old_bin_files bin_dir
113
+
114
+ remove_source_caches install_destdir
115
+
116
+ install_rdoc
117
+
118
+ say
119
+ say "-" * 78
120
+ say
121
+
122
+ release_notes = File.join Dir.pwd, 'doc', 'release_notes',
123
+ "rel_#{Gem::RubyGemsVersion.gsub '.', '_'}.rdoc"
124
+
125
+ if File.exist? release_notes then
126
+ say File.read(release_notes)
127
+ else
128
+ say "Oh-no! Unable to find release notes!"
129
+ say "Looked in: #{release_notes}" if Gem.configuration.really_verbose
130
+ end
131
+
132
+ say
133
+ say "-" * 78
134
+ say
135
+
136
+ say "RubyGems installed the following executables:"
137
+ say @bin_file_names.map { |name| "\t#{name}\n" }
138
+ say
139
+
140
+ unless @bin_file_names.grep(/#{File::SEPARATOR}gem$/) then
141
+ say "If `gem` was installed by a previous RubyGems installation, you may need"
142
+ say "to remove it by hand."
143
+ say
144
+ end
145
+ end
146
+
147
+ def install_executables(bin_dir)
148
+ say "Installing gem executable"
149
+
150
+ @bin_file_names = []
151
+
152
+ Dir.chdir 'bin' do
153
+ bin_files = Dir['*']
154
+
155
+ bin_files.delete 'update_rubygems'
156
+
157
+ bin_files.each do |bin_file|
158
+ bin_file_formatted = if options[:format_executable] then
159
+ Gem.default_exec_format % bin_file
160
+ else
161
+ bin_file
162
+ end
163
+
164
+ dest_file = File.join bin_dir, bin_file_formatted
165
+ bin_tmp_file = File.join Dir.tmpdir, bin_file
166
+
167
+ begin
168
+ bin = File.readlines bin_file
169
+ bin[0] = "#!#{Gem.ruby}\n"
170
+
171
+ File.open bin_tmp_file, 'w' do |fp|
172
+ fp.puts bin.join
173
+ end
174
+
175
+ install bin_tmp_file, dest_file, :mode => 0755
176
+ @bin_file_names << dest_file
177
+ ensure
178
+ rm bin_tmp_file
179
+ end
180
+
181
+ next unless Gem.win_platform?
182
+
183
+ begin
184
+ bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat"
185
+
186
+ File.open bin_cmd_file, 'w' do |file|
187
+ file.puts <<-TEXT
188
+ @ECHO OFF
189
+ IF NOT "%~f0" == "~f0" GOTO :WinNT
190
+ @"#{File.basename(Gem.ruby).chomp('"')}" "#{dest_file}" %1 %2 %3 %4 %5 %6 %7 %8 %9
191
+ GOTO :EOF
192
+ :WinNT
193
+ @"#{File.basename(Gem.ruby).chomp('"')}" "%~dpn0" %*
194
+ TEXT
195
+ end
196
+
197
+ install bin_cmd_file, "#{dest_file}.bat", :mode => 0755
198
+ ensure
199
+ rm bin_cmd_file
200
+ end
201
+ end
202
+ end
203
+ end
204
+
205
+ def install_lib(lib_dir)
206
+ say "Installing RubyGems"
207
+
208
+ Dir.chdir 'lib' do
209
+ lib_files = Dir[File.join('**', '*rb')]
210
+
211
+ lib_files.each do |lib_file|
212
+ dest_file = File.join lib_dir, lib_file
213
+ dest_dir = File.dirname dest_file
214
+ mkdir_p dest_dir unless File.directory? dest_dir
215
+
216
+ install lib_file, dest_file, :mode => 0644
217
+ end
218
+ end
219
+ end
220
+
221
+ def install_rdoc
222
+ gem_doc_dir = File.join Gem.dir, 'doc'
223
+ rubygems_name = "rubygems-#{Gem::RubyGemsVersion}"
224
+ rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
225
+
226
+ if File.writable? gem_doc_dir and
227
+ (not File.exist? rubygems_doc_dir or
228
+ File.writable? rubygems_doc_dir) then
229
+ say "Removing old RubyGems RDoc and ri"
230
+ Dir[File.join(Gem.dir, 'doc', 'rubygems-[0-9]*')].each do |dir|
231
+ rm_rf dir
232
+ end
233
+
234
+ if options[:ri] then
235
+ ri_dir = File.join rubygems_doc_dir, 'ri'
236
+ say "Installing #{rubygems_name} ri into #{ri_dir}"
237
+ run_rdoc '--ri', '--op', ri_dir
238
+ end
239
+
240
+ if options[:rdoc] then
241
+ rdoc_dir = File.join rubygems_doc_dir, 'rdoc'
242
+ say "Installing #{rubygems_name} rdoc into #{rdoc_dir}"
243
+ run_rdoc '--op', rdoc_dir
244
+ end
245
+ else
246
+ say "Skipping RDoc generation, #{gem_doc_dir} not writable"
247
+ say "Set the GEM_HOME environment variable if you want RDoc generated"
248
+ end
249
+ end
250
+
251
+ def make_destination_dirs(install_destdir)
252
+ lib_dir = nil
253
+ bin_dir = nil
254
+
255
+ prefix = options[:prefix]
256
+ site_or_vendor = options[:site_or_vendor]
257
+
258
+ if prefix.empty? then
259
+ lib_dir = Gem::ConfigMap[site_or_vendor]
260
+ bin_dir = Gem::ConfigMap[:bindir]
261
+ else
262
+ # Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets
263
+ # confused about installation location, so switch back to
264
+ # sitelibdir/vendorlibdir.
265
+ if defined?(APPLE_GEM_HOME) and
266
+ # just in case Apple and RubyGems don't get this patched up proper.
267
+ (prefix == Gem::ConfigMap[:libdir] or
268
+ # this one is important
269
+ prefix == File.join(Gem::ConfigMap[:libdir], 'ruby')) then
270
+ lib_dir = Gem::ConfigMap[site_or_vendor]
271
+ bin_dir = Gem::ConfigMap[:bindir]
272
+ else
273
+ lib_dir = File.join prefix, 'lib'
274
+ bin_dir = File.join prefix, 'bin'
275
+ end
276
+ end
277
+
278
+ unless install_destdir.empty? then
279
+ lib_dir = File.join install_destdir, lib_dir.gsub(/^[a-zA-Z]:/, '')
280
+ bin_dir = File.join install_destdir, bin_dir.gsub(/^[a-zA-Z]:/, '')
281
+ end
282
+
283
+ mkdir_p lib_dir
284
+ mkdir_p bin_dir
285
+
286
+ return lib_dir, bin_dir
287
+ end
288
+
289
+ def remove_old_bin_files(bin_dir)
290
+ old_bin_files = {
291
+ 'gem_mirror' => 'gem mirror',
292
+ 'gem_server' => 'gem server',
293
+ 'gemlock' => 'gem lock',
294
+ 'gemri' => 'ri',
295
+ 'gemwhich' => 'gem which',
296
+ 'index_gem_repository.rb' => 'gem generate_index',
297
+ }
298
+
299
+ old_bin_files.each do |old_bin_file, new_name|
300
+ old_bin_path = File.join bin_dir, old_bin_file
301
+ next unless File.exist? old_bin_path
302
+
303
+ deprecation_message = "`#{old_bin_file}` has been deprecated. Use `#{new_name}` instead."
304
+
305
+ File.open old_bin_path, 'w' do |fp|
306
+ fp.write <<-EOF
307
+ #!#{Gem.ruby}
308
+
309
+ abort "#{deprecation_message}"
310
+ EOF
311
+ end
312
+
313
+ next unless Gem.win_platform?
314
+
315
+ File.open "#{old_bin_path}.bat", 'w' do |fp|
316
+ fp.puts %{@ECHO.#{deprecation_message}}
317
+ end
318
+ end
319
+ end
320
+
321
+ def remove_source_caches(install_destdir)
322
+ if install_destdir.empty?
323
+ require 'rubygems/source_info_cache'
324
+
325
+ user_cache_file = File.join(install_destdir,
326
+ Gem::SourceInfoCache.user_cache_file)
327
+ system_cache_file = File.join(install_destdir,
328
+ Gem::SourceInfoCache.system_cache_file)
329
+
330
+ say "Removing old source_cache files"
331
+ rm_f user_cache_file if File.writable? File.dirname(user_cache_file)
332
+ rm_f system_cache_file if File.writable? File.dirname(system_cache_file)
333
+ end
334
+ end
335
+
336
+ def run_rdoc(*args)
337
+ begin
338
+ gem 'rdoc'
339
+ rescue Gem::LoadError
340
+ end
341
+
342
+ require 'rdoc/rdoc'
343
+
344
+ args << '--quiet'
345
+ args << '--main' << 'README'
346
+ args << '.' << 'README' << 'LICENSE.txt' << 'GPL.txt'
347
+
348
+ r = RDoc::RDoc.new
349
+ r.document args
350
+ end
351
+
352
+ end
353
+
@@ -3,9 +3,12 @@ require 'rubygems/command'
3
3
  require 'rubygems/remote_fetcher'
4
4
  require 'rubygems/source_info_cache'
5
5
  require 'rubygems/spec_fetcher'
6
+ require 'rubygems/local_remote_options'
6
7
 
7
8
  class Gem::Commands::SourcesCommand < Gem::Command
8
9
 
10
+ include Gem::LocalRemoteOptions
11
+
9
12
  def initialize
10
13
  super 'sources',
11
14
  'Manage the sources and cache file RubyGems uses to search for gems'
@@ -30,6 +33,8 @@ class Gem::Commands::SourcesCommand < Gem::Command
30
33
  add_option '-u', '--update', 'Update source cache' do |value, options|
31
34
  options[:update] = value
32
35
  end
36
+
37
+ add_proxy_option
33
38
  end
34
39
 
35
40
  def defaults_str
@@ -12,7 +12,8 @@ class Gem::Commands::SpecificationCommand < Gem::Command
12
12
 
13
13
  def initialize
14
14
  super 'specification', 'Display gem specification (in yaml)',
15
- :domain => :local, :version => Gem::Requirement.default
15
+ :domain => :local, :version => Gem::Requirement.default,
16
+ :format => :yaml
16
17
 
17
18
  add_version_option('examine')
18
19
  add_platform_option
@@ -22,6 +23,18 @@ class Gem::Commands::SpecificationCommand < Gem::Command
22
23
  options[:all] = true
23
24
  end
24
25
 
26
+ add_option('--ruby', 'Output ruby format') do |value, options|
27
+ options[:format] = :ruby
28
+ end
29
+
30
+ add_option('--yaml', 'Output RUBY format') do |value, options|
31
+ options[:format] = :yaml
32
+ end
33
+
34
+ add_option('--marshal', 'Output Marshal format') do |value, options|
35
+ options[:format] = :marshal
36
+ end
37
+
25
38
  add_local_remote_options
26
39
  end
27
40
 
@@ -30,7 +43,7 @@ class Gem::Commands::SpecificationCommand < Gem::Command
30
43
  end
31
44
 
32
45
  def defaults_str # :nodoc:
33
- "--local --version '#{Gem::Requirement.default}'"
46
+ "--local --version '#{Gem::Requirement.default}' --yaml"
34
47
  end
35
48
 
36
49
  def usage # :nodoc:
@@ -63,7 +76,14 @@ class Gem::Commands::SpecificationCommand < Gem::Command
63
76
  terminate_interaction 1
64
77
  end
65
78
 
66
- output = lambda { |s| say s.to_yaml; say "\n" }
79
+ output = lambda do |s|
80
+ say case options[:format]
81
+ when :ruby then s.to_ruby
82
+ when :marshal then Marshal.dump s
83
+ else s.to_yaml
84
+ end
85
+ say "\n"
86
+ end
67
87
 
68
88
  if options[:all] then
69
89
  specs.each(&output)