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
@@ -11,6 +11,10 @@ class TestGemCommandsSourcesCommand < RubyGemTestCase
11
11
  @new_repo = "http://beta-gems.example.com"
12
12
  end
13
13
 
14
+ def test_initialize_proxy
15
+ assert @cmd.handles?(['--http-proxy', 'http://proxy.example.com'])
16
+ end
17
+
14
18
  def test_execute
15
19
  util_setup_spec_fetcher
16
20
  @cmd.handle_options []
@@ -175,12 +179,12 @@ Will cause RubyGems to revert to legacy indexes, degrading performance.
175
179
  assert_equal expected, @ui.output
176
180
  assert_equal '', @ui.error
177
181
 
178
- assert !File.exist?(cache.system_cache_file),
182
+ refute File.exist?(cache.system_cache_file),
179
183
  'system cache file'
180
- assert !File.exist?(cache.latest_system_cache_file),
184
+ refute File.exist?(cache.latest_system_cache_file),
181
185
  'latest system cache file'
182
186
 
183
- assert !File.exist?(fetcher.dir), 'cache dir removed'
187
+ refute File.exist?(fetcher.dir), 'cache dir removed'
184
188
  end
185
189
 
186
190
  def test_execute_remove
@@ -244,7 +248,7 @@ Will cause RubyGems to revert to legacy indexes, degrading performance.
244
248
  assert_equal "source cache successfully updated\n", @ui.output
245
249
  assert_equal '', @ui.error
246
250
  end
247
-
251
+
248
252
  def test_execute_update_legacy
249
253
  @cmd.handle_options %w[--update]
250
254
 
@@ -269,6 +273,6 @@ source cache successfully updated
269
273
  assert_equal expected, @ui.output
270
274
  assert_equal '', @ui.error
271
275
  end
272
-
276
+
273
277
  end
274
278
 
@@ -70,6 +70,21 @@ class TestGemCommandsSpecificationCommand < RubyGemTestCase
70
70
  assert_equal '', @ui.error
71
71
  end
72
72
 
73
+ def test_execute_marshal
74
+ foo = quick_gem 'foo'
75
+ Gem.source_index.add_spec foo
76
+
77
+ @cmd.options[:args] = %w[foo]
78
+ @cmd.options[:format] = :marshal
79
+
80
+ use_ui @ui do
81
+ @cmd.execute
82
+ end
83
+
84
+ assert_equal foo, Marshal.load(@ui.output)
85
+ assert_equal '', @ui.error
86
+ end
87
+
73
88
  def test_execute_remote
74
89
  foo = quick_gem 'foo'
75
90
 
@@ -92,5 +107,21 @@ class TestGemCommandsSpecificationCommand < RubyGemTestCase
92
107
  assert_match %r|name: foo|, @ui.output
93
108
  end
94
109
 
110
+ def test_execute_ruby
111
+ foo = quick_gem 'foo'
112
+ Gem.source_index.add_spec foo
113
+
114
+ @cmd.options[:args] = %w[foo]
115
+ @cmd.options[:format] = :ruby
116
+
117
+ use_ui @ui do
118
+ @cmd.execute
119
+ end
120
+
121
+ assert_match %r|Gem::Specification.new|, @ui.output
122
+ assert_match %r|s.name = %q\{foo\}|, @ui.output
123
+ assert_equal '', @ui.error
124
+ end
125
+
95
126
  end
96
127
 
@@ -53,9 +53,10 @@ class TestGemCommandsUninstallCommand < GemInstallerTestCase
53
53
  end
54
54
  end
55
55
 
56
- assert_match(/\AUnknown gem foo >= 0$/, e.message)
56
+ assert_match(/\Acannot uninstall, check `gem list -d foo`$/, e.message)
57
57
  output = @ui.output.split "\n"
58
- assert output.empty?, "UI output should be empty after an uninstall error"
58
+ assert_empty output, "UI output should be empty after an uninstall error"
59
59
  end
60
+
60
61
  end
61
62
 
@@ -14,7 +14,7 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase
14
14
  def test_execute
15
15
  util_make_gems
16
16
 
17
- @cmd.options[:args] = %w[a]
17
+ @cmd.options[:args] = %w[a b]
18
18
 
19
19
  use_ui @ui do
20
20
  Dir.chdir @tempdir do
