drake 0.8.7.0.2.4 → 0.9.0.0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/.gemtest +0 -0
  2. data/CHANGES +77 -9
  3. data/{CHANGES.drake → CHANGES-drake} +6 -2
  4. data/MIT-LICENSE +2 -0
  5. data/{README → README.rdoc} +30 -18
  6. data/Rakefile +144 -130
  7. data/Rakefile-drake +67 -0
  8. data/TODO +1 -1
  9. data/bin/drake +2 -0
  10. data/doc/command_line_usage.rdoc +25 -11
  11. data/doc/glossary.rdoc +2 -2
  12. data/doc/jamis.rb +2 -2
  13. data/doc/parallel.rdoc +37 -29
  14. data/doc/proto_rake.rdoc +22 -22
  15. data/doc/rake.1.gz +0 -0
  16. data/doc/rakefile.rdoc +56 -33
  17. data/doc/rational.rdoc +6 -6
  18. data/doc/release_notes/rake-0.4.15.rdoc +1 -1
  19. data/doc/release_notes/rake-0.5.0.rdoc +1 -1
  20. data/doc/release_notes/rake-0.7.0.rdoc +1 -1
  21. data/doc/release_notes/rake-0.7.2.rdoc +3 -3
  22. data/doc/release_notes/rake-0.7.3.rdoc +2 -2
  23. data/doc/release_notes/rake-0.8.0.rdoc +1 -1
  24. data/doc/release_notes/rake-0.8.2.rdoc +3 -3
  25. data/doc/release_notes/rake-0.8.3.rdoc +2 -2
  26. data/doc/release_notes/rake-0.8.4.rdoc +1 -1
  27. data/doc/release_notes/rake-0.8.5.rdoc +1 -1
  28. data/doc/release_notes/rake-0.8.6.rdoc +1 -1
  29. data/doc/release_notes/rake-0.8.7.rdoc +1 -1
  30. data/doc/release_notes/rake-0.9.0.rdoc +112 -0
  31. data/install.rb +14 -12
  32. data/lib/rake.rb +31 -2527
  33. data/lib/rake/alt_system.rb +7 -6
  34. data/lib/rake/application.rb +626 -0
  35. data/lib/rake/classic_namespace.rb +1 -0
  36. data/lib/rake/clean.rb +2 -4
  37. data/lib/rake/cloneable.rb +25 -0
  38. data/lib/rake/contrib/compositepublisher.rb +2 -5
  39. data/lib/rake/contrib/ftptools.rb +5 -8
  40. data/lib/rake/contrib/publisher.rb +2 -8
  41. data/lib/rake/contrib/rubyforgepublisher.rb +2 -4
  42. data/lib/rake/contrib/sshpublisher.rb +4 -6
  43. data/lib/rake/contrib/sys.rb +7 -25
  44. data/lib/rake/default_loader.rb +10 -0
  45. data/lib/rake/dsl.rb +2 -0
  46. data/lib/rake/dsl_definition.rb +143 -0
  47. data/lib/rake/early_time.rb +18 -0
  48. data/lib/rake/ext/core.rb +27 -0
  49. data/lib/rake/ext/module.rb +39 -0
  50. data/lib/rake/ext/string.rb +167 -0
  51. data/lib/rake/ext/time.rb +14 -0
  52. data/lib/rake/file_creation_task.rb +24 -0
  53. data/lib/rake/file_list.rb +403 -0
  54. data/lib/rake/file_task.rb +47 -0
  55. data/lib/rake/file_utils.rb +112 -0
  56. data/lib/rake/file_utils_ext.rb +142 -0
  57. data/lib/rake/gempackagetask.rb +6 -90
  58. data/lib/rake/invocation_chain.rb +51 -0
  59. data/lib/rake/invocation_exception_mixin.rb +16 -0
  60. data/lib/rake/loaders/makefile.rb +13 -15
  61. data/lib/rake/multi_task.rb +16 -0
  62. data/lib/rake/name_space.rb +25 -0
  63. data/lib/rake/packagetask.rb +13 -12
  64. data/lib/rake/parallel.rb +17 -28
  65. data/lib/rake/pathmap.rb +1 -0
  66. data/lib/rake/pseudo_status.rb +24 -0
  67. data/lib/rake/rake_module.rb +29 -0
  68. data/lib/rake/rake_test_loader.rb +10 -2
  69. data/lib/rake/rdoctask.rb +211 -190
  70. data/lib/rake/ruby182_test_unit_fix.rb +9 -7
  71. data/lib/rake/rule_recursion_overflow_error.rb +20 -0
  72. data/lib/rake/runtest.rb +4 -6
  73. data/lib/rake/task.rb +351 -0
  74. data/lib/rake/task_argument_error.rb +7 -0
  75. data/lib/rake/task_arguments.rb +74 -0
  76. data/lib/rake/task_manager.rb +307 -0
  77. data/lib/rake/tasklib.rb +1 -2
  78. data/lib/rake/testtask.rb +57 -27
  79. data/lib/rake/version.rb +13 -0
  80. data/lib/rake/win32.rb +4 -4
  81. data/test/contrib/test_sys.rb +8 -31
  82. data/test/data/access/Rakefile +33 -0
  83. data/test/data/comments/Rakefile +18 -0
  84. data/test/data/default/Rakefile +1 -1
  85. data/test/data/deprecated_import/Rakefile +1 -0
  86. data/test/data/dryrun/Rakefile +1 -1
  87. data/test/data/file_creation_task/Rakefile +1 -1
  88. data/test/data/namespace/Rakefile +9 -0
  89. data/test/data/rakelib/test1.rb +1 -0
  90. data/test/data/verbose/Rakefile +34 -0
  91. data/test/{filecreation.rb → file_creation.rb} +11 -7
  92. data/test/functional/functional_test.rb +25 -0
  93. data/test/{session_functional.rb → functional/session_based_tests.rb} +141 -23
  94. data/test/in_environment.rb +7 -5
  95. data/test/{test_application.rb → lib/application_test.rb} +331 -143
  96. data/test/{test_clean.rb → lib/clean_test.rb} +1 -0
  97. data/test/{test_definitions.rb → lib/definitions_test.rb} +4 -4
  98. data/test/lib/dsl_test.rb +52 -0
  99. data/test/{test_earlytime.rb → lib/earlytime_test.rb} +1 -2
  100. data/test/{test_extension.rb → lib/extension_test.rb} +2 -2
  101. data/test/{test_file_creation_task.rb → lib/file_creation_task_test.rb} +1 -1
  102. data/test/{test_file_task.rb → lib/file_task_test.rb} +9 -5
  103. data/test/{test_filelist.rb → lib/filelist_test.rb} +38 -24
  104. data/test/{test_fileutils.rb → lib/fileutils_test.rb} +27 -22
  105. data/test/{test_ftp.rb → lib/ftp_test.rb} +0 -0
  106. data/test/{test_invocation_chain.rb → lib/invocation_chain_test.rb} +0 -0
  107. data/test/{test_makefile_loader.rb → lib/makefile_loader_test.rb} +0 -0
  108. data/test/{test_multitask.rb → lib/multitask_test.rb} +3 -2
  109. data/test/{test_namespace.rb → lib/namespace_test.rb} +0 -0
  110. data/test/lib/package_task_test.rb +82 -0
  111. data/test/{test_parallel.rb → lib/parallel_test.rb} +5 -5
  112. data/test/{test_pathmap.rb → lib/pathmap_test.rb} +3 -2
  113. data/test/{test_pseudo_status.rb → lib/pseudo_status_test.rb} +0 -0
  114. data/test/{test_rake.rb → lib/rake_test.rb} +1 -1
  115. data/test/{test_rdoc_task.rb → lib/rdoc_task_test.rb} +19 -23
  116. data/test/{test_require.rb → lib/require_test.rb} +8 -2
  117. data/test/{test_rules.rb → lib/rules_test.rb} +4 -5
  118. data/test/{test_task_arguments.rb → lib/task_arguments_test.rb} +5 -5
  119. data/test/{test_task_manager.rb → lib/task_manager_test.rb} +15 -5
  120. data/test/{test_tasks.rb → lib/task_test.rb} +91 -28
  121. data/test/{test_tasklib.rb → lib/tasklib_test.rb} +0 -0
  122. data/test/{test_test_task.rb → lib/test_task_test.rb} +3 -3
  123. data/test/lib/testtask_test.rb +49 -0
  124. data/test/{test_top_level_functions.rb → lib/top_level_functions_test.rb} +5 -3
  125. data/test/{test_win32.rb → lib/win32_test.rb} +19 -0
  126. data/test/rake_test_setup.rb +6 -10
  127. data/test/ruby_version_test.rb +3 -0
  128. data/test/test_helper.rb +19 -0
  129. metadata +108 -66
  130. data/Rakefile.drake +0 -73
  131. data/test/functional.rb +0 -15
  132. data/test/test_package_task.rb +0 -118
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'test/unit'
4
+ require 'rake'
4
5
  require 'rake/clean'
