rant 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +504 -0
- data/README +203 -0
- data/Rantfile +104 -0
- data/TODO +19 -0
- data/bin/rant +12 -0
- data/bin/rant-import +12 -0
- data/devel-notes +50 -0
- data/doc/configure.rdoc +40 -0
- data/doc/csharp.rdoc +74 -0
- data/doc/rant-import.rdoc +32 -0
- data/doc/rant.rdoc +24 -0
- data/doc/rantfile.rdoc +227 -0
- data/doc/rubyproject.rdoc +210 -0
- data/lib/rant.rb +9 -0
- data/lib/rant/cs_compiler.rb +334 -0
- data/lib/rant/import.rb +291 -0
- data/lib/rant/import/rubydoc.rb +125 -0
- data/lib/rant/import/rubypackage.rb +417 -0
- data/lib/rant/import/rubytest.rb +97 -0
- data/lib/rant/plugin/README +50 -0
- data/lib/rant/plugin/configure.rb +345 -0
- data/lib/rant/plugin/csharp.rb +275 -0
- data/lib/rant/plugin_methods.rb +41 -0
- data/lib/rant/rantenv.rb +217 -0
- data/lib/rant/rantfile.rb +664 -0
- data/lib/rant/rantlib.rb +1118 -0
- data/lib/rant/rantsys.rb +258 -0
- data/lib/rant/rantvar.rb +82 -0
- data/rantmethods.rb +79 -0
- data/run_import +7 -0
- data/run_rant +7 -0
- data/setup.rb +1360 -0
- data/test/Rantfile +2 -0
- data/test/plugin/configure/Rantfile +47 -0
- data/test/plugin/configure/test_configure.rb +58 -0
- data/test/plugin/csharp/Hello.cs +10 -0
- data/test/plugin/csharp/Rantfile +30 -0
- data/test/plugin/csharp/src/A.cs +8 -0
- data/test/plugin/csharp/src/B.cs +8 -0
- data/test/plugin/csharp/test_csharp.rb +99 -0
- data/test/project1/Rantfile +127 -0
- data/test/project1/test_project.rb +203 -0
- data/test/project2/buildfile +14 -0
- data/test/project2/rantfile.rb +20 -0
- data/test/project2/sub1/Rantfile +12 -0
- data/test/project2/test_project.rb +87 -0
- data/test/project_rb1/README +14 -0
- data/test/project_rb1/bin/wgrep +5 -0
- data/test/project_rb1/lib/wgrep.rb +56 -0
- data/test/project_rb1/rantfile.rb +30 -0
- data/test/project_rb1/test/tc_wgrep.rb +21 -0
- data/test/project_rb1/test/text +3 -0
- data/test/project_rb1/test_project_rb1.rb +153 -0
- data/test/test_env.rb +47 -0
- data/test/test_filetask.rb +57 -0
- data/test/test_lighttask.rb +49 -0
- data/test/test_metatask.rb +29 -0
- data/test/test_rant_interface.rb +65 -0
- data/test/test_sys.rb +61 -0
- data/test/test_task.rb +115 -0
- data/test/toplevel.rf +11 -0
- data/test/ts_all.rb +4 -0
- data/test/tutil.rb +95 -0
- metadata +133 -0
data/test/Rantfile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
rd = File.expand_path("../../../lib")
|
4
|
+
$:.unshift rd unless $:.include? rd
|
5
|
+
|
6
|
+
require 'rant'
|
7
|
+
|
8
|
+
task :hello do |t|
|
9
|
+
sys.touch t.name
|
10
|
+
end
|
11
|
+
|
12
|
+
conf = plugin :Configure do |conf|
|
13
|
+
conf.init_modes = [:default]
|
14
|
+
conf.override_modes = nil
|
15
|
+
conf.task # define a task named :configure
|
16
|
+
conf.check "a" do |c|
|
17
|
+
c.default "value_a"
|
18
|
+
c.guess { "value_a_guess" }
|
19
|
+
c.react { |val|
|
20
|
+
p val
|
21
|
+
}
|
22
|
+
end
|
23
|
+
conf.check "b" do |c|
|
24
|
+
c.default "value_b"
|
25
|
+
end
|
26
|
+
conf.check "c" do |c|
|
27
|
+
end
|
28
|
+
conf.check "d" do |c|
|
29
|
+
c.react {
|
30
|
+
}
|
31
|
+
end
|
32
|
+
conf.check "e" do |c|
|
33
|
+
c.guess { false }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
file conf["a"] do |t|
|
38
|
+
sys.touch t.name
|
39
|
+
end
|
40
|
+
|
41
|
+
task :clean do
|
42
|
+
sys.rm_f %w(config hello value_a value_a_guess)
|
43
|
+
end
|
44
|
+
|
45
|
+
if $0 == __FILE__
|
46
|
+
Rant.run
|
47
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rant'
|
4
|
+
require 'tutil'
|
5
|
+
|
6
|
+
$testPluginConfigureDir = File.expand_path(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
class TestPluginConfigure < Test::Unit::TestCase
|
9
|
+
def setup
|
10
|
+
# Ensure we run in test directory.
|
11
|
+
Dir.chdir($testPluginConfigureDir) unless Dir.pwd == $testPluginConfigureDir
|
12
|
+
end
|
13
|
+
def teardown
|
14
|
+
capture_std do
|
15
|
+
assert_equal(Rant.run("clean"), 0)
|
16
|
+
end
|
17
|
+
assert(!File.exist?("hello"),
|
18
|
+
"hello should have been removed by `clean'")
|
19
|
+
assert(!File.exist?("config"),
|
20
|
+
"config should have been removed by `clean'")
|
21
|
+
end
|
22
|
+
def test_startup
|
23
|
+
capture_std do
|
24
|
+
assert_equal(Rant.run([]), 0)
|
25
|
+
end
|
26
|
+
assert(File.exist?("hello"),
|
27
|
+
"target `hello' is first, and should have been run")
|
28
|
+
assert(!File.exist?("config"),
|
29
|
+
"config should have used defaults, no writing")
|
30
|
+
end
|
31
|
+
def test_configure
|
32
|
+
capture_std do
|
33
|
+
assert_equal(Rant.run("configure"), 0)
|
34
|
+
end
|
35
|
+
assert(File.exist?("config"),
|
36
|
+
"config should have been created by `configure'")
|
37
|
+
capture_std do
|
38
|
+
assert_equal(Rant.run("value_a_guess"), 0,
|
39
|
+
"value_a_guess should be choosen based on config")
|
40
|
+
end
|
41
|
+
assert(File.exist?("value_a_guess"))
|
42
|
+
end
|
43
|
+
def test_configure_immediate
|
44
|
+
capture_std do
|
45
|
+
assert_equal(Rant.run(%w(configure value_a)), 0,
|
46
|
+
"on task creation time, conf['a'] had the value `value_a'")
|
47
|
+
end
|
48
|
+
assert(!File.exist?("value_a_guess"))
|
49
|
+
assert(File.exist?("value_a"))
|
50
|
+
end
|
51
|
+
def test_defaults
|
52
|
+
capture_std do
|
53
|
+
assert_equal(Rant.run("value_a"), 0)
|
54
|
+
end
|
55
|
+
assert(File.exist?("value_a"))
|
56
|
+
assert(!File.exist?("value_a_guess"))
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
plugin :Csharp
|
3
|
+
|
4
|
+
src_files = FileList["src/*.cs"]
|
5
|
+
|
6
|
+
gen Assembly, "hello.exe" do |t|
|
7
|
+
t.sources = %w(Hello.cs)
|
8
|
+
end
|
9
|
+
|
10
|
+
gen Assembly, "AB.dll" => "hello.exe" do |t|
|
11
|
+
t.sources = src_files
|
12
|
+
t.debug = true
|
13
|
+
t.optimize = true
|
14
|
+
t.warnings = true
|
15
|
+
end
|
16
|
+
|
17
|
+
=begin
|
18
|
+
assembly "hello.exe" => "Hello.cs"
|
19
|
+
|
20
|
+
assembly "AB.dll" => src_files + ["hello.exe"] do |t|
|
21
|
+
t.sources = src_files
|
22
|
+
t.debug = true
|
23
|
+
t.optimize = true
|
24
|
+
t.warnings = true
|
25
|
+
end
|
26
|
+
=end
|
27
|
+
|
28
|
+
task :clean do
|
29
|
+
sys.rm_f FileList["*.{exe,dll,obj}"]
|
30
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rant'
|
4
|
+
require 'rant/plugin/csharp'
|
5
|
+
require 'tutil'
|
6
|
+
|
7
|
+
$testPluginCsDir = File.expand_path(File.dirname(__FILE__))
|
8
|
+
$have_csc = Env.find_bin("csc") || Env.find_bin("cscc") || Env.find_bin("mcs")
|
9
|
+
|
10
|
+
class TestPluginCsharp < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
# Ensure we run in test directory.
|
13
|
+
Dir.chdir($testPluginCsDir) unless Dir.pwd == $testPluginCsDir
|
14
|
+
end
|
15
|
+
def teardown
|
16
|
+
capture_std do
|
17
|
+
assert(Rant.run("clean"), 0)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if $have_csc
|
21
|
+
# Try to compile the "hello world" program. Requires cscc, csc
|
22
|
+
# or mcs to be on your PATH.
|
23
|
+
def test_hello
|
24
|
+
capture_std do
|
25
|
+
assert_equal(Rant.run([]), 0,
|
26
|
+
"first target, `hello.exe', should be compiled")
|
27
|
+
end
|
28
|
+
assert(File.exist?("hello.exe"),
|
29
|
+
"hello.exe is the first target in Rantfile")
|
30
|
+
if Env.on_windows?
|
31
|
+
assert_equal(`hello.exe`.chomp, "Hello, world!",
|
32
|
+
"hello.exe should print `Hello, world!'")
|
33
|
+
elsif (ilrun = Env.find_bin("ilrun"))
|
34
|
+
assert_equal(`#{ilrun} hello.exe`.chomp, "Hello, world!",
|
35
|
+
"hello.exe should print `Hello, world!'")
|
36
|
+
elsif (mono = Env.find_bin("mono"))
|
37
|
+
assert_equal(`#{mono} hello.exe`.chomp, "Hello, world!",
|
38
|
+
"hello.exe should print `Hello, world!'")
|
39
|
+
else
|
40
|
+
$stderr.puts "Can't run hello.exe for testing."
|
41
|
+
end
|
42
|
+
end
|
43
|
+
def test_opts
|
44
|
+
capture_std do
|
45
|
+
assert_equal(Rant.run("AB.dll"), 0)
|
46
|
+
end
|
47
|
+
assert(File.exist?("hello.exe"),
|
48
|
+
"AB.dll depends on hello.exe")
|
49
|
+
assert(File.exist?("AB.dll"))
|
50
|
+
end
|
51
|
+
def test_cscc
|
52
|
+
old_csc = Assembly.csc
|
53
|
+
cscc = Env.find_bin("cscc")
|
54
|
+
unless cscc
|
55
|
+
$stderr.puts "cscc not on path, will not test cscc"
|
56
|
+
return
|
57
|
+
end
|
58
|
+
Assembly.csc = cscc
|
59
|
+
test_opts
|
60
|
+
Assembly.csc = old_csc
|
61
|
+
end
|
62
|
+
def test_mcs
|
63
|
+
old_csc = Assembly.csc
|
64
|
+
mcs = Env.find_bin("mcs")
|
65
|
+
unless mcs
|
66
|
+
$stderr.puts "mcs not on path, will not test mcs"
|
67
|
+
return
|
68
|
+
end
|
69
|
+
Assembly.csc = mcs
|
70
|
+
test_opts
|
71
|
+
Assembly.csc = old_csc
|
72
|
+
end
|
73
|
+
def test_csc
|
74
|
+
old_csc = Assembly.csc
|
75
|
+
csc = Env.find_bin("csc")
|
76
|
+
unless csc
|
77
|
+
$stderr.puts "csc not on path, will not test csc"
|
78
|
+
return
|
79
|
+
end
|
80
|
+
Assembly.csc = csc
|
81
|
+
test_opts
|
82
|
+
Assembly.csc = old_csc
|
83
|
+
end
|
84
|
+
else
|
85
|
+
def test_dummy
|
86
|
+
# required to fool test/unit if no C# compiler available,
|
87
|
+
# so we skip all real tests
|
88
|
+
assert(true)
|
89
|
+
# remove this method if a test is added that doesn't depend on
|
90
|
+
# the C# compiler
|
91
|
+
end
|
92
|
+
print <<-EOF
|
93
|
+
************************************************************
|
94
|
+
* No C# compiler found on your path. Skipping all tests *
|
95
|
+
* depending on a C# compiler. *
|
96
|
+
************************************************************
|
97
|
+
EOF
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
|
2
|
+
file "test_touch" do |t|
|
3
|
+
sys.touch t.name
|
4
|
+
end
|
5
|
+
|
6
|
+
task :clean do
|
7
|
+
sys.rm "test_touch"
|
8
|
+
end
|
9
|
+
|
10
|
+
task :create_target do
|
11
|
+
sys.touch "target"
|
12
|
+
end
|
13
|
+
|
14
|
+
task :create_dep do
|
15
|
+
sys.touch "dep"
|
16
|
+
end
|
17
|
+
|
18
|
+
file "target" => "dep" do |t|
|
19
|
+
sys.touch t.name
|
20
|
+
end
|
21
|
+
|
22
|
+
file "t2" => ["dep1", "dep2"] do |t|
|
23
|
+
sys.touch t.name
|
24
|
+
end
|
25
|
+
|
26
|
+
file "dep1" do |t|
|
27
|
+
sys.touch t.name
|
28
|
+
end
|
29
|
+
|
30
|
+
file "dep2" do |t|
|
31
|
+
sys.touch t.name
|
32
|
+
end
|
33
|
+
|
34
|
+
file "duplicate" do |t|
|
35
|
+
sys.touch t.name
|
36
|
+
sys.touch t.name + "1"
|
37
|
+
end
|
38
|
+
|
39
|
+
file "duplicate" do |t|
|
40
|
+
sys.touch t.name
|
41
|
+
sys.touch t.name + "2"
|
42
|
+
end
|
43
|
+
|
44
|
+
file "fallback" do
|
45
|
+
# doesn't create our target...
|
46
|
+
# so the next task with the same
|
47
|
+
# name should be run
|
48
|
+
sys.touch "fallback_"
|
49
|
+
end
|
50
|
+
|
51
|
+
file "fallback" do |t|
|
52
|
+
sys.touch t.name
|
53
|
+
end
|
54
|
+
|
55
|
+
gen Directory, "dir/subdir"
|
56
|
+
task :path => "dir/subdir"
|
57
|
+
|
58
|
+
gen Directory, "dir/sub2" do |t|
|
59
|
+
# This block should be called after the creation of the directory
|
60
|
+
# `sub2' in `dir'.
|
61
|
+
t.name == "dir/sub2" or t.fail
|
62
|
+
sys.touch "#{t.name}/postprocess"
|
63
|
+
end
|
64
|
+
|
65
|
+
file "tbe" => :dep1 do |t|
|
66
|
+
sys.touch t.name
|
67
|
+
sleep 2
|
68
|
+
end
|
69
|
+
|
70
|
+
enhance :tbe => "dep2" do |t|
|
71
|
+
sys.touch "tbe2"
|
72
|
+
sleep 2
|
73
|
+
end
|
74
|
+
|
75
|
+
# should generate warning because there is no existing task called
|
76
|
+
# "nothing" and create the task "nothing"
|
77
|
+
enhance :nothing
|
78
|
+
|
79
|
+
task :order do |t|
|
80
|
+
sys.touch t.name + "1"
|
81
|
+
sleep 2
|
82
|
+
end
|
83
|
+
|
84
|
+
task :order do |t|
|
85
|
+
sys.touch t.name + "2"
|
86
|
+
sleep 2
|
87
|
+
end
|
88
|
+
|
89
|
+
file "incdep" do |t|
|
90
|
+
sys.touch t.name
|
91
|
+
end
|
92
|
+
|
93
|
+
file "inc" => "incdep" do |t|
|
94
|
+
sys.touch t.name
|
95
|
+
end
|
96
|
+
|
97
|
+
gen LightTask, :lighttask do |t|
|
98
|
+
t.needed do
|
99
|
+
!test ?f, "lt_target"
|
100
|
+
end
|
101
|
+
t.act do
|
102
|
+
sys.touch "lt_target"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
gen Task, :task_one do |t|
|
107
|
+
t.needed do
|
108
|
+
!test ?f, "one_target"
|
109
|
+
end
|
110
|
+
t.act do
|
111
|
+
sys.touch "one_target"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
gen Task, :task_two => :task_one do |t|
|
116
|
+
t.act { print t.name }
|
117
|
+
end
|
118
|
+
|
119
|
+
task :force_clean do
|
120
|
+
sys.rm_f %w(
|
121
|
+
test_touch target dep dep1 dep2 t2
|
122
|
+
duplicate duplicate1 duplicate2
|
123
|
+
fallback fallback_ order1 order2
|
124
|
+
tbe tbe2 inc incdep lt_target one_target
|
125
|
+
).find_all { |e| test(?e, e) }
|
126
|
+
sys.rm_rf %w(dir)
|
127
|
+
end
|
@@ -0,0 +1,203 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rant'
|
4
|
+
require 'tutil'
|
5
|
+
|
6
|
+
# Ensure we run in testproject directory.
|
7
|
+
$testProject1Dir = File.expand_path(File.dirname(__FILE__))
|
8
|
+
|
9
|
+
class TestProject1 < Test::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
Dir.chdir($testProject1Dir) unless Dir.pwd == $testProject1Dir
|
12
|
+
Rant.reset
|
13
|
+
end
|
14
|
+
def teardown
|
15
|
+
capture_std do
|
16
|
+
assert_equal(Rant.run("force_clean"), 0)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
def test_run
|
20
|
+
out, err = capture_std do
|
21
|
+
assert_equal(Rant.run("test_touch"), 0,
|
22
|
+
"Exit code of rant should be 0.")
|
23
|
+
end
|
24
|
+
assert(err =~ /\[WARNING\]/,
|
25
|
+
"rant should print a warning because of enhance on non-existing task")
|
26
|
+
Rant.reset
|
27
|
+
assert(File.exist?("test_touch"),
|
28
|
+
"file test_touch should have been created")
|
29
|
+
capture_std do
|
30
|
+
assert_equal(Rant.run("clean"), 0)
|
31
|
+
end
|
32
|
+
assert(!File.exist?("test_touch"))
|
33
|
+
end
|
34
|
+
def test_timedep
|
35
|
+
capture_std do
|
36
|
+
assert_equal(Rant.run("create_target"), 0)
|
37
|
+
end
|
38
|
+
assert(File.exist?("target"))
|
39
|
+
Rant.reset
|
40
|
+
sleep 2
|
41
|
+
capture_std do
|
42
|
+
assert_equal(Rant.run("create_dep"), 0)
|
43
|
+
end
|
44
|
+
assert(File.exist?("dep"))
|
45
|
+
assert(sys.uptodate?("dep", "target"),
|
46
|
+
"`create_target' was run before `create_dep'")
|
47
|
+
sleep 2
|
48
|
+
capture_std do
|
49
|
+
assert_equal(Rant.run("target"), 0)
|
50
|
+
end
|
51
|
+
assert(File.exist?("target"))
|
52
|
+
assert(File.exist?("dep"))
|
53
|
+
assert(sys.uptodate?("target", "dep"),
|
54
|
+
"`target' should be newer than `dep'")
|
55
|
+
t1 = File.mtime "target"
|
56
|
+
Rant.reset
|
57
|
+
sleep 2
|
58
|
+
capture_std do
|
59
|
+
assert_equal(Rant.run("target"), 0)
|
60
|
+
end
|
61
|
+
assert_equal(t1, File.mtime("target"),
|
62
|
+
"`target' was already up to date")
|
63
|
+
end
|
64
|
+
def test_two_deps
|
65
|
+
capture_std do
|
66
|
+
assert_equal(Rant.run("t2"), 0)
|
67
|
+
end
|
68
|
+
assert(File.exist?("t2"),
|
69
|
+
"file `t2' should have been built")
|
70
|
+
assert(File.exist?("dep1"),
|
71
|
+
"dependancy `dep1' should have been built")
|
72
|
+
assert(File.exist?("dep2"),
|
73
|
+
"depandancy `dep2' should have been build")
|
74
|
+
end
|
75
|
+
def test_duplicate
|
76
|
+
capture_std do
|
77
|
+
assert_equal(Rant.run("duplicate"), 0)
|
78
|
+
end
|
79
|
+
assert(File.exist?("duplicate"))
|
80
|
+
assert(File.exist?("duplicate1"),
|
81
|
+
"duplicate1 should have been created as side effect " +
|
82
|
+
"of running first task to build duplicate")
|
83
|
+
assert(!File.exist?("duplicate2"),
|
84
|
+
"the second task to build duplicate should have " +
|
85
|
+
"been run, duplicate was already built")
|
86
|
+
end
|
87
|
+
def test_fallback
|
88
|
+
capture_std do
|
89
|
+
assert_equal(Rant.run("fallback"), 0)
|
90
|
+
end
|
91
|
+
assert(File.exist?("fallback_"),
|
92
|
+
"should have been created as side-effect by fallback")
|
93
|
+
assert(File.exist?("fallback"),
|
94
|
+
"second task for `fallback' should have been run")
|
95
|
+
end
|
96
|
+
def test_directory
|
97
|
+
capture_std do
|
98
|
+
assert_equal(Rant.run("path"), 0)
|
99
|
+
end
|
100
|
+
assert(test(?d, "dir"),
|
101
|
+
"dir should have been created as prerequisite of dir/subdir")
|
102
|
+
assert(test(?d, "dir/subdir"),
|
103
|
+
"dir/subdir should have been created as prerequisite of path")
|
104
|
+
end
|
105
|
+
def test_directory_postprocess
|
106
|
+
capture_std do
|
107
|
+
assert_equal(Rant.run("dir/sub2"), 0)
|
108
|
+
end
|
109
|
+
assert(test(?d, "dir/sub2"),
|
110
|
+
"dir/sub2 should have been created by directory task")
|
111
|
+
assert(test(?f, "dir/sub2/postprocess"),
|
112
|
+
"dir/sub2/postprocess should have been created by block supplied to directory task")
|
113
|
+
end
|
114
|
+
def test_directory_postprocess_2
|
115
|
+
capture_std do
|
116
|
+
assert_equal(Rant.run("dir/subdir"), 0)
|
117
|
+
end
|
118
|
+
assert(test(?d, "dir/subdir"))
|
119
|
+
assert(!File.exist?("dir/sub2"))
|
120
|
+
capture_std do
|
121
|
+
assert_equal(Rant.run("dir/sub2"), 0)
|
122
|
+
end
|
123
|
+
assert(test(?f, "dir/sub2/postprocess"),
|
124
|
+
"dir/sub2/postprocess should have been created by block supplied to directory task")
|
125
|
+
end
|
126
|
+
def test_order
|
127
|
+
capture_std do
|
128
|
+
assert_equal(Rant.run("order"), 0)
|
129
|
+
end
|
130
|
+
assert(File.exist?("order1"))
|
131
|
+
assert(File.exist?("order2"))
|
132
|
+
assert(File.mtime("order1") < File.mtime("order2"),
|
133
|
+
"tasks from same file should be run in definition order")
|
134
|
+
end
|
135
|
+
def test_enhance
|
136
|
+
capture_std do
|
137
|
+
assert_equal(Rant.run("tbe"), 0)
|
138
|
+
end
|
139
|
+
assert(File.exist?("dep1"))
|
140
|
+
assert(File.exist?("dep2"),
|
141
|
+
"dep2 was added as prerequisite to tbe by enhance")
|
142
|
+
assert(File.exist?("tbe"))
|
143
|
+
assert(File.exist?("tbe2"),
|
144
|
+
"tbe2 should be created by enhance for tbe")
|
145
|
+
assert(test(?<, "tbe", "tbe2"),
|
146
|
+
"block added by enhance should run after \"normal\" block")
|
147
|
+
end
|
148
|
+
def test_enhance_nothing
|
149
|
+
capture_std do
|
150
|
+
assert_equal(Rant.run("nothing"), 0,
|
151
|
+
"enhance should create new task if no task with given name exists")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
def test_incremental_build
|
155
|
+
capture_std do
|
156
|
+
assert_equal(Rant.run("inc"), 0)
|
157
|
+
end
|
158
|
+
assert(test(?f, "inc"))
|
159
|
+
assert(test(?f, "incdep"))
|
160
|
+
old_mtime = test(?M, "incdep")
|
161
|
+
sleep 2
|
162
|
+
capture_std do
|
163
|
+
assert_equal(Rant.run(%w(--force-run incdep)), 0,
|
164
|
+
"--force-run should unconditionally run `incdep'")
|
165
|
+
end
|
166
|
+
assert(old_mtime < test(?M, "incdep"),
|
167
|
+
"incdep should have been updated by a forced run")
|
168
|
+
capture_std do
|
169
|
+
assert_equal(Rant.run("inc"), 0)
|
170
|
+
end
|
171
|
+
assert(old_mtime < test(?M, "inc"),
|
172
|
+
"dependency `incdep' is newer, so `inc' should get rebuilt")
|
173
|
+
end
|
174
|
+
def test_lighttask
|
175
|
+
capture_std do
|
176
|
+
assert_equal(Rant.run("lighttask"), 0)
|
177
|
+
end
|
178
|
+
assert(test(?e, "lt_target"),
|
179
|
+
"lt_target should get `touched' by lighttask")
|
180
|
+
end
|
181
|
+
def test_task_gen_one_arg
|
182
|
+
capture_std do
|
183
|
+
assert_equal(Rant.run("task_one"), 0)
|
184
|
+
end
|
185
|
+
assert(test(?e, "one_target"),
|
186
|
+
"one_target should get `touched' by task_one")
|
187
|
+
old_mtime = test(?M, "one_target")
|
188
|
+
sleep 2
|
189
|
+
capture_std do
|
190
|
+
assert_equal(Rant.run("task_one"), 0)
|
191
|
+
end
|
192
|
+
assert_equal(test(?M, "one_target"), old_mtime)
|
193
|
+
end
|
194
|
+
def test_task_gen_with_pre
|
195
|
+
out, err = capture_std do
|
196
|
+
assert_equal(0, Rant.run("task_two"))
|
197
|
+
end
|
198
|
+
assert(test(?e, "one_target"),
|
199
|
+
"one_target should be created as prerequisite of task_two")
|
200
|
+
assert_match(/task_two$/, out,
|
201
|
+
"task_two action prints task name")
|
202
|
+
end
|
203
|
+
end
|