@@ -22,7 +22,8 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase
22
22
  end
23
23
  end
24
24
 
25
- assert File.exist?(File.join(@tempdir, 'a-2'))
25
+ assert File.exist?(File.join(@tempdir, 'a-2')), 'a should be installed'
26
+ assert File.exist?(File.join(@tempdir, 'b-2')), 'b should be installed'
26
27
  end
27
28
 
28
29
  def test_execute_gem_path
@@ -8,6 +8,9 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
8
8
 
9
9
  @cmd = Gem::Commands::UpdateCommand.new
10
10
 
11
+ @cmd.options[:generate_rdoc] = false
12
+ @cmd.options[:generate_ri] = false
13
+
11
14
  util_setup_fake_fetcher
12
15
 
13
16
  @a1_path = File.join @gemhome, 'cache', "#{@a1.full_name}.gem"
@@ -27,6 +30,8 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
27
30
  Gem::Installer.new(@a1_path).install
28
31
 
29
32
  @cmd.options[:args] = []
33
+ @cmd.options[:generate_rdoc] = true
34
+ @cmd.options[:generate_ri] = true
30
35
 
31
36
  use_ui @ui do
32
37
  @cmd.execute
@@ -37,8 +42,10 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
37
42
  assert_equal "Updating #{@a2.name}", out.shift
38
43
  assert_equal "Successfully installed #{@a2.full_name}", out.shift
39
44
  assert_equal "Gems updated: #{@a2.name}", out.shift
45
+ assert_equal "Installing ri documentation for a-2...", out.shift
46
+ assert_equal "Installing RDoc documentation for a-2...", out.shift
40
47
 
41
- assert out.empty?, out.inspect
48
+ assert_empty out
42
49
  end
43
50
 
44
51
  # before:
@@ -101,7 +108,7 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
101
108
  assert_equal "Gems updated: #{@c2.name}, #{@b2.name}, #{@a2.name}",
102
109
  out.shift
103
110
 
104
- assert out.empty?, out.inspect
111
+ assert_empty out
105
112
  end
106
113
 
107
114
  def test_execute_named
@@ -121,7 +128,7 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
121
128
  assert_equal "Successfully installed #{@a2.full_name}", out.shift
122
129
  assert_equal "Gems updated: #{@a2.name}", out.shift
123
130
 
124
- assert out.empty?, out.inspect
131
+ assert_empty out
125
132
  end
126
133
 
127
134
  def test_execute_named_up_to_date
@@ -139,7 +146,7 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
139
146
  assert_equal "Updating installed gems", out.shift
140
147
  assert_equal "Nothing to update", out.shift
141
148
 
142
- assert out.empty?, out.inspect
149
+ assert_empty out
143
150
  end
144
151
 
145
152
  def test_execute_up_to_date
@@ -157,8 +164,6 @@ class TestGemCommandsUpdateCommand < RubyGemTestCase
157
164
  assert_equal "Updating installed gems", out.shift
158
165
  assert_equal "Nothing to update", out.shift
159
166
 
160
- assert out.empty?, out.inspect
167
+ assert_empty out
161
168
  end
162
-
163
169
  end
164
-
@@ -20,6 +20,10 @@ class TestGemDependency < RubyGemTestCase
20
20
  @r1_0 = Gem::Requirement.new ['> 1.0']
21
21
  end
22
22
 
23
+ def dep(name, version)
24
+ Gem::Dependency.new name, version
25
+ end
26
+
23
27
  def test_initialize
24
28
  assert_equal "pkg", @pkg1_0.name
25
29
  assert_equal @r1_0, @pkg1_0.version_requirements
@@ -96,10 +100,6 @@ class TestGemDependency < RubyGemTestCase
96
100
  end
97
101
 
98
102
  def test_equals_tilde
99
- def dep(name, version)
100
- Gem::Dependency.new name, version
101
- end
102
-
103
103
  a0 = dep 'a', '0'
104
104
  a1 = dep 'a', '1'
105
105
  b0 = dep 'b', '0'
@@ -108,14 +108,64 @@ class TestGemDependency < RubyGemTestCase
108
108
  pa0r = dep(/a/, '>= 0')
109
109
  pab0r = dep(/a|b/, '>= 0')
110
110
 