5
6
 
6
7
  class TestClean < Test::Unit::TestCase
@@ -3,14 +3,14 @@
3
3
  require 'test/unit'
4
4
  require 'fileutils'
5
5
  require 'rake'
6
- require 'test/filecreation'
6
+ require 'test/file_creation'
7
7
  require 'test/rake_test_setup'
8
8
 
9
9
  ######################################################################
10
10
  class TestDefinitions < Test::Unit::TestCase
11
11
  include Rake
12
12
  include TestMethods
13
-
13
+
14
14
  EXISTINGFILE = "testdata/existing"
15
15
 
16
16
  def setup
@@ -48,7 +48,7 @@ class TestDefinitions < Test::Unit::TestCase
48
48
  end
49
49
 
50
50
  def test_incremental_definitions
51
- runs = SerializedArray.new
51
+ runs = ThreadSafeArray.new
52
52
  task :t1 => [:t2] do runs << "A"; 4321 end
53
53
  task :t1 => [:t3] do runs << "B"; 1234 end
54
54
  task :t1 => [:t3]
@@ -86,4 +86,4 @@ class TestDefinitions < Test::Unit::TestCase
86
86
  end
87
87
 
88
88
  end
89
-
89
+
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'rubygems'
5
+ rescue LoadError
6
+ # got no gems
7
+ end
8
+
9
+ require 'test/unit'
10
+ require 'flexmock/test_unit'
11
+ require 'rake'
12
+ require 'test/rake_test_setup'
13
+
14
+ class DslTest < Test::Unit::TestCase
15
+
16
+ def test_namespace_command
17
+ namespace "n" do
18
+ task "t"
19
+ end
20
+ assert_not_nil Rake::Task["n:t"]
21
+ end
22
+
23
+ def test_namespace_command_with_bad_name
24
+ ex = assert_raise(ArgumentError) do
25
+ namespace 1 do end
26
+ end
27
+ assert_match(/string/i, ex.message)
28
+ assert_match(/symbol/i, ex.message)
29
+ end
30
+
31
+ def test_namespace_command_with_a_string_like_object
32
+ name = Object.new
33
+ def name.to_str
34
+ "bob"
35
+ end
36
+ namespace name do
37
+ task "t"
38
+ end
39
+ assert_not_nil Rake::Task["bob:t"]
40
+ end
41
+
42
+ def test_dsl_not_toplevel_by_default
43
+ actual = TOPLEVEL_BINDING.instance_eval { defined?(task) }
44
+ assert_nil actual
45
+ end
46
+
47
+ def test_dsl_toplevel_when_require_rake_dsl
48
+ assert_nothing_raised {
49
+ ruby '-I./lib', '-rrake/dsl', '-e', 'task(:x) { }', :verbose => false
50
+ }
51
+ end
52
+ end
@@ -6,7 +6,6 @@ require 'rake'
6
6
  class TestEarlyTime < Test::Unit::TestCase
