rubygems-update 1.3.1 → 1.3.2

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 (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
@@ -55,16 +55,6 @@ class TestGemCommand < RubyGemTestCase
55
55
  assert_equal [], h
56
56
  end
57
57
 
58
- def test_add_option_overlapping_common_and_local_options
59
- @cmd.add_option('-x', '--zip', 'BAD!') do end
60
- @cmd.add_option('-z', '--exe', 'BAD!') do end
61
- @cmd.add_option('-x', '--exe', 'BAD!') do end
62
-
63
- assert_match %r|-x, --zip|, @cmd.parser.to_s
64
- assert_match %r|-z, --exe|, @cmd.parser.to_s
65
- refute_match %r|-x, --exe|, @cmd.parser.to_s
66
- end
67
-
68
58
  def test_basic_accessors
69
59
  assert_equal "doit", @cmd.command
70
60
  assert_equal "gem doit", @cmd.program_name
@@ -182,9 +172,9 @@ class TestGemCommand < RubyGemTestCase
182
172
  assert @cmd.handles?(['--help', 'command'])
183
173
  assert @cmd.handles?(['-f', 'filename'])
184
174
  assert @cmd.handles?(['--file=filename'])
185
- assert ! @cmd.handles?(['-z'])
186
- assert ! @cmd.handles?(['-f'])
187
- assert ! @cmd.handles?(['--toothpaste'])
175
+ refute @cmd.handles?(['-z'])
176
+ refute @cmd.handles?(['-f'])
177
+ refute @cmd.handles?(['--toothpaste'])
188
178
 
189
179
  args = ['-h', 'command']
190
180
  @cmd.handles?(args)
@@ -7,29 +7,16 @@
7
7
  require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
8
8
  require 'rubygems/command_manager'
9
9
 
10
- class InterruptCommand < Gem::Command
11
-
12
- def initialize
13
- super('interrupt', 'Raises an Interrupt Exception', {})
14
- end
15
-
16
- def execute
17
- raise Interrupt, "Interrupt exception"
18
- end
19
-
20
- end
21
-
22
10
  class TestGemCommandManager < RubyGemTestCase
23
11
 
24
12
  def setup
25
13
  super
26
14
 
27
- @command_manager = Gem::CommandManager.new
15
+ @command_manager = Gem::CommandManager.instance
28
16
  end
29
17
 
30
18
  def test_run_interrupt
31
19
  use_ui @ui do
32
- @command_manager.register_command :interrupt
33
20
  assert_raises MockGemUi::TermError do
34
21
  @command_manager.run 'interrupt'
35
22
  end
@@ -105,7 +105,7 @@ class TestGemCommandsCertCommand < RubyGemTestCase
105
105
  assert_equal "Removed '/CN=rubygems/DC=example/DC=com'\n", @ui.output
106
106
  assert_equal '', @ui.error
107
107
 
108
- assert !File.exist?(@cert_file_name)
108
+ refute File.exist?(@cert_file_name)
109
109
  end
110
110
 
111
111
  def test_execute_sign
@@ -24,6 +24,27 @@ class TestGemCommandsContentsCommand < RubyGemTestCase
24
24
  assert_equal "", @ui.error
25
25
  end
26
26
 
27
+ def test_execute_all
28
+ @cmd.options[:all] = true
29
+
30
+ quick_gem 'foo' do |gem|
31
+ gem.files = %w[lib/foo.rb Rakefile]
32
+ end
33
+
34
+ quick_gem 'bar' do |gem|
35
+ gem.files = %w[lib/bar.rb Rakefile]
36
+ end
37
+
38
+ use_ui @ui do
39
+ @cmd.execute
40
+ end
41
+
42
+ assert_match %r|lib/foo\.rb|, @ui.output
43
+ assert_match %r|lib/bar\.rb|, @ui.output
44
+ assert_match %r|Rakefile|, @ui.output
45
+ assert_equal "", @ui.error
46
+ end
47
+
27
48
  def test_execute_bad_gem
28
49
  @cmd.options[:args] = %w[foo]
29
50
 
@@ -75,6 +96,48 @@ class TestGemCommandsContentsCommand < RubyGemTestCase
75
96
  assert_equal "", @ui.error
76
97
  end
77
98
 
99
+ def test_execute_multiple
100
+ @cmd.options[:args] = %w[foo bar]
101
+ quick_gem 'foo' do |gem|
102
+ gem.files = %w[lib/foo.rb Rakefile]
103
+ end
104
+
105
+ quick_gem 'bar' do |gem|
106
+ gem.files = %w[lib/bar.rb Rakefile]
107
+ end
108
+
109
+ use_ui @ui do
110
+ @cmd.execute
111
+ end
112
+
113
+ assert_match %r|lib/foo\.rb|, @ui.output
114
+ assert_match %r|lib/bar\.rb|, @ui.output
115
+ assert_match %r|Rakefile|, @ui.output
116
+ assert_equal "", @ui.error
117
+ end
118
+
119
+ def test_execute_no_prefix
120
+ @cmd.options[:args] = %w[foo]
121
+ @cmd.options[:prefix] = false
122
+
123
+ quick_gem 'foo' do |gem|
124
+ gem.files = %w[lib/foo.rb Rakefile]
125
+ end
126
+
127
+ use_ui @ui do
128
+ @cmd.execute
129
+ end
130
+
131
+ expected = <<-EOF
132
+ lib/foo.rb
133
+ Rakefile
134
+ EOF
135
+
136
+ assert_equal expected, @ui.output
137
+
138
+ assert_equal "", @ui.error
139
+ end
140
+
78
141
  def test_handle_options
79
142
  assert_equal false, @cmd.options[:lib_only]
80
143
  assert_equal [], @cmd.options[:specdirs]
@@ -24,7 +24,7 @@ class TestGemCommandsEnvironmentCommand < RubyGemTestCase
24
24
  assert_match %r|INSTALLATION DIRECTORY: #{Regexp.escape @gemhome}|,
25
25
  @ui.output
26
26
  assert_match %r|RUBYGEMS PREFIX: |, @ui.output
27
- assert_match %r|RUBY EXECUTABLE:.*#{Gem::ConfigMap[:RUBY_INSTALL_NAME]}|,
27
+ assert_match %r|RUBY EXECUTABLE:.*#{Gem::ConfigMap[:ruby_install_name]}|,
28
28
  @ui.output
29
29
  assert_match %r|EXECUTABLE DIRECTORY:|, @ui.output
30
30
  assert_match %r|RUBYGEMS PLATFORMS:|, @ui.output
@@ -1,4 +1,3 @@
1
- require 'minitest/unit'
2
1
  require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
3
2
  require 'rubygems/indexer'
4
3
  require 'rubygems/commands/generate_index_command'
@@ -28,5 +27,109 @@ class TestGemCommandsGenerateIndexCommand < RubyGemTestCase
28
27
  assert File.exist?(quick_index_rz), quick_index_rz
29
28
  end
30
29
 
30
+ def test_execute_rss_update
31
+ @cmd.options[:update] = true
32
+ @cmd.options[:rss_host] = 'example.com'
33
+ @cmd.options[:rss_gems_host] = 'gems.example.com'
34
+
35
+ use_ui @ui do
36
+ assert_raises MockGemUi::TermError do
37
+ @cmd.execute
38
+ end
39
+ end
40
+
41
+ assert_equal "ERROR: --update not compatible with RSS generation\n",
42
+ @ui.error
43
+ assert_empty @ui.output
44
+ end
45
+
46
+ def test_handle_options_directory
47
+ return if win_platform?
48
+ refute_equal '/nonexistent', @cmd.options[:directory]
49
+
50
+ @cmd.handle_options %w[--directory /nonexistent]
51
+
52
+ assert_equal '/nonexistent', @cmd.options[:directory]
53
+ end
54
+
55
+ def test_handle_options_directory_windows
56
+ return unless win_platform?
57
+
58
+ refute_equal '/nonexistent', @cmd.options[:directory]
59
+
60
+ @cmd.handle_options %w[--directory C:/nonexistent]
61
+
62
+ assert_equal 'C:/nonexistent', @cmd.options[:directory]
63
+ end
64
+
65
+ def test_handle_options_invalid
66
+ e = assert_raises OptionParser::InvalidOption do
67
+ @cmd.handle_options %w[--no-modern --no-legacy]
68
+ end
69
+
70
+ assert_equal 'invalid option: --no-legacy no indicies will be built',
71
+ e.message
72
+
73
+ @cmd = Gem::Commands::GenerateIndexCommand.new
74
+ e = assert_raises OptionParser::InvalidOption do
75
+ @cmd.handle_options %w[--no-legacy --no-modern]
76
+ end
77
+
78
+ assert_equal 'invalid option: --no-modern no indicies will be built',
79
+ e.message
80
+ end
81
+
82
+ def test_handle_options_legacy
83
+ @cmd.handle_options %w[--legacy]
84
+
85
+ assert @cmd.options[:build_legacy]
86
+ assert @cmd.options[:build_modern], ':build_modern not set'
87
+ end
88
+
89
+ def test_handle_options_modern
90
+ @cmd.handle_options %w[--modern]
91
+
92
+ assert @cmd.options[:build_legacy]
93
+ assert @cmd.options[:build_modern], ':build_modern not set'
94
+ end
95
+
96
+ def test_handle_options_no_legacy
97
+ @cmd.handle_options %w[--no-legacy]
98
+
99
+ refute @cmd.options[:build_legacy]
100
+ assert @cmd.options[:build_modern]
101
+ end
102
+
103
+ def test_handle_options_no_modern
104
+ @cmd.handle_options %w[--no-modern]
105
+
106
+ assert @cmd.options[:build_legacy]
107
+ refute @cmd.options[:build_modern]
108
+ end
109
+
110
+ def test_handle_options_rss_gems_host
111
+ @cmd.handle_options %w[--rss-gems-host gems.example.com]
112
+
113
+ assert_equal 'gems.example.com', @cmd.options[:rss_gems_host]
114
+ end
115
+
116
+ def test_handle_options_rss_host
117
+ @cmd.handle_options %w[--rss-host example.com]
118
+
119
+ assert_equal 'example.com', @cmd.options[:rss_host]
120
+ end
121
+
122
+ def test_handle_options_rss_title
123
+ @cmd.handle_options %w[--rss-title Example\ Gems]
124
+
125
+ assert_equal 'Example Gems', @cmd.options[:rss_title]
126
+ end
127
+
128
+ def test_handle_options_update
129
+ @cmd.handle_options %w[--update]
130
+
131
+ assert @cmd.options[:update]
132
+ end
133
+
31
134
  end if ''.respond_to? :to_xs
32
135
 
@@ -11,6 +11,52 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
11
11
  @cmd.options[:generate_ri] = false
12
12
  end
13
13
 
14
+ def test_execute_exclude_prerelease
15
+ util_setup_fake_fetcher(:prerelease)
16
+ util_setup_spec_fetcher @a2, @a2_pre
17
+
18
+ @fetcher.data["#{@gem_repo}gems/#{@a2.full_name}.gem"] =
19
+ read_binary(File.join(@gemhome, 'cache', "#{@a2.full_name}.gem"))
20
+ @fetcher.data["#{@gem_repo}gems/#{@a2_pre.full_name}.gem"] =
21
+ read_binary(File.join(@gemhome, 'cache', "#{@a2_pre.full_name}.gem"))
22
+
23
+ @cmd.options[:args] = [@a2.name]
24
+
25
+ use_ui @ui do
26
+ e = assert_raises Gem::SystemExitException do
27
+ @cmd.execute
28
+ end
29
+ assert_equal 0, e.exit_code, @ui.error
30
+ end
31
+
32
+ assert_match(/Successfully installed #{@a2.full_name}$/, @ui.output)
33
+ refute_match(/Successfully installed #{@a2_pre.full_name}$/, @ui.output)
34
+ end
35
+
36
+ def test_execute_explicit_version_includes_prerelease
37
+ util_setup_fake_fetcher(:prerelease)
38
+ util_setup_spec_fetcher @a2, @a2_pre
39
+
40
+ @fetcher.data["#{@gem_repo}gems/#{@a2.full_name}.gem"] =
41
+ read_binary(File.join(@gemhome, 'cache', "#{@a2.full_name}.gem"))
42
+ @fetcher.data["#{@gem_repo}gems/#{@a2_pre.full_name}.gem"] =
43
+ read_binary(File.join(@gemhome, 'cache', "#{@a2_pre.full_name}.gem"))
44
+
45
+ @cmd.handle_options [@a2_pre.name, '--version', @a2_pre.version.to_s]
46
+ assert @cmd.options[:prerelease]
47
+ assert @cmd.options[:version].satisfied_by?(@a2_pre.version)
48
+
49
+ use_ui @ui do
50
+ e = assert_raises Gem::SystemExitException do
51
+ @cmd.execute
52
+ end
53
+ assert_equal 0, e.exit_code, @ui.error
54
+ end
55
+
56
+ refute_match(/Successfully installed #{@a2.full_name}$/, @ui.output)
57
+ assert_match(/Successfully installed #{@a2_pre.full_name}$/, @ui.output)
58
+ end
59
+
14
60
  def test_execute_include_dependencies
15
61
  @cmd.options[:include_dependencies] = true
16
62
  @cmd.options[:args] = []
@@ -57,6 +103,32 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
57
103
  assert out.empty?, out.inspect
58
104
  end
59
105
 
106
+ def test_no_user_install
107
+ util_setup_fake_fetcher
108
+ @cmd.options[:user_install] = false
109
+
110
+ FileUtils.mv File.join(@gemhome, 'cache', "#{@a2.full_name}.gem"),
111
+ File.join(@tempdir)
112
+
113
+ @cmd.options[:args] = [@a2.name]
114
+
115
+ use_ui @ui do
116
+ orig_dir = Dir.pwd
117
+ begin
118
+ File.chmod 0755, @userhome
119
+ File.chmod 0555, @gemhome
120
+
121
+ Dir.chdir @tempdir
122
+ assert_raises Gem::FilePermissionError do
123
+ @cmd.execute
124
+ end
125
+ ensure
126
+ Dir.chdir orig_dir
127
+ File.chmod 0755, @gemhome
128
+ end
129
+ end
130
+ end
131
+
60
132
  def test_execute_local_missing
61
133
  util_setup_fake_fetcher
62
134
  @cmd.options[:domain] = :local
@@ -100,6 +172,29 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
100
172
  @ui.error
101
173
  end
102
174
 
175
+ def test_execute_prerelease
176
+ util_setup_fake_fetcher(:prerelease)
177
+ util_setup_spec_fetcher @a2, @a2_pre
178
+
179
+ @fetcher.data["#{@gem_repo}gems/#{@a2.full_name}.gem"] =
180
+ read_binary(File.join(@gemhome, 'cache', "#{@a2.full_name}.gem"))
181
+ @fetcher.data["#{@gem_repo}gems/#{@a2_pre.full_name}.gem"] =
182
+ read_binary(File.join(@gemhome, 'cache', "#{@a2_pre.full_name}.gem"))
183
+
184
+ @cmd.options[:prerelease] = true
185
+ @cmd.options[:args] = [@a2_pre.name]
186
+
187
+ use_ui @ui do
188
+ e = assert_raises Gem::SystemExitException do
189
+ @cmd.execute
190
+ end
191
+ assert_equal 0, e.exit_code, @ui.error
192
+ end
193
+
194
+ refute_match(/Successfully installed #{@a2.full_name}$/, @ui.output)
195
+ assert_match(/Successfully installed #{@a2_pre.full_name}$/, @ui.output)
196
+ end
197
+
103
198
  def test_execute_remote
104
199
  @cmd.options[:generate_rdoc] = true
105
200
  @cmd.options[:generate_ri] = true
@@ -35,7 +35,7 @@ class TestGemCommandsPristineCommand < RubyGemTestCase
35
35
 
36
36
  assert_equal "Restoring gem(s) to pristine condition...", out.shift
37
37
  assert_equal "Restored #{a.full_name}", out.shift
38
- assert out.empty?, out.inspect
38
+ assert_empty out, out.inspect
39
39
  end
40
40
 
41
41
  def test_execute_all
@@ -63,7 +63,7 @@ class TestGemCommandsPristineCommand < RubyGemTestCase
63
63
 
64
64
  assert_equal "Restoring gem(s) to pristine condition...", out.shift
65
65
  assert_equal "Restored #{a.full_name}", out.shift
66
- assert out.empty?, out.inspect
66
+ assert_empty out, out.inspect
67
67
  end
68
68
 
69
69
  def test_execute_missing_cache_gem
@@ -86,7 +86,7 @@ class TestGemCommandsPristineCommand < RubyGemTestCase
86
86
  out = @ui.output.split "\n"
87
87
 
88
88
  assert_equal "Restoring gem\(s\) to pristine condition...", out.shift
89
- assert out.empty?, out.inspect
89
+ assert_empty out, out.inspect
90
90
 
91
91
  assert_equal "ERROR: Cached gem for #{a.full_name} not found, use `gem install` to restore\n",
92
92
  @ui.error
@@ -85,6 +85,51 @@ a (2)
85
85
  This is a lot of text.
86
86
 
87
87
  pl (1)
88
+ Platform: i386-linux
89
+ Author: A User
90
+ Homepage: http://example.com
91
+
92
+ this is a summary
93
+ EOF
94
+
95
+ assert_equal expected, @ui.output
96
+ assert_equal '', @ui.error
97
+ end
98
+
99
+ def test_execute_details_platform
100
+ @a1.platform = 'x86-linux'
101
+
102
+ @a2.summary = 'This is a lot of text. ' * 4
103
+ @a2.authors = ['Abraham Lincoln', 'Hirohito']
104
+ @a2.homepage = 'http://a.example.com/'
105
+ @a2.rubyforge_project = 'rubygems'
106
+ @a2.platform = 'universal-darwin'
107
+
108
+ @si = util_setup_spec_fetcher @a1, @a2, @pl1
109
+
110
+ @cmd.handle_options %w[-r -d]
111
+
112
+ use_ui @ui do
113
+ @cmd.execute
114
+ end
115
+
116
+ expected = <<-EOF
117
+
118
+ *** REMOTE GEMS ***
119
+
120
+ a (2, 1)
121
+ Platforms:
122
+ 1: x86-linux
123
+ 2: universal-darwin
124
+ Authors: Abraham Lincoln, Hirohito
125
+ Rubyforge: http://rubyforge.org/projects/rubygems
126
+ Homepage: http://a.example.com/
127
+
128
+ This is a lot of text. This is a lot of text. This is a lot of text.
129
+ This is a lot of text.
130
+
131
+ pl (1)
132
+ Platform: i386-linux
88
133
  Author: A User
89
134
  Homepage: http://example.com
90
135
 
@@ -253,6 +298,7 @@ c (1.2)
253
298
  this is a summary
254
299
 
255
300
  pl (1)
301
+ Platform: i386-linux
256
302
  Author: A User
257
303
  Homepage: http://example.com
258
304
  Installed at: #{@gemhome}