111
- assert((a0 =~ a0), 'match self')
112
- assert((pa0 =~ a0), 'match version exact')
113
- assert((pa0 =~ a1), 'match version')
114
- assert((pa0r =~ a0), 'match regex simple')
115
- assert((pab0r =~ a0), 'match regex complex')
111
+ assert_match a0, a0, 'match self'
112
+ assert_match pa0, a0, 'match version exact'
113
+ assert_match pa0, a1, 'match version'
114
+ assert_match pa0r, a0, 'match regex simple'
115
+ assert_match pab0r, a0, 'match regex complex'
116
+
117
+ refute_match pa0r, b0, 'fail match regex'
118
+ refute_match pa0r, Object.new, 'fail match Object'
119
+ end
120
+
121
+ def test_equals_tilde_escape
122
+ a1 = Gem::Dependency.new 'a', '1'
123
+
124
+ pab1 = Gem::Dependency.new 'a|b', '>= 1'
125
+ pab1r = Gem::Dependency.new(/a|b/, '>= 1')
126
+
127
+ refute_match pab1, a1, 'escaped'
128
+ assert_match pab1r, a1, 'exact regexp'
129
+ end
130
+
131
+ def test_equals_tilde_object
132
+ a0 = Object.new
133
+
134
+ def a0.name() 'a' end
135
+ def a0.version() '0' end
136
+
137
+ pa0 = Gem::Dependency.new 'a', '>= 0'
138
+
139
+ assert_match pa0, a0, 'match version exact'
140
+ end
141
+
142
+ def test_equals_tilde_spec
143
+ def spec(name, version)
144
+ Gem::Specification.new do |spec|
145
+ spec.name = name
146
+ spec.version = version
147
+ end
148
+ end
149
+
150
+ a0 = spec 'a', '0'
151
+ a1 = spec 'a', '1'
152
+ b0 = spec 'b', '0'
153
+
154
+ pa0 = dep 'a', '>= 0'
155
+ pa0r = dep(/a/, '>= 0')
156
+ pab0r = dep(/a|b/, '>= 0')
157
+
158
+ assert_match pa0, a0, 'match version exact'
159
+ assert_match pa0, a1, 'match version'
116
160
 
117
- assert(!(pa0r =~ b0), 'fail match regex')
118
- assert(!(pa0r =~ Object.new), 'fail match Object')
161
+ assert_match pa0r, a0, 'match regex simple'
162
+ assert_match pa0r, a1, 'match regex simple'
163
+
164
+ assert_match pab0r, a0, 'match regex complex'
165
+ assert_match pab0r, b0, 'match regex complex'
166
+
167
+ refute_match pa0r, b0, 'fail match regex'
168
+ refute_match pa0r, Object.new, 'fail match Object'
119
169
  end
120
170
 
121
171
  def test_hash
@@ -135,5 +185,6 @@ class TestGemDependency < RubyGemTestCase
135
185
 
136
186
  refute_equal(runtime.hash, development.hash)
137
187
  end
188
+
138
189
  end
139
190
 
@@ -13,8 +13,10 @@ class TestGemDependencyInstaller < RubyGemTestCase
13
13
  write_file File.join('gems', 'a-1', 'bin', 'a_bin') do |fp|
14
14
  fp.puts "#!/usr/bin/ruby"
15
15
  end
16
+
16
17
  @a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end
17
- @aa1, @aa1_gem = util_gem 'aa', '1'
18
+ @aa1, @aa1_gem = util_gem 'aa', '1'
19
+ @a1_pre, @a1_pre_gem = util_gem 'a', '1.a'
18
20
 
19
21
  @b1, @b1_gem = util_gem 'b', '1' do |s|
20
22
  s.add_dependency 'a'
@@ -44,8 +46,8 @@ class TestGemDependencyInstaller < RubyGemTestCase
44
46
  @fetcher = Gem::FakeFetcher.new
45
47
  Gem::RemoteFetcher.fetcher = @fetcher
46
48
 
47
- si = util_setup_spec_fetcher @a1, @b1, @d1, @d2, @x1_m, @x1_o, @w1, @y1,
48
- @y1_1_p, @z1
49
+ si = util_setup_spec_fetcher(@a1, @a1_pre, @b1, @d1, @d2, @x1_m, @x1_o, @w1, @y1,
50
+ @y1_1_p, @z1)
49
51
 