7
7
  def test_create
8
8
  early = Rake::EarlyTime.instance
9
- time = Time.mktime(1970, 1, 1, 0, 0, 0)
10
9
  assert early <= Time.now
11
10
  assert early < Time.now
12
11
  assert early != Time.now
@@ -26,7 +25,7 @@ class TestEarlyTime < Test::Unit::TestCase
26
25
  assert t1 < t2
27
26
  assert t2 > t1
28
27
  assert t1 == t1
29
- assert t2 == t2
28
+ assert t2 == t2
30
29
  end
31
30
 
32
31
  def test_to_s
@@ -18,14 +18,14 @@ class TestExtension < Test::Unit::TestCase
18
18
  $stderr = old_err
19
19
  end
20
20
  end
21
-
21
+
22
22
  class Sample
23
23
  extend Redirect
24
24
 
25
25
  def duplicate_method
26
26
  :original
27
27
  end
28
-
28
+
29
29
  OK_ERRS = error_redirect do
30
30
  rake_extension("a") do
31
31
  def ok_method
@@ -3,7 +3,7 @@
3
3
  require 'test/unit'
4
4
  require 'fileutils'
5
5
  require 'rake'
6
- require 'test/filecreation'
6
+ require 'test/file_creation'
7
7
 
8
8
  ######################################################################
