rake 0.8.7 → 0.9.0.beta.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rake might be problematic. Click here for more details.
- data/.gemtest +0 -0
- data/CHANGES +77 -9
- data/{README → README.rdoc} +14 -10
- data/Rakefile +113 -110
- data/TODO +1 -1
- data/doc/command_line_usage.rdoc +18 -6
- data/doc/glossary.rdoc +2 -2
- data/doc/jamis.rb +2 -2
- data/doc/proto_rake.rdoc +22 -22
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +60 -28
- data/doc/rational.rdoc +6 -6
- data/doc/release_notes/rake-0.4.15.rdoc +1 -1
- data/doc/release_notes/rake-0.5.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.2.rdoc +3 -3
- data/doc/release_notes/rake-0.7.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.0.rdoc +1 -1
- data/doc/release_notes/rake-0.8.2.rdoc +3 -3
- data/doc/release_notes/rake-0.8.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.4.rdoc +1 -1
- data/doc/release_notes/rake-0.8.5.rdoc +1 -1
- data/doc/release_notes/rake-0.8.6.rdoc +1 -1
- data/doc/release_notes/rake-0.8.7.rdoc +1 -1
- data/install.rb +14 -12
- data/lib/rake.rb +28 -2470
- data/lib/rake/alt_system.rb +7 -6
- data/lib/rake/application.rb +585 -0
- data/lib/rake/classic_namespace.rb +1 -0
- data/lib/rake/clean.rb +14 -14
- data/lib/rake/cloneable.rb +25 -0
- data/lib/rake/contrib/compositepublisher.rb +2 -5
- data/lib/rake/contrib/ftptools.rb +5 -8
- data/lib/rake/contrib/publisher.rb +2 -8
- data/lib/rake/contrib/rubyforgepublisher.rb +2 -4
- data/lib/rake/contrib/sshpublisher.rb +4 -6
- data/lib/rake/contrib/sys.rb +7 -25
- data/lib/rake/default_loader.rb +10 -0
- data/lib/rake/dsl.rb +2 -0
- data/lib/rake/dsl_definition.rb +146 -0
- data/lib/rake/early_time.rb +18 -0
- data/lib/rake/environment.rb +40 -0
- data/lib/rake/ext/core.rb +27 -0
- data/lib/rake/ext/module.rb +39 -0
- data/lib/rake/ext/string.rb +167 -0
- data/lib/rake/ext/time.rb +14 -0
- data/lib/rake/file_creation_task.rb +24 -0
- data/lib/rake/file_list.rb +403 -0
- data/lib/rake/file_task.rb +47 -0
- data/lib/rake/file_utils.rb +112 -0
- data/lib/rake/file_utils_ext.rb +132 -0
- data/lib/rake/gempackagetask.rb +6 -90
- data/lib/rake/invocation_chain.rb +51 -0
- data/lib/rake/invocation_exception_mixin.rb +16 -0
- data/lib/rake/loaders/makefile.rb +13 -15
- data/lib/rake/multi_task.rb +16 -0
- data/lib/rake/name_space.rb +25 -0
- data/lib/rake/packagetask.rb +13 -12
- data/lib/rake/pathmap.rb +1 -0
- data/lib/rake/pseudo_status.rb +24 -0
- data/lib/rake/rake_module.rb +25 -0
- data/lib/rake/rake_test_loader.rb +10 -2
- data/lib/rake/rdoctask.rb +211 -190
- data/lib/rake/ruby182_test_unit_fix.rb +9 -7
- data/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/lib/rake/runtest.rb +4 -6
- data/lib/rake/task.rb +327 -0
- data/lib/rake/task_argument_error.rb +7 -0
- data/lib/rake/task_arguments.rb +74 -0
- data/lib/rake/task_manager.rb +329 -0
- data/lib/rake/tasklib.rb +1 -2
- data/lib/rake/testtask.rb +51 -26
- data/lib/rake/version.rb +12 -0
- data/lib/rake/win32.rb +4 -4
- data/test/contrib/test_sys.rb +7 -30
- data/test/data/comments/Rakefile +18 -0
- data/test/data/default/Rakefile +1 -1
- data/test/data/dryrun/Rakefile +1 -1
- data/test/data/file_creation_task/Rakefile +1 -1
- data/test/data/namespace/Rakefile +9 -0
- data/test/data/rakelib/test1.rb +4 -2
- data/test/data/verbose/Rakefile +34 -0
- data/test/functional/functional_test.rb +25 -0
- data/test/{session_functional.rb → functional/session_based_tests.rb} +134 -23
- data/test/in_environment.rb +6 -4
- data/test/{test_application.rb → lib/application_test.rb} +277 -136
- data/test/{test_clean.rb → lib/clean_test.rb} +1 -0
- data/test/{test_definitions.rb → lib/definitions_test.rb} +2 -2
- data/test/lib/dsl_test.rb +52 -0
- data/test/{test_earlytime.rb → lib/earlytime_test.rb} +1 -2
- data/test/lib/environment_test.rb +18 -0
- data/test/{test_extension.rb → lib/extension_test.rb} +2 -2
- data/test/{test_file_creation_task.rb → lib/file_creation_task_test.rb} +0 -0
- data/test/{test_file_task.rb → lib/file_task_test.rb} +3 -3
- data/test/{test_filelist.rb → lib/filelist_test.rb} +28 -24
- data/test/{test_fileutils.rb → lib/fileutils_test.rb} +26 -21
- data/test/{test_ftp.rb → lib/ftp_test.rb} +0 -0
- data/test/{test_invocation_chain.rb → lib/invocation_chain_test.rb} +0 -0
- data/test/{test_makefile_loader.rb → lib/makefile_loader_test.rb} +0 -0
- data/test/{test_multitask.rb → lib/multitask_test.rb} +14 -6
- data/test/{test_namespace.rb → lib/namespace_test.rb} +0 -0
- data/test/lib/package_task_test.rb +82 -0
- data/test/{test_pathmap.rb → lib/pathmap_test.rb} +3 -2
- data/test/{test_pseudo_status.rb → lib/pseudo_status_test.rb} +0 -0
- data/test/{test_rake.rb → lib/rake_test.rb} +1 -1
- data/test/{test_rdoc_task.rb → lib/rdoc_task_test.rb} +19 -23
- data/test/{test_require.rb → lib/require_test.rb} +8 -2
- data/test/{test_rules.rb → lib/rules_test.rb} +1 -2
- data/test/{test_task_arguments.rb → lib/task_arguments_test.rb} +5 -5
- data/test/{test_task_manager.rb → lib/task_manager_test.rb} +5 -5
- data/test/{test_tasks.rb → lib/task_test.rb} +69 -4
- data/test/{test_tasklib.rb → lib/tasklib_test.rb} +0 -0
- data/test/{test_test_task.rb → lib/test_task_test.rb} +3 -3
- data/test/lib/testtask_test.rb +49 -0
- data/test/{test_top_level_functions.rb → lib/top_level_functions_test.rb} +3 -3
- data/test/{test_win32.rb → lib/win32_test.rb} +19 -0
- data/test/rake_test_setup.rb +4 -9
- data/test/ruby_version_test.rb +3 -0
- data/test/test_helper.rb +12 -0
- metadata +100 -44
- data/test/functional.rb +0 -15
- data/test/test_package_task.rb +0 -118
@@ -10,7 +10,7 @@ require 'test/rake_test_setup'
|
|
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
|
@@ -82,4 +82,4 @@ class TestDefinitions < Test::Unit::TestCase
|
|
82
82
|
end
|
83
83
|
|
84
84
|
end
|
85
|
-
|
85
|
+
|
@@ -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
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
4
|
+
require 'rake/environment'
|
5
|
+
|
6
|
+
class TestEnvironment < Test::Unit::TestCase
|
7
|
+
def test_load_string
|
8
|
+
Rake::Task.clear
|
9
|
+
Rake::Environment.load_string("task :xyz")
|
10
|
+
assert Rake::Task[:xyz], "should have a task named xyz"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_load_rakefile
|
14
|
+
Rake::Task.clear
|
15
|
+
Rake::Environment.load_rakefile("test/data/default/Rakefile")
|
16
|
+
assert Rake::Task[:default], "Should have a default task"
|
17
|
+
end
|
18
|
+
end
|
@@ -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
|
File without changes
|
@@ -77,7 +77,7 @@ class TestFileTask < Test::Unit::TestCase
|
|
77
77
|
# deleting the file target on failure is always the proper thing to
|
78
78
|
# do. I'm willing to hear input on this topic.
|
79
79
|
def ztest_file_deletes_on_failure
|
80
|
-
task :obj
|
80
|
+
task :obj
|
81
81
|
file NEWFILE => [:obj] do |t|
|
82
82
|
FileUtils.touch NEWFILE
|
83
83
|
fail "Ooops"
|
@@ -97,11 +97,11 @@ class TestDirectoryTask < Test::Unit::TestCase
|
|
97
97
|
include Rake
|
98
98
|
|
99
99
|
def setup
|
100
|
-
rm_rf "testdata", :verbose=>false
|
100
|
+
Rake.rm_rf "testdata", :verbose=>false
|
101
101
|
end
|
102
102
|
|
103
103
|
def teardown
|
104
|
-
rm_rf "testdata", :verbose=>false
|
104
|
+
Rake.rm_rf "testdata", :verbose=>false
|
105
105
|
end
|
106
106
|
|
107
107
|
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
|
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/
|
94
|
-
assert fl.include?("test/
|
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/
|
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,28 @@ 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/
|
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/
|
335
|
-
found =
|
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
|
-
|
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
|
-
|
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])
|
344
348
|
end
|
345
349
|
|
346
350
|
def test_existing
|
@@ -588,12 +592,12 @@ class TestFileList < Test::Unit::TestCase
|
|
588
592
|
assert_equal ['b', 'd'], r
|
589
593
|
assert_equal FileList, r.class
|
590
594
|
end
|
591
|
-
|
595
|
+
|
592
596
|
def test_file_utils_can_use_filelists
|
593
597
|
cfiles = FileList['testdata/*.c']
|
594
|
-
|
598
|
+
|
595
599
|
cp cfiles, @cdir, :verbose => false
|
596
|
-
|
600
|
+
|
597
601
|
assert File.exist?(File.join(@cdir, 'abc.c'))
|
598
602
|
assert File.exist?(File.join(@cdir, 'xyz.c'))
|
599
603
|
assert File.exist?(File.join(@cdir, 'x.c'))
|
@@ -601,7 +605,7 @@ class TestFileList < Test::Unit::TestCase
|
|
601
605
|
|
602
606
|
def create_test_data
|
603
607
|
verbose(false) do
|
604
|
-
|
608
|
+
|
605
609
|
mkdir "testdata" unless File.exist? "testdata"
|
606
610
|
mkdir "testdata/CVS" rescue nil
|
607
611
|
mkdir "testdata/.svn" rescue nil
|
@@ -619,5 +623,5 @@ class TestFileList < Test::Unit::TestCase
|
|
619
623
|
touch "testdata/existing"
|
620
624
|
end
|
621
625
|
end
|
622
|
-
|
626
|
+
|
623
627
|
end
|
@@ -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
|
-
|
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
|
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 %{
|
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 %{
|
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.
|
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 %{
|
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(%{
|
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(%{
|
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'],
|
225
|
-
assert_equal ['..'],
|
226
|
-
assert_equal ['/'],
|
227
|
-
assert_equal ['a', 'b'],
|
228
|
-
assert_equal ['/', 'a', 'b'],
|
229
|
-
assert_equal ['..', '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
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
|
+
require 'thread'
|
4
5
|
require 'rake'
|
5
6
|
|
6
7
|
######################################################################
|
@@ -10,11 +11,18 @@ class TestMultiTask < Test::Unit::TestCase
|
|
10
11
|
def setup
|
11
12
|
Task.clear
|
12
13
|
@runs = Array.new
|
14
|
+
@mutex = Mutex.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_run(obj)
|
18
|
+
@mutex.synchronize do
|
19
|
+
@runs << obj
|
20
|
+
end
|
13
21
|
end
|
14
22
|
|
15
23
|
def test_running_multitasks
|
16
|
-
task :a do 3.times do |i|
|
17
|
-
task :b do 3.times do |i|
|
24
|
+
task :a do 3.times do |i| add_run("A#{i}"); sleep 0.01; end end
|
25
|
+
task :b do 3.times do |i| add_run("B#{i}"); sleep 0.01; end end
|
18
26
|
multitask :both => [:a, :b]
|
19
27
|
Task[:both].invoke
|
20
28
|
assert_equal 6, @runs.size
|
@@ -25,9 +33,9 @@ class TestMultiTask < Test::Unit::TestCase
|
|
25
33
|
end
|
26
34
|
|
27
35
|
def test_all_multitasks_wait_on_slow_prerequisites
|
28
|
-
task :slow do 3.times do |i|
|
29
|
-
task :a => [:slow] do 3.times do |i|
|
30
|
-
task :b => [:slow] do 3.times do |i|
|
36
|
+
task :slow do 3.times do |i| add_run("S#{i}"); sleep 0.05 end end
|
37
|
+
task :a => [:slow] do 3.times do |i| add_run("A#{i}"); sleep 0.01 end end
|
38
|
+
task :b => [:slow] do 3.times do |i| add_run("B#{i}"); sleep 0.01 end end
|
31
39
|
multitask :both => [:a, :b]
|
32
40
|
Task[:both].invoke
|
33
41
|
assert_equal 9, @runs.size
|
@@ -42,4 +50,4 @@ class TestMultiTask < Test::Unit::TestCase
|
|
42
50
|
end
|
43
51
|
end
|
44
52
|
|
45
|
-
|
53
|
+
|