50
52
  util_clear_gems
51
53
  end
@@ -257,7 +259,7 @@ class TestGemDependencyInstaller < RubyGemTestCase
257
259
  inst.install 'a'
258
260
  end
259
261
 
260
- assert_match %r|\A#!/usr/bin/env #{Gem::ConfigMap[:RUBY_INSTALL_NAME]}\n|,
262
+ assert_match %r|\A#!/usr/bin/env #{Gem::ConfigMap[:ruby_install_name]}\n|,
261
263
  File.read(File.join(@gemhome, 'bin', 'a_bin'))
262
264
  end
263
265
 
@@ -632,5 +634,16 @@ class TestGemDependencyInstaller < RubyGemTestCase
632
634
  assert_equal %w[d-1 e-1], inst.gems_to_install.map { |s| s.full_name }
633
635
  end
634
636
 
635
- end
637
+ def test_prerelease_uses_pre_index
638
+ installer = Gem::DependencyInstaller.new
639
+ pre_installer = Gem::DependencyInstaller.new(:prerelease => true)
640
+ dependency = Gem::Dependency.new('a', Gem::Requirement.default)
641
+
642
+ releases = installer.find_gems_with_sources(dependency).map{ |gems, *| gems }
643
+ prereleases = pre_installer.find_gems_with_sources(dependency).map{ |gems, *| gems }
636
644
 
645
+ assert releases.select{ |s| s.name == 'a' and s.version.to_s == '1' }.first
646
+ assert releases.select{ |s| s.name == 'a' and s.version.to_s == '1.a' }.empty?
647
+ assert_equal [@a1_pre], prereleases
648
+ end
649
+ end
@@ -105,7 +105,7 @@ class TestGemDependencyList < RubyGemTestCase
105
105
 
106
106
  @deplist.add @b2
107
107
 
108
- assert ! @deplist.ok?, 'unsatisfied dependency'
108
+ refute @deplist.ok?, 'unsatisfied dependency'
109
109
 
110
110
  @deplist.add @a1
111
111
 
@@ -144,7 +144,7 @@ class TestGemDependencyList < RubyGemTestCase
144
144
 
145
145
  @deplist.add @b2
146
146
 
147
- assert ! @deplist.ok_to_remove?("a-1")
147
+ refute @deplist.ok_to_remove?("a-1")
148
148
 
149
149
  @deplist.add @a2
150
150
 
@@ -161,7 +161,7 @@ class TestGemDependencyList < RubyGemTestCase
161
161
 
162
162
  @deplist.remove_by_name("a-1")
163
163
 
164
- assert ! @deplist.ok_to_remove?("a-2")
164
+ refute @deplist.ok_to_remove?("a-2")
165
165
  end
166
166
 
167
167
  def test_remove_by_name
@@ -169,7 +169,7 @@ class TestGemDependencyList < RubyGemTestCase
169
169
 
170
170
  @deplist.remove_by_name "a-1"
171
171
 
172
- assert ! @deplist.ok?
172
+ refute @deplist.ok?
173
173
  end
174
174
 
175
175
  def test_tsort_each_node
@@ -181,7 +181,7 @@ class TestGemDependencyList < RubyGemTestCase
181
181
  assert_equal order.shift, node.full_name
182
182
  end
183
183
 
184
- assert order.empty?
184
+ assert_empty order
185
185
  end
186
186
 
187
187
  def test_tsort_each_child
@@ -193,7 +193,7 @@ class TestGemDependencyList < RubyGemTestCase
193
193
  assert_equal order.shift, node.full_name
194
194
  end
195
195
 
196
- assert order.empty?
196
+ assert_empty order
197
197
  end
198
198
 
199
199
  # d1 -> b1 -> a1
@@ -18,7 +18,13 @@ class TestGemDocManager < RubyGemTestCase
18
18
 
19
19
  def test_uninstall_doc_unwritable
20
20
  orig_mode = File.stat(@spec.installation_path).mode
21
- File.chmod 0, @spec.installation_path
21
+
22
+ # File.chmod has no effect on MS Windows directories (it needs ACL).
23
+ if win_platform?
24
+ skip("test_uninstall_doc_unwritable skipped on MS Windows")
25
+ else
26
+ File.chmod(0, @spec.installation_path)
27
+ end
22
28
 