9
9
  class TestFileCreationTask < Test::Unit::TestCase
@@ -3,7 +3,7 @@
3
3
  require 'test/unit'
4
4
  require 'fileutils'
5
5
  require 'rake'
6
- require 'test/filecreation'
6
+ require 'test/file_creation'
7
7
  require 'test/rake_test_setup'
8
8
 
9
9
  ######################################################################
@@ -16,7 +16,7 @@ class TestFileTask < Test::Unit::TestCase
16
16
 
17
17
  def setup
18
18
  Task.clear
19
- @runs = SerializedArray.new
19
+ @runs = ThreadSafeArray.new
20
20
  FileUtils.rm_rf "testdata", :verbose => false
21
21
  FileUtils.mkdir_p "testdata", :verbose => false
22
22
  end
@@ -89,6 +89,7 @@ class TestFileTask < Test::Unit::TestCase
89
89
 
90
90
  file MIDDLE_AGED_FILE => OLDFILE do |t|
91
91
  @runs << t.name
92
+ touch MIDDLE_AGED_FILE, :verbose => false
92
93
  end
93
94
  file OLDFILE => NEWFILE do |t|
94
95
  @runs << t.name
@@ -96,6 +97,7 @@ class TestFileTask < Test::Unit::TestCase
96
97
  end
97
98
  file NEWFILE do |t|
98
99
  @runs << t.name
100
+ touch NEWFILE, :verbose => false
99
101
  end
100
102
 
101
103
  Task[MIDDLE_AGED_FILE].invoke
@@ -107,6 +109,7 @@ class TestFileTask < Test::Unit::TestCase
107
109
 
108
110
  file MIDDLE_AGED_FILE => OLDFILE do |t|
109
111
  @runs << t.name
112
+ touch MIDDLE_AGED_FILE, :verbose => false
110
113
  end
111
114
  file OLDFILE => ANCIENT_FILE do |t|
112
115
  @runs << t.name
@@ -118,6 +121,7 @@ class TestFileTask < Test::Unit::TestCase
118
121
  end
119
122
  file NEWFILE do |t|
120
123
  @runs << t.name
124
+ touch NEWFILE, :verbose => false
121
125
  end
122
126
 
123
127
  Task[MIDDLE_AGED_FILE].invoke
@@ -288,7 +292,7 @@ class TestFileTask < Test::Unit::TestCase
288
292
  # deleting the file target on failure is always the proper thing to
289
293
  # do. I'm willing to hear input on this topic.
290
294
  def ztest_file_deletes_on_failure
291
- task :obj
295
+ task :obj
292
296
  file NEWFILE => [:obj] do |t|
293
297
  FileUtils.touch NEWFILE
294
298
  fail "Ooops"
@@ -308,11 +312,11 @@ class TestDirectoryTask < Test::Unit::TestCase
308
312
  include Rake
309
313
 
310
314
  def setup
311
- rm_rf "testdata", :verbose=>false
315
+ Rake.rm_rf "testdata", :verbose=>false
312
316
  end
313
317
 
314
318
  def teardown
315
- rm_rf "testdata", :verbose=>false
319
+ Rake.rm_rf "testdata", :verbose=>false
316
320
  end
317
321
 
318
322
  def test_directory
@@ -20,7 +20,7 @@ class TestFileList < Test::Unit::TestCase
20
20
  FileUtils.rm_rf("testdata")
21
21
  end
22
22
 
23
- def test_delgating_methods_do_not_include_to_a_or_to_ary
23
+ def test_delegating_methods_do_not_include_to_a_or_to_ary
24
24
  assert ! FileList::DELEGATING_METHODS.include?("to_a"), "should not include to_a"
