rant 0.3.6 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +13 -0
- data/README +7 -1
- data/Rantfile +10 -14
- data/TODO +3 -0
- data/devel-notes +5 -0
- data/doc/advanced.rdoc +46 -0
- data/doc/c.rdoc +64 -0
- data/doc/examples/c_dependencies/Rantfile +27 -0
- data/doc/examples/c_dependencies/include/hello.h +7 -0
- data/doc/examples/c_dependencies/include/util.h +7 -0
- data/doc/examples/c_dependencies/src/main.c +9 -0
- data/doc/examples/c_dependencies/src/util.c +9 -0
- data/doc/examples/directedrule/Rantfile +0 -1
- data/doc/rantfile.rdoc +12 -9
- data/doc/rubyproject.rdoc +26 -0
- data/lib/rant/c/include.rb +51 -0
- data/lib/rant/import/autoclean.rb +16 -9
- data/lib/rant/import/c/dependencies.rb +127 -0
- data/lib/rant/import/directedrule.rb +8 -4
- data/lib/rant/import/rubypackage.rb +2 -1
- data/lib/rant/import/subfile.rb +41 -0
- data/lib/rant/import/truth.rb +6 -1
- data/lib/rant/import/win32/rubycmdwrapper.rb +37 -0
- data/lib/rant/import.rb +26 -3
- data/lib/rant/rantenv.rb +0 -32
- data/lib/rant/rantfile.rb +207 -194
- data/lib/rant/rantlib.rb +83 -150
- data/lib/rant/rantsys.rb +7 -10
- data/lib/rant/rantvar.rb +4 -6
- data/lib/rant.rb +57 -0
- data/rantmethods.rb +1 -47
- data/setup.rb +2 -2
- data/test/Rantfile +6 -1
- data/test/c/source.c +23 -0
- data/test/c/test_parse_includes.rb +41 -0
- data/test/import/c/dependencies/Rantfile +34 -0
- data/test/import/c/dependencies/bar.h +2 -0
- data/test/import/c/dependencies/foo.h +5 -0
- data/test/import/c/dependencies/hello.c +7 -0
- data/test/import/c/dependencies/include/foo.h +0 -0
- data/test/import/c/dependencies/include/sub/sub.h +8 -0
- data/test/import/c/dependencies/include/with space.h +7 -0
- data/test/import/c/dependencies/src/abc +5 -0
- data/test/import/c/dependencies/src/abc.c +5 -0
- data/test/import/c/dependencies/src/bar.c +11 -0
- data/test/import/c/dependencies/test_c_dependencies.rb +92 -0
- data/test/import/c/dependencies/test_on_the_fly.rb +44 -0
- data/test/import/directedrule/Rantfile +7 -2
- data/test/import/directedrule/test_directedrule.rb +6 -0
- data/test/import/subfile/Rantfile +28 -0
- data/test/import/subfile/autoclean.rf +16 -0
- data/test/import/subfile/test_subfile.rb +91 -0
- data/test/import/truth/Rantfile +7 -0
- data/test/import/truth/test_truth.rb +3 -0
- data/test/project2/buildfile +2 -0
- data/test/project2/test_project.rb +5 -3
- data/test/rant-import/Rantfile +4 -0
- data/test/rant-import/test_rant-import.rb +104 -1
- data/test/rule.rf +6 -0
- data/test/test_autosubfiletask.rb +59 -0
- data/test/test_clean.rb +48 -5
- data/test/test_dirtask.rb +45 -1
- data/test/test_examples.rb +25 -3
- data/test/test_filelist.rb +14 -2
- data/test/test_lighttask.rb +4 -6
- data/test/test_rant_interface.rb +8 -8
- data/test/test_rantfile_api.rb +37 -1
- data/test/test_rule.rb +6 -3
- data/test/test_source.rb +28 -1
- data/test/test_sourcenode.rb +163 -0
- data/test/test_task.rb +2 -2
- data/test/test_var.rb +3 -3
- data/test/tutil.rb +23 -2
- metadata +45 -3
- data/test/test_metatask.rb +0 -29
@@ -0,0 +1,163 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$testDir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestSourceNode < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
# Ensure we run in test directory.
|
10
|
+
Dir.chdir $testDir
|
11
|
+
end
|
12
|
+
def teardown
|
13
|
+
Dir.chdir $testDir
|
14
|
+
FileUtils.rm_rf Dir["*.t"]
|
15
|
+
end
|
16
|
+
def tmp_rf(content = @rf, fn = "rf.t")
|
17
|
+
open(fn, "w") { |f| f.write content }
|
18
|
+
yield
|
19
|
+
ensure
|
20
|
+
FileUtils.rm_f fn
|
21
|
+
end
|
22
|
+
def test_invoke
|
23
|
+
@rf = <<-EOF
|
24
|
+
gen SourceNode, "a.t"
|
25
|
+
EOF
|
26
|
+
tmp_rf do
|
27
|
+
out, err = assert_rant("-frf.t")
|
28
|
+
assert(!test(?f, "a.t"))
|
29
|
+
assert(out.strip.empty?)
|
30
|
+
assert(err.strip.empty?)
|
31
|
+
end
|
32
|
+
tmp_rf do
|
33
|
+
out, err = assert_rant("-frf.t", "a.t")
|
34
|
+
assert(out.strip.empty?)
|
35
|
+
assert(err.strip.empty?)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
def test_deps_empty_array
|
39
|
+
@rf = <<-EOF
|
40
|
+
gen SourceNode, "a.t" => []
|
41
|
+
EOF
|
42
|
+
tmp_rf do
|
43
|
+
assert_rant("-frf.t")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
def test_with_deps
|
47
|
+
@rf = <<-EOF
|
48
|
+
gen SourceNode, "a.t" => %w(b.t c.t)
|
49
|
+
EOF
|
50
|
+
tmp_rf do
|
51
|
+
assert_rant("-frf.t")
|
52
|
+
end
|
53
|
+
tmp_rf do
|
54
|
+
assert_rant(:fail, "-frf.t", "b.t")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
def test_as_dependency
|
58
|
+
@rf = <<-EOF
|
59
|
+
file "a.t" => "b.t" do |t|
|
60
|
+
sys.touch t.name
|
61
|
+
end
|
62
|
+
gen SourceNode, "b.t" => "c.t"
|
63
|
+
EOF
|
64
|
+
tmp_rf do
|
65
|
+
out, err = assert_rant(:fail, "-frf.t")
|
66
|
+
assert(out.strip.empty?)
|
67
|
+
assert_match(/\[ERROR\].*no such file.*b\.t/m, err)
|
68
|
+
end
|
69
|
+
assert(!test(?e, "a.t"))
|
70
|
+
FileUtils.touch "b.t"
|
71
|
+
tmp_rf do
|
72
|
+
out, err = assert_rant(:fail, "-frf.t")
|
73
|
+
assert(out.strip.empty?)
|
74
|
+
assert_match(/\[ERROR\].*no such file.*c\.t/m, err)
|
75
|
+
end
|
76
|
+
assert(!test(?e, "a.t"))
|
77
|
+
FileUtils.touch "c.t"
|
78
|
+
tmp_rf do
|
79
|
+
out, err = assert_rant("-frf.t")
|
80
|
+
end
|
81
|
+
assert(test(?f, "a.t"))
|
82
|
+
end
|
83
|
+
def test_timestamps
|
84
|
+
@rf = <<-EOF
|
85
|
+
file "a.t" => "b.t" do |t|
|
86
|
+
sys.touch t.name
|
87
|
+
end
|
88
|
+
gen SourceNode, "b.t" => %w(c.t d.t)
|
89
|
+
EOF
|
90
|
+
FileUtils.touch %w(b.t c.t d.t)
|
91
|
+
tmp_rf do
|
92
|
+
assert_rant("-frf.t")
|
93
|
+
assert(test(?f, "a.t"))
|
94
|
+
out, err = assert_rant("-frf.t")
|
95
|
+
assert(out.strip.empty?,
|
96
|
+
"no source changed, no update required")
|
97
|
+
old_mtime = File.mtime "a.t"
|
98
|
+
timeout
|
99
|
+
FileUtils.touch "b.t"
|
100
|
+
assert_rant("-frf.t")
|
101
|
+
assert(File.mtime("a.t") > old_mtime)
|
102
|
+
old_mtime = File.mtime "a.t"
|
103
|
+
timeout
|
104
|
+
FileUtils.touch "c.t"
|
105
|
+
assert_rant("-frf.t")
|
106
|
+
assert(File.mtime("a.t") > old_mtime)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
def test_with_block
|
110
|
+
@rf = <<-EOF
|
111
|
+
gen SourceNode, "a.t" do end
|
112
|
+
EOF
|
113
|
+
tmp_rf do
|
114
|
+
out, err = assert_rant(:fail, "-frf.t")
|
115
|
+
assert_match(/\[ERROR\].*SourceNode.*block/m, err)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
def test_with_autoclean
|
119
|
+
@rf = <<-EOF
|
120
|
+
import "autoclean"
|
121
|
+
gen SourceNode, "a.t" => %w(b.t c.t)
|
122
|
+
gen AutoClean
|
123
|
+
EOF
|
124
|
+
tmp_rf do
|
125
|
+
assert_rant("-frf.t", "autoclean")
|
126
|
+
FileUtils.touch %w(a.t b.t c.t)
|
127
|
+
assert_rant("-frf.t", "autoclean")
|
128
|
+
assert(test(?f, "a.t"))
|
129
|
+
assert(test(?f, "b.t"))
|
130
|
+
assert(test(?f, "c.t"))
|
131
|
+
end
|
132
|
+
end
|
133
|
+
def test_sourcenode_depends_on_sourcenode
|
134
|
+
@rf = <<-EOF
|
135
|
+
file "a.t" => "b.t" do |t|
|
136
|
+
sys.touch t.name
|
137
|
+
end
|
138
|
+
gen SourceNode, "b.t" => %w(c.t d.t)
|
139
|
+
gen SourceNode, "d.t" => "e.t"
|
140
|
+
EOF
|
141
|
+
FileUtils.touch %w(b.t c.t d.t e.t)
|
142
|
+
tmp_rf do
|
143
|
+
assert_rant("-frf.t")
|
144
|
+
assert(test(?f, "a.t"))
|
145
|
+
timeout
|
146
|
+
FileUtils.touch "e.t"
|
147
|
+
old_mtime = File.mtime "a.t"
|
148
|
+
assert_rant("-frf.t")
|
149
|
+
assert(File.mtime("a.t") > old_mtime)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
def test_circular_dep
|
153
|
+
@rf = <<-EOF
|
154
|
+
gen SourceNode, "a.t" => "b.t"
|
155
|
+
gen SourceNode, "b.t" => "a.t"
|
156
|
+
EOF
|
157
|
+
FileUtils.touch %w(a.t b.t)
|
158
|
+
tmp_rf do
|
159
|
+
th = Thread.new{ assert_rant("-frf.t") }
|
160
|
+
assert_equal(th, th.join(0.5))
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
data/test/test_task.rb
CHANGED
@@ -45,7 +45,7 @@ class TestTask < Test::Unit::TestCase
|
|
45
45
|
assert(task.invoked?, "although task failed, it was invoked")
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
48
|
+
def test_dependent
|
49
49
|
r1 = r2 = false
|
50
50
|
t1 = Rant::Task.new(nil, :t1) { r1 = true }
|
51
51
|
t2 = Rant::Task.new(nil, :t2) { r2 = true }
|
@@ -59,7 +59,7 @@ class TestTask < Test::Unit::TestCase
|
|
59
59
|
assert(!t2.needed?)
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def test_dependency_fails
|
63
63
|
t1 = Rant::Task.new(nil, :t1) { true }
|
64
64
|
t2 = Rant::Task.new(nil, :t2) { |t| t.fail }
|
65
65
|
t1 << t2
|
data/test/test_var.rb
CHANGED
@@ -85,7 +85,7 @@ class TestVar < Test::Unit::TestCase
|
|
85
85
|
assert(test(?f, "default_1.t"))
|
86
86
|
assert(test(?f, "default_2.t"))
|
87
87
|
capture_std do
|
88
|
-
assert_equal(0, Rant::RantApp.new(%w(-fvar.rf clean))
|
88
|
+
assert_equal(0, Rant::RantApp.new.run(%w(-fvar.rf clean)))
|
89
89
|
end
|
90
90
|
end
|
91
91
|
def test_override
|
@@ -96,7 +96,7 @@ class TestVar < Test::Unit::TestCase
|
|
96
96
|
assert(test(?f, "val1.t"))
|
97
97
|
assert(test(?f, "default_2.t"))
|
98
98
|
capture_std do
|
99
|
-
assert_equal(0, Rant::RantApp.new(%w(-fvar.rf clean))
|
99
|
+
assert_equal(0, Rant::RantApp.new.run(%w(-fvar.rf clean)))
|
100
100
|
end
|
101
101
|
end
|
102
102
|
def test_is_string
|
@@ -273,6 +273,6 @@ class TestVar < Test::Unit::TestCase
|
|
273
273
|
assert_match(
|
274
274
|
/source_err\.rf\.t.+2.*\n.*11.+constraint.+integer/i, err)
|
275
275
|
ensure
|
276
|
-
assert_equal(0, Rant::RantApp.new("-fvar.rf", "clean", "-q")
|
276
|
+
assert_equal(0, Rant::RantApp.new.run("-fvar.rf", "clean", "-q"))
|
277
277
|
end
|
278
278
|
end
|
data/test/tutil.rb
CHANGED
@@ -8,8 +8,29 @@ module Test
|
|
8
8
|
module Unit
|
9
9
|
class TestCase
|
10
10
|
def assert_rant(*args)
|
11
|
-
|
12
|
-
|
11
|
+
res = 0
|
12
|
+
capture = true
|
13
|
+
args.flatten!
|
14
|
+
args.reject! { |arg|
|
15
|
+
if Symbol === arg
|
16
|
+
case arg
|
17
|
+
when :fail: res = 1
|
18
|
+
when :v: capture = false
|
19
|
+
when :verbose: capture = false
|
20
|
+
else
|
21
|
+
raise "No such option -- #{arg}"
|
22
|
+
end
|
23
|
+
true
|
24
|
+
else
|
25
|
+
false
|
26
|
+
end
|
27
|
+
}
|
28
|
+
if capture
|
29
|
+
capture_std do
|
30
|
+
assert_equal(res, ::Rant::RantApp.new.run(*args))
|
31
|
+
end
|
32
|
+
else
|
33
|
+
assert_equal(res, ::Rant::RantApp.new.run(*args))
|
13
34
|
end
|
14
35
|
end
|
15
36
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rant
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2005-05-
|
6
|
+
version: 0.3.8
|
7
|
+
date: 2005-05-15
|
8
8
|
summary: Rant is a Ruby based build tool.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- bin/rant-import
|
45
45
|
- lib/rant
|
46
46
|
- lib/rant.rb
|
47
|
+
- lib/rant/c
|
47
48
|
- lib/rant/rantfile.rb
|
48
49
|
- lib/rant/rantenv.rb
|
49
50
|
- lib/rant/cs_compiler.rb
|
@@ -54,32 +55,40 @@ files:
|
|
54
55
|
- lib/rant/plugin_methods.rb
|
55
56
|
- lib/rant/plugin
|
56
57
|
- lib/rant/import.rb
|
58
|
+
- lib/rant/c/include.rb
|
59
|
+
- lib/rant/import/c
|
57
60
|
- lib/rant/import/directedrule.rb
|
61
|
+
- lib/rant/import/win32
|
58
62
|
- lib/rant/import/truth.rb
|
59
63
|
- lib/rant/import/rubydoc.rb
|
60
64
|
- lib/rant/import/rubytest.rb
|
61
65
|
- lib/rant/import/rubypackage.rb
|
66
|
+
- lib/rant/import/subfile.rb
|
62
67
|
- lib/rant/import/package.rb
|
63
68
|
- lib/rant/import/clean.rb
|
64
69
|
- lib/rant/import/autoclean.rb
|
70
|
+
- lib/rant/import/c/dependencies.rb
|
71
|
+
- lib/rant/import/win32/rubycmdwrapper.rb
|
65
72
|
- lib/rant/plugin/README
|
66
73
|
- lib/rant/plugin/configure.rb
|
67
74
|
- lib/rant/plugin/csharp.rb
|
75
|
+
- test/c
|
68
76
|
- test/test_filetask.rb
|
69
77
|
- test/test_lighttask.rb
|
70
78
|
- test/test_examples.rb
|
71
79
|
- test/Rantfile
|
72
80
|
- test/ts_all.rb
|
73
81
|
- test/test_rule.rb
|
82
|
+
- test/test_sourcenode.rb
|
74
83
|
- test/test_task.rb
|
75
84
|
- test/project_rb1
|
76
85
|
- test/rule.rf
|
77
86
|
- test/subdirs
|
78
|
-
- test/test_metatask.rb
|
79
87
|
- test/test_rantfile_api.rb
|
80
88
|
- test/test_env.rb
|
81
89
|
- test/toplevel.rf
|
82
90
|
- test/test_source.rb
|
91
|
+
- test/test_autosubfiletask.rb
|
83
92
|
- test/import
|
84
93
|
- test/plugin
|
85
94
|
- test/test_rac.rb
|
@@ -95,6 +104,8 @@ files:
|
|
95
104
|
- test/test_clean.rb
|
96
105
|
- test/test_filelist.rb
|
97
106
|
- test/standalone.rf
|
107
|
+
- test/c/source.c
|
108
|
+
- test/c/test_parse_includes.rb
|
98
109
|
- test/project_rb1/bin
|
99
110
|
- test/project_rb1/lib
|
100
111
|
- test/project_rb1/test
|
@@ -113,10 +124,31 @@ files:
|
|
113
124
|
- test/subdirs/sub2/sub
|
114
125
|
- test/subdirs/sub2/rantfile.rb
|
115
126
|
- test/subdirs/sub2/sub/rantfile
|
127
|
+
- test/import/c
|
116
128
|
- test/import/truth
|
129
|
+
- test/import/subfile
|
117
130
|
- test/import/directedrule
|
131
|
+
- test/import/c/dependencies
|
132
|
+
- test/import/c/dependencies/src
|
133
|
+
- test/import/c/dependencies/bar.h
|
134
|
+
- test/import/c/dependencies/foo.h
|
135
|
+
- test/import/c/dependencies/Rantfile
|
136
|
+
- test/import/c/dependencies/test_on_the_fly.rb
|
137
|
+
- test/import/c/dependencies/test_c_dependencies.rb
|
138
|
+
- test/import/c/dependencies/hello.c
|
139
|
+
- test/import/c/dependencies/include
|
140
|
+
- test/import/c/dependencies/src/abc
|
141
|
+
- test/import/c/dependencies/src/abc.c
|
142
|
+
- test/import/c/dependencies/src/bar.c
|
143
|
+
- test/import/c/dependencies/include/sub
|
144
|
+
- test/import/c/dependencies/include/foo.h
|
145
|
+
- test/import/c/dependencies/include/with space.h
|
146
|
+
- test/import/c/dependencies/include/sub/sub.h
|
118
147
|
- test/import/truth/Rantfile
|
119
148
|
- test/import/truth/test_truth.rb
|
149
|
+
- test/import/subfile/Rantfile
|
150
|
+
- test/import/subfile/test_subfile.rb
|
151
|
+
- test/import/subfile/autoclean.rf
|
120
152
|
- test/import/directedrule/Rantfile
|
121
153
|
- test/import/directedrule/test_directedrule.rb
|
122
154
|
- test/plugin/configure
|
@@ -145,6 +177,7 @@ files:
|
|
145
177
|
- doc/configure.rdoc
|
146
178
|
- doc/advanced.rdoc
|
147
179
|
- doc/rubyproject.rdoc
|
180
|
+
- doc/c.rdoc
|
148
181
|
- doc/rant.rdoc
|
149
182
|
- doc/jamis.rb
|
150
183
|
- doc/csharp.rdoc
|
@@ -152,6 +185,7 @@ files:
|
|
152
185
|
- doc/examples
|
153
186
|
- doc/examples/directedrule
|
154
187
|
- doc/examples/myprog
|
188
|
+
- doc/examples/c_dependencies
|
155
189
|
- doc/examples/directedrule/src_a
|
156
190
|
- doc/examples/directedrule/src_b
|
157
191
|
- doc/examples/directedrule/Rantfile
|
@@ -165,6 +199,13 @@ files:
|
|
165
199
|
- doc/examples/myprog/src/lib.h
|
166
200
|
- doc/examples/myprog/src/Rantfile
|
167
201
|
- doc/examples/myprog/src/main.c
|
202
|
+
- doc/examples/c_dependencies/src
|
203
|
+
- doc/examples/c_dependencies/Rantfile
|
204
|
+
- doc/examples/c_dependencies/include
|
205
|
+
- doc/examples/c_dependencies/src/main.c
|
206
|
+
- doc/examples/c_dependencies/src/util.c
|
207
|
+
- doc/examples/c_dependencies/include/hello.h
|
208
|
+
- doc/examples/c_dependencies/include/util.h
|
168
209
|
test_files: []
|
169
210
|
rdoc_options:
|
170
211
|
- "-S"
|
@@ -179,6 +220,7 @@ extra_rdoc_files:
|
|
179
220
|
- doc/configure.rdoc
|
180
221
|
- doc/advanced.rdoc
|
181
222
|
- doc/rubyproject.rdoc
|
223
|
+
- doc/c.rdoc
|
182
224
|
- doc/rant.rdoc
|
183
225
|
- doc/csharp.rdoc
|
184
226
|
- doc/rant-import.rdoc
|
data/test/test_metatask.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'test/unit'
|
3
|
-
require 'rant/rantlib'
|
4
|
-
require 'tutil'
|
5
|
-
|
6
|
-
class TestMetaTask < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@app = Rant::RantApp.new %w()
|
9
|
-
end
|
10
|
-
def teardown
|
11
|
-
end
|
12
|
-
def test_with_single_task
|
13
|
-
run = false
|
14
|
-
t = @app.task :t do run = true end
|
15
|
-
mt = Rant::MetaTask.for_task t
|
16
|
-
assert_equal(t.name, mt.name,
|
17
|
-
"MetaTask should have name of contained task(s).")
|
18
|
-
if t.needed?
|
19
|
-
assert(mt.needed?,
|
20
|
-
"MetaTask should be needed? if only contained task is needed?")
|
21
|
-
mt.invoke
|
22
|
-
assert(run,
|
23
|
-
"only contained task was needed?, so it should get invoked")
|
24
|
-
else
|
25
|
-
assert(!mt.needed?,
|
26
|
-
"MetaTask should return false from needed? because the only contained task does also.")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|