23
29
  assert_raises Gem::FilePermissionError do
24
30
  @manager.uninstall_doc
@@ -16,7 +16,7 @@ class TestGemExtConfigureBuilder < RubyGemTestCase
16
16
  end
17
17
 
18
18
  def test_self_build
19
- return if RUBY_PLATFORM =~ /mswin/ # HACK
19
+ skip("test_self_build skipped on MS Windows (VC++)") if vc_windows?
20
20
 
21
21
  File.open File.join(@ext, './configure'), 'w' do |configure|
22
22
  configure.puts "#!/bin/sh\necho \"#{@makefile_body}\" > Makefile"
@@ -37,7 +37,7 @@ class TestGemExtConfigureBuilder < RubyGemTestCase
37
37
  end
38
38
 
39
39
  def test_self_build_fail
40
- return if RUBY_PLATFORM =~ /mswin/ # HACK
40
+ skip("test_self_build_fail skipped on MS Windows (VC++)") if vc_windows?
41
41
  output = []
42
42
 
43
43
  error = assert_raises Gem::InstallError do
@@ -63,6 +63,10 @@ class TestGemExtConfigureBuilder < RubyGemTestCase
63
63
  end
64
64
 
65
65
  def test_self_build_has_makefile
66
+ if vc_windows? && !nmake_found?
67
+ skip("test_self_build_has_makefile skipped - nmake not found")
68
+ end
69
+
66
70
  File.open File.join(@ext, 'Makefile'), 'w' do |makefile|
67
71
  makefile.puts @makefile_body
68
72
  end
@@ -72,14 +76,8 @@ class TestGemExtConfigureBuilder < RubyGemTestCase
72
76
  Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
73
77
  end
74
78
 
75
- case RUBY_PLATFORM
76
- when /mswin/ then
77
- assert_equal 'nmake', output[0]
78
- assert_equal 'nmake install', output[2]
79
- else
80
- assert_equal 'make', output[0]
81
- assert_equal 'make install', output[2]
82
- end
79
+ assert_equal make_command, output[0]
80
+ assert_equal "#{make_command} install", output[2]
83
81
  end
84
82
 
85
83
  end
@@ -14,6 +14,10 @@ class TestGemExtExtConfBuilder < RubyGemTestCase
14
14
  end
15
15
 
16
16
  def test_class_build
17
+ if vc_windows? && !nmake_found?
18
+ skip("test_class_build skipped - nmake not found")
19
+ end
20
+
17
21
  File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
18
22
  extconf.puts "require 'mkmf'\ncreate_makefile 'foo'"
19
23
  end
@@ -46,6 +50,10 @@ class TestGemExtExtConfBuilder < RubyGemTestCase
46
50
  end
47
51
 
48
52
  def test_class_build_extconf_fail
53
+ if vc_windows? && !nmake_found?
54
+ skip("test_class_build_extconf_fail skipped - nmake not found")
55
+ end
56
+
49
57
  File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
50
58
  extconf.puts "require 'mkmf'"
51
59
  extconf.puts "have_library 'nonexistent' or abort 'need libnonexistent'"
@@ -69,6 +77,10 @@ checking for main\(\) in .*?nonexistent/m, error.message)
69
77
  end
70
78
 
71
79
  def test_class_make
80
+ if vc_windows? && !nmake_found?
81
+ skip("test_class_make skipped - nmake not found")
82
+ end
83
+
72
84
  output = []
73
85
  makefile_path = File.join(@ext, 'Makefile')
74
86
  File.open makefile_path, 'w' do |makefile|
@@ -82,14 +94,8 @@ checking for main\(\) in .*?nonexistent/m, error.message)
82
94
  Gem::Ext::ExtConfBuilder.make @ext, output
83
95
  end
84
96
 
85
- case RUBY_PLATFORM
86
- when /mswin/ then
87
- assert_equal 'nmake', output[0]
88
- assert_equal 'nmake install', output[2]
89
- else
90
- assert_equal 'make', output[0]
91
- assert_equal 'make install', output[2]
92
- end
97
+ assert_equal make_command, output[0]
98
+ assert_equal "#{make_command} install", output[2]
93
99
 
94
100
  edited_makefile = <<-EOF
95
101
  RUBYARCHDIR = #{@ext}$(target_prefix)