25
25
  assert ! FileList::DELEGATING_METHODS.include?(:to_a), "should not include to_a"
26
26
  assert ! FileList::DELEGATING_METHODS.include?("to_ary"), "should not include to_ary"
@@ -87,11 +87,11 @@ class TestFileList < Test::Unit::TestCase
87
87
  h = f.include("y")
88
88
  assert_equal f.object_id, h.object_id
89
89
  end
90
-
90
+
91
91
  def test_match
92
92
  fl = FileList.new
93
- fl.include('test/test*.rb')
94
- assert fl.include?("test/test_filelist.rb")
93
+ fl.include('test/lib/*_test.rb')
94
+ assert fl.include?("test/lib/filelist_test.rb")
95
95
  assert fl.size > 3
96
96
  fl.each { |fn| assert_match(/\.rb$/, fn) }
97
97
  end
@@ -99,10 +99,10 @@ class TestFileList < Test::Unit::TestCase
99
99
  def test_add_matching
100
100
  fl = FileList.new
101
101
  fl << "a.java"
102
- fl.include("test/*.rb")
102
+ fl.include("test/lib/*.rb")
103
103
  assert_equal "a.java", fl[0]
104
104
  assert fl.size > 2
105
- assert fl.include?("test/test_filelist.rb")
105
+ assert fl.include?("test/lib/filelist_test.rb")
106
106
  end
107
107
 
108
108
  def test_multiple_patterns
@@ -153,7 +153,7 @@ class TestFileList < Test::Unit::TestCase
153
153
  fl.exclude('testdata/existing')
154
154
  assert_equal [], fl
155
155
  end
156
-
156
+
157
157
  def test_excluding_via_block
158
158
  fl = FileList['testdata/a.c', 'testdata/b.c', 'testdata/xyz.c']
159
159
  fl.exclude { |fn| fn.pathmap('%n') == 'xyz' }
@@ -233,24 +233,24 @@ class TestFileList < Test::Unit::TestCase
233
233
  assert_equal ["testdata/abc.o", "testdata/x.o", "testdata/xyz.o"].sort,
234
234
  f3.sort
235
235
  end
236
-
236
+
237
237
  def test_claim_to_be_a_kind_of_array
238
238
  fl = FileList['testdata/*.c']
239
239
  assert fl.is_a?(Array)
240
240
  assert fl.kind_of?(Array)
241
241
  end
242
-
242
+
243
243
  def test_claim_to_be_a_kind_of_filelist
244
244
  fl = FileList['testdata/*.c']
245
245
  assert fl.is_a?(FileList)
246
246
  assert fl.kind_of?(FileList)
247
247
  end
248
-
248
+
249
249
  def test_claim_to_be_a_filelist_instance
250
250
  fl = FileList['testdata/*.c']
251
251
  assert fl.instance_of?(FileList)
252
252
  end
253
-
253
+
254
254
  def test_dont_claim_to_be_an_array_instance
255
255
  fl = FileList['testdata/*.c']
256
256
  assert ! fl.instance_of?(Array)
@@ -323,24 +323,38 @@ class TestFileList < Test::Unit::TestCase
323
323
  f.sort
324
324
  end
325
325
 
326
+ def test_egrep_returns_0_if_no_matches
327
+ files = FileList['test/lib/*_test.rb'].exclude("test/lib/filelist_test.rb")
328
+ assert_equal 0, files.egrep(/XYZZY/) { }
329
+ end
330
+
326
331
  def test_egrep_with_output
327
- files = FileList['test/test*.rb']
332
+ files = FileList['test/lib/*_test.rb']
328
333
  the_line_number = __LINE__ + 1
329
334
  out = capture_stdout do files.egrep(/PUGH/) end
330
335
  assert_match(/:#{the_line_number}:/, out)
331
336
  end
332
337
 
333
338
  def test_egrep_with_block
334
- files = FileList['test/test*.rb']
335
- found = false
339
+ files = FileList['test/lib/*_test.rb']
340
+ found = nil
336
341
  the_line_number = __LINE__ + 1
337
342
  files.egrep(/XYZZY/) do |fn, ln, line |
338
- assert_equal 'test/test_filelist.rb', fn
339
- assert_equal the_line_number, ln
340
- assert_match(/files\.egrep/, line)
341
- found = true
343
+ found = [fn, ln, line]
342
344
  end
343
- assert found, "should have found a matching line"
345
+ assert_equal 'test/lib/filelist_test.rb', found[0]
346
+ assert_equal the_line_number, found[1]
347
+ assert_match(/files\.egrep/, found[2])
348
+ end
349
+
350
+ def test_egrep_with_error
351
+ files = FileList['test/lib/*_test.rb']
352
+ error_messages = capture_stderr do
353
+ files.egrep(/ANYTHING/) do |fn, ln, line |
354
+ fail "_EGREP_FAILURE_"
355
+ end
356
+ end
357
+ assert_match(/_EGREP_FAILURE_/, error_messages)
344
358
  end
345
359
 
346
360
  def test_existing
@@ -588,12 +602,12 @@ class TestFileList < Test::Unit::TestCase
588
602
  assert_equal ['b', 'd'], r
589
603
  assert_equal FileList, r.class
590
604
  end
591
-
605
+
592
606
  def test_file_utils_can_use_filelists
593
607
  cfiles = FileList['testdata/*.c']
594
-
608
+
595
609
  cp cfiles, @cdir, :verbose => false
596
-
610
+
597
611
  assert File.exist?(File.join(@cdir, 'abc.c'))
598
612
  assert File.exist?(File.join(@cdir, 'xyz.c'))
599
613
  assert File.exist?(File.join(@cdir, 'x.c'))
@@ -601,7 +615,7 @@ class TestFileList < Test::Unit::TestCase
601
615
 
602
616
  def create_test_data
603
617
  verbose(false) do
604
-
618
+
605
619
  mkdir "testdata" unless File.exist? "testdata"
606
620
  mkdir "testdata/CVS" rescue nil
607
621
  mkdir "testdata/.svn" rescue nil
@@ -619,5 +633,5 @@ class TestFileList < Test::Unit::TestCase
619
633
  touch "testdata/existing"
620
634
  end
621
635
  end
622
-
636
+
623
637
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rake'
4
4
  require 'test/unit'
5
- require 'test/filecreation'
5
+ require 'test/file_creation'
6
6
  require 'fileutils'
7
7
  require 'stringio'
8
8
  require 'test/rake_test_setup'
@@ -10,16 +10,18 @@ require 'test/rake_test_setup'
10
10
  class TestFileUtils < Test::Unit::TestCase
11
11
  include FileCreation
12
12
  include TestMethods
13
+ include Rake::DSL
13
14
 
14
15
  def setup
15
- File.chmod(0750,"test/shellcommand.rb")
16
+ File.chmod(0750, "test/shellcommand.rb")
16
17
  end
17
-
18
+
18
19
  def teardown
20
+ File.chmod(0755, "test/shellcommand.rb")
19
21
  FileUtils.rm_rf("testdata")
20
22
  FileUtils::LN_SUPPORTED[0] = true
21
23
  end
22
-
24
+
23
25
  def test_rm_one_file
24
26
  create_file("testdata/a")
25
27
  FileUtils.rm_rf "testdata/a"
@@ -45,12 +47,12 @@ class TestFileUtils < Test::Unit::TestCase
45
47
  def test_ln
46
48
  create_dir("testdata")
47
49
  open("testdata/a", "w") { |f| f.puts "TEST_LN" }
48
- RakeFileUtils.safe_ln("testdata/a", "testdata/b", :verbose => false)
50
+ Rake::FileUtilsExt.safe_ln("testdata/a", "testdata/b", :verbose => false)
49
51
  assert_equal "TEST_LN\n", open("testdata/b") { |f| f.read }
50
52
  end
51
53
 
52
54
  class BadLink
53
- include RakeFileUtils
55
+ include Rake::FileUtilsExt
54
56
  attr_reader :cp_args
55
57
  def initialize(klass)
56
58
  @failure_class = klass
@@ -117,11 +119,11 @@ class TestFileUtils < Test::Unit::TestCase
117
119
  def test_fileutils_methods_dont_leak
118
120
  obj = Object.new
119
121
  assert_exception(NoMethodError) { obj.copy } # from FileUtils
120
- assert_exception(NoMethodError) { obj.ruby } # from RubyFileUtils
122
+ assert_exception(NoMethodError) { obj.ruby "-v" } # from RubyFileUtils
121
123
  end
122
124
 
123
125
  def test_sh
124
- verbose(false) { sh %{ruby test/shellcommand.rb} }
126
+ verbose(false) { sh %{#{FileUtils::RUBY} test/shellcommand.rb} }
125
127
  assert true, "should not fail"
126
128
  end
127
129
 
@@ -137,37 +139,40 @@ class TestFileUtils < Test::Unit::TestCase
137
139
  def self.run(*args)
138
140
  new.run(*args)
139
141
  end
142
+ def self.ruby(*args)
143
+ Sh.run(RUBY, *args)
144
+ end
140
145
  end
141
146
 
142
147
  def test_sh_with_a_single_string_argument
143
148
  ENV['RAKE_TEST_SH'] = 'someval'
144
149
  verbose(false) {
145
- sh %{ruby test/check_expansion.rb #{env_var} someval}
150
+ sh %{#{FileUtils::RUBY} test/check_expansion.rb #{env_var} someval}
146
151
  }
147
152
  end
148
153
 
149
154
  def test_sh_with_multiple_arguments
150
155
  ENV['RAKE_TEST_SH'] = 'someval'
151
156
  verbose(false) {
152
- Sh.run 'ruby', 'test/check_no_expansion.rb', env_var, 'someval'
157
+ Sh.ruby 'test/check_no_expansion.rb', env_var, 'someval'
153
158
  }
154
159
  end
155
160
 
156
161
  def test_sh_failure
157
- assert_exception(RuntimeError) {
158
- verbose(false) { Sh.run %{ruby test/shellcommand.rb 1} }
162
+ assert_exception(RuntimeError) {
163
+ verbose(false) { Sh.run %{#{FileUtils::RUBY} test/shellcommand.rb 1} }
159
164
  }
160
165
  end
161
166
 
162
167
  def test_sh_special_handling
163
168
  count = 0
164
169
  verbose(false) {
165
- sh(%{ruby test/shellcommand.rb}) do |ok, res|
170
+ sh(%{#{FileUtils::RUBY} test/shellcommand.rb}) do |ok, res|
166
171
  assert(ok)
167
172
  assert_equal 0, res.exitstatus
168
173
  count += 1
169
174
  end
170
- sh(%{ruby test/shellcommand.rb 1}) do |ok, res|
175
+ sh(%{#{FileUtils::RUBY} test/shellcommand.rb 1}) do |ok, res|
171
176
  assert(!ok)
172
177
  assert_equal 1, res.exitstatus
173
178
  count += 1
@@ -221,16 +226,16 @@ class TestFileUtils < Test::Unit::TestCase
221
226
  end
222
227
 
223
228
  def test_split_all
224
- assert_equal ['a'], RakeFileUtils.split_all('a')
225
- assert_equal ['..'], RakeFileUtils.split_all('..')
226
- assert_equal ['/'], RakeFileUtils.split_all('/')
227
- assert_equal ['a', 'b'], RakeFileUtils.split_all('a/b')
228
- assert_equal ['/', 'a', 'b'], RakeFileUtils.split_all('/a/b')
229
- assert_equal ['..', 'a', 'b'], RakeFileUtils.split_all('../a/b')
229
+ assert_equal ['a'], Rake::FileUtilsExt.split_all('a')
230
+ assert_equal ['..'], Rake::FileUtilsExt.split_all('..')
231
+ assert_equal ['/'], Rake::FileUtilsExt.split_all('/')
232
+ assert_equal ['a', 'b'], Rake::FileUtilsExt.split_all('a/b')
233
+ assert_equal ['/', 'a', 'b'], Rake::FileUtilsExt.split_all('/a/b')
234
+ assert_equal ['..', 'a', 'b'], Rake::FileUtilsExt.split_all('../a/b')
230
235
  end
231
236
 
232
237
  private
233
-
238
+
234
239
  def redirect_stderr
235
240
  old_err = $stderr
236
241
  $stderr = StringIO.new
@@ -247,5 +252,5 @@ class TestFileUtils < Test::Unit::TestCase
247
252
  def env_var
248
253
  windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
249
254
  end
250
-
255
+
251
256
  end