rant 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
data/rantmethods.rb
CHANGED
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
desc "Print constants introduced by Rant."
|
16
16
|
task :constants do
|
17
|
-
puts
|
17
|
+
puts((self.class.constants - Object.constants).sort)
|
18
18
|
end
|
19
19
|
|
20
20
|
desc "Print all attribute writers of a Gem::Specification."
|
@@ -82,49 +82,3 @@ file "bench-depsearch" do |t|
|
|
82
82
|
EOT
|
83
83
|
}
|
84
84
|
end
|
85
|
-
|
86
|
-
=begin
|
87
|
-
class TraceObject < Object
|
88
|
-
ml = public_instance_methods + protected_instance_methods + private_instance_methods
|
89
|
-
ml.each { |m|
|
90
|
-
eval <<-EOM
|
91
|
-
def #{m}(*args)
|
92
|
-
print "TraceObject##{m}("
|
93
|
-
print args.join(", ")
|
94
|
-
print ")"
|
95
|
-
puts(block_given? ? " block_given" : "")
|
96
|
-
super
|
97
|
-
end
|
98
|
-
EOM
|
99
|
-
}
|
100
|
-
end
|
101
|
-
=end
|
102
|
-
|
103
|
-
class TraceArray < Array
|
104
|
-
ml = public_instance_methods + protected_instance_methods + private_instance_methods
|
105
|
-
ml.delete "print"
|
106
|
-
ml.delete "block_given?"
|
107
|
-
ml.delete "puts"
|
108
|
-
ml.each { |m|
|
109
|
-
eval <<-EOM
|
110
|
-
def #{m}(*args)
|
111
|
-
print "TraceArray##{m}("
|
112
|
-
print args.join(", ")
|
113
|
-
print ")"
|
114
|
-
puts(block_given? ? " block_given" : "")
|
115
|
-
super
|
116
|
-
end
|
117
|
-
EOM
|
118
|
-
}
|
119
|
-
end
|
120
|
-
|
121
|
-
# list the methods that are sent to an object that is in an array
|
122
|
-
# which is flattened.
|
123
|
-
#task :flatten do
|
124
|
-
# to = TraceObject.new
|
125
|
-
#[to].flatten
|
126
|
-
#end
|
127
|
-
|
128
|
-
task :flatten_ary do
|
129
|
-
[TraceArray.new].flatten
|
130
|
-
end
|
data/setup.rb
CHANGED
@@ -1143,11 +1143,11 @@ class Installer
|
|
1143
1143
|
begin
|
1144
1144
|
File.open(path, 'rb') {|r|
|
1145
1145
|
first = r.gets
|
1146
|
-
return unless File.basename(config('rubypath'))
|
1146
|
+
return unless File.basename(config('rubypath')) =~ /ruby/
|
1147
1147
|
### stefan ###
|
1148
1148
|
# Add <tt>|| ""</tt> which avoids an ArgumentError if first
|
1149
1149
|
# line doesn't match the regexp.
|
1150
|
-
return unless File.basename(first.sub(/\A\#!/, '').split[0] || "") == 'ruby'
|
1150
|
+
return unless File.basename((first||"").sub(/\A\#!/, '').split[0] || "") == 'ruby'
|
1151
1151
|
$stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
|
1152
1152
|
File.open(tmpfile, 'wb') {|w|
|
1153
1153
|
w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
|
data/test/Rantfile
CHANGED
@@ -23,10 +23,12 @@ gen Action do
|
|
23
23
|
rac.build "version.t"
|
24
24
|
end
|
25
25
|
|
26
|
-
source "auto.rf"
|
26
|
+
auto_t_task = source "auto.rf"
|
27
|
+
rac.abort unless auto_t_task.name == "auto.t"
|
27
28
|
|
28
29
|
task :clean do
|
29
30
|
sys.rm_f %w(auto.t auto.rf version.t)
|
31
|
+
sys.rm_rf %w(basedir.t)
|
30
32
|
end
|
31
33
|
|
32
34
|
gen Directory, "tmp.t"
|
@@ -49,4 +51,7 @@ task :build_test_t do |t|
|
|
49
51
|
test(?d, "tmp.t") or t.fail
|
50
52
|
end
|
51
53
|
|
54
|
+
desc "Make some path (basedir.t/a/b)."
|
55
|
+
gen Directory, "basedir.t", "a/b"
|
56
|
+
|
52
57
|
# vim: ft=ruby
|
data/test/c/source.c
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
#include <stdio.h>
|
3
|
+
#include "util.h"
|
4
|
+
|
5
|
+
/*
|
6
|
+
* some comment
|
7
|
+
*/
|
8
|
+
#include "mylib.h"
|
9
|
+
|
10
|
+
/*
|
11
|
+
#include "xy"
|
12
|
+
*/
|
13
|
+
|
14
|
+
//
|
15
|
+
# include <file.h>
|
16
|
+
#include "custom" // custom header
|
17
|
+
|
18
|
+
# // include "abc"
|
19
|
+
|
20
|
+
#include \
|
21
|
+
"custom2.h"
|
22
|
+
|
23
|
+
#include <std>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require 'tutil'
|
3
|
+
require 'rant/c/include'
|
4
|
+
|
5
|
+
$testCDir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestCParseIncludes < Test::Unit::TestCase
|
8
|
+
C = Rant::C
|
9
|
+
def setup
|
10
|
+
Dir.chdir($testCDir)
|
11
|
+
end
|
12
|
+
def test_parse_source
|
13
|
+
src = File.read "source.c"
|
14
|
+
sc, lc = C::Include.parse_includes(src)
|
15
|
+
assert_equal(%w(stdio.h file.h std), sc)
|
16
|
+
assert_equal(
|
17
|
+
%w(util.h mylib.h custom custom2.h), lc)
|
18
|
+
end
|
19
|
+
def test_parse_empty
|
20
|
+
sc, lc = C::Include.parse_includes("")
|
21
|
+
assert(sc.empty?)
|
22
|
+
assert(lc.empty?)
|
23
|
+
end
|
24
|
+
def test_parse_nil
|
25
|
+
assert_raises(ArgumentError) {
|
26
|
+
C::Include.parse_includes(nil)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
def test_accepts_to_str
|
30
|
+
obj = Object.new
|
31
|
+
def obj.to_str
|
32
|
+
"//"
|
33
|
+
end
|
34
|
+
lc, sc = nil, nil
|
35
|
+
assert_nothing_raised {
|
36
|
+
sc, lc = C::Include.parse_includes(obj)
|
37
|
+
}
|
38
|
+
assert(sc.empty?)
|
39
|
+
assert(lc.empty?)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
import "c/dependencies", "autoclean"
|
3
|
+
|
4
|
+
var :deps, 1..3
|
5
|
+
|
6
|
+
file "a.t" => sys["**/*.{c,cpp}"] do |t|
|
7
|
+
sys.touch t.name
|
8
|
+
end
|
9
|
+
|
10
|
+
file "hello.t" => "hello.c" do |t|
|
11
|
+
sys.touch t.name
|
12
|
+
end
|
13
|
+
|
14
|
+
file "bar.t" => "src/bar.c" do |t|
|
15
|
+
sys.touch t.name
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Create C source dependency file."
|
19
|
+
gen C::Dependencies
|
20
|
+
|
21
|
+
gen C::Dependencies, "deps2.t", :search => [".", "include"]
|
22
|
+
gen C::Dependencies, "deps3.t", :search => [".", "include", "src"]
|
23
|
+
|
24
|
+
gen Action do
|
25
|
+
source case var[:deps]
|
26
|
+
when 2: "deps2.t"
|
27
|
+
when 3: "deps3.t"
|
28
|
+
else "c_dependencies"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
gen AutoClean
|
33
|
+
|
34
|
+
# vim:ft=ruby
|
File without changes
|
@@ -0,0 +1,92 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$testImportCDepDir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestImportCDependencies < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
# Ensure we run in test directory.
|
10
|
+
Dir.chdir $testImportCDepDir
|
11
|
+
@manifest = %w(
|
12
|
+
test_c_dependencies.rb Rantfile hello.c foo.h bar.h
|
13
|
+
include include/foo.h include/sub include/sub/sub.h
|
14
|
+
src src/abc src/abc.c src/bar.c
|
15
|
+
)
|
16
|
+
@manifest << "include/with space.h"
|
17
|
+
end
|
18
|
+
def teardown
|
19
|
+
Dir.chdir $testImportCDepDir
|
20
|
+
FileUtils.rm_f "c_dependencies"
|
21
|
+
FileUtils.rm_rf Dir["*.t"]
|
22
|
+
@manifest.each { |f|
|
23
|
+
assert(test(?e, f), "#{f} missing")
|
24
|
+
}
|
25
|
+
end
|
26
|
+
def test_hello_c
|
27
|
+
assert_rant("hello.t")
|
28
|
+
assert(test(?f, "hello.t"))
|
29
|
+
assert(test(?f, "c_dependencies"))
|
30
|
+
out, err = assert_rant("hello.t")
|
31
|
+
assert(out.strip.empty?)
|
32
|
+
assert(err.strip.empty?)
|
33
|
+
timeout
|
34
|
+
FileUtils.touch "foo.h"
|
35
|
+
old_mtime = File.mtime "hello.t"
|
36
|
+
assert_rant("hello.t")
|
37
|
+
assert(File.mtime("hello.t") > old_mtime)
|
38
|
+
old_mtime = File.mtime("hello.t")
|
39
|
+
timeout
|
40
|
+
out, err = assert_rant("hello.t")
|
41
|
+
assert(out.strip.empty?)
|
42
|
+
assert(err.strip.empty?)
|
43
|
+
FileUtils.rm "c_dependencies"
|
44
|
+
out, err = assert_rant("hello.t")
|
45
|
+
assert(!out.strip.empty?)
|
46
|
+
assert(err.strip.empty?)
|
47
|
+
assert_equal(old_mtime, File.mtime("hello.t"))
|
48
|
+
end
|
49
|
+
def test_bar_c
|
50
|
+
assert_rant("deps=2", "bar.t")
|
51
|
+
assert(test(?f, "bar.t"))
|
52
|
+
assert(test(?f, "deps2.t"))
|
53
|
+
cdeps_mtime = File.mtime "deps2.t"
|
54
|
+
FileUtils.rm "bar.t"
|
55
|
+
assert_rant("deps=2", "bar.t")
|
56
|
+
assert(test(?f, "bar.t"))
|
57
|
+
assert_equal(cdeps_mtime, File.mtime("deps2.t"))
|
58
|
+
old_mtime = File.mtime "bar.t"
|
59
|
+
timeout
|
60
|
+
FileUtils.touch "src/abc.c"
|
61
|
+
assert_rant("deps=2", "bar.t")
|
62
|
+
assert_equal(old_mtime, File.mtime("bar.t"))
|
63
|
+
timeout
|
64
|
+
FileUtils.touch "include/with space.h"
|
65
|
+
assert_rant("deps=2", "bar.t")
|
66
|
+
assert(File.mtime("bar.t") > old_mtime)
|
67
|
+
end
|
68
|
+
def test_bar_c_deps3
|
69
|
+
assert_rant("deps=3", "bar.t")
|
70
|
+
assert(test(?f, "bar.t"))
|
71
|
+
assert(test(?f, "deps3.t"))
|
72
|
+
old_mtime = File.mtime("bar.t")
|
73
|
+
timeout
|
74
|
+
FileUtils.touch "src/abc"
|
75
|
+
assert_rant("deps=3", "bar.t")
|
76
|
+
assert(File.mtime("bar.t") > old_mtime)
|
77
|
+
old_mtime = File.mtime "bar.t"
|
78
|
+
timeout
|
79
|
+
FileUtils.touch "src/abc.c"
|
80
|
+
assert_rant("deps=3", "bar.t")
|
81
|
+
assert(File.mtime("bar.t") > old_mtime)
|
82
|
+
old_mtime = File.mtime "bar.t"
|
83
|
+
timeout
|
84
|
+
FileUtils.touch "foo.h"
|
85
|
+
assert_rant("deps=3", "bar.t")
|
86
|
+
assert(File.mtime("bar.t") > old_mtime)
|
87
|
+
assert_rant("autoclean")
|
88
|
+
%w(a.t hello.t bar.t c_dependencies deps2.t deps3.t).each { |f|
|
89
|
+
assert(!test(?e, f), "#{f} should get unlinked by AutoClean")
|
90
|
+
}
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$testImportCDepDir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestImportCDependenciesOnTheFly < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
# Ensure we run in test directory.
|
10
|
+
Dir.chdir $testImportCDepDir
|
11
|
+
end
|
12
|
+
def teardown
|
13
|
+
Dir.chdir $testImportCDepDir
|
14
|
+
FileUtils.rm_f "c_dependencies"
|
15
|
+
FileUtils.rm_rf Dir["*.t"]
|
16
|
+
end
|
17
|
+
def test_opts_without_filename
|
18
|
+
open "rf.t", "w" do |f|
|
19
|
+
f << <<-EOF
|
20
|
+
file "bar.t" => "src/bar.c" do |t|
|
21
|
+
sys.touch t.name
|
22
|
+
end
|
23
|
+
gen C::Dependencies,
|
24
|
+
:sources => sys["src/*.c"],
|
25
|
+
:search => "include"
|
26
|
+
source "c_dependencies"
|
27
|
+
EOF
|
28
|
+
end
|
29
|
+
assert_rant("-frf.t")
|
30
|
+
assert(test(?f, "bar.t"))
|
31
|
+
out, err = assert_rant("-frf.t")
|
32
|
+
assert(out.strip.empty?)
|
33
|
+
assert(err.strip.empty?)
|
34
|
+
old_mtime = File.mtime "bar.t"
|
35
|
+
timeout
|
36
|
+
FileUtils.touch "src/abc"
|
37
|
+
assert_rant("-frf.t")
|
38
|
+
assert_equal(old_mtime, File.mtime("bar.t"))
|
39
|
+
timeout
|
40
|
+
FileUtils.touch "include/with space.h"
|
41
|
+
assert_rant("-frf.t")
|
42
|
+
assert(File.mtime("bar.t") > old_mtime)
|
43
|
+
end
|
44
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
2
|
import %w(directedrule autoclean)
|
3
3
|
|
4
|
-
task :mk_src => %w(src.t/1.b src.t/2.b src.t/3.b)
|
4
|
+
task :mk_src => %w(src.t/1.b src.t/2.b src.t/3.b src.t/1.2b)
|
5
5
|
gen Directory, "src.t"
|
6
|
-
%w(src.t/1.b src.t/2.b src.t/3.b).each { |f|
|
6
|
+
%w(src.t/1.b src.t/2.b src.t/3.b src.t/1.2b).each { |f|
|
7
7
|
file f => "src.t" do |t| sys.touch t.name end
|
8
8
|
}
|
9
9
|
|
@@ -13,11 +13,16 @@ file "foo.t" => %w(build.t/1.a build.t/2.a) do |t|
|
|
13
13
|
end
|
14
14
|
|
15
15
|
gen Directory, "build.t"
|
16
|
+
gen Directory, "build2.t"
|
16
17
|
|
17
18
|
gen Action do
|
18
19
|
rac.build "build.t"
|
19
20
|
end
|
20
21
|
|
22
|
+
gen DirectedRule, "build2.t" => ["src.t"], '.2a' => '.2b' do |t|
|
23
|
+
sys.touch t.name
|
24
|
+
end
|
25
|
+
|
21
26
|
ro_tt = gen DirectedRule, "build.t" => ["src.t"], :a => :b do |t|
|
22
27
|
sys.touch t.name
|
23
28
|
end
|
@@ -28,4 +28,10 @@ class TestDirectedRule < Test::Unit::TestCase
|
|
28
28
|
assert_rant("foo.t")
|
29
29
|
assert(test(?f, "foo.t"))
|
30
30
|
end
|
31
|
+
def test_build_invoke_dir_task
|
32
|
+
assert_rant
|
33
|
+
assert_rant("build2.t/1.2a")
|
34
|
+
assert(test(?d, "build2.t"))
|
35
|
+
assert(test(?f, "build2.t/1.2a"))
|
36
|
+
end
|
31
37
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import "subfile"
|
2
|
+
|
3
|
+
gen SubFile, "sub.t/file" do |t|
|
4
|
+
sys.touch t.name
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "some subfile"
|
8
|
+
gen SubFile, "sub2.t/file"
|
9
|
+
|
10
|
+
gen SubFile, "sub3.t", "file" do |t|
|
11
|
+
sys.touch t.name
|
12
|
+
end
|
13
|
+
|
14
|
+
gen SubFile, "sub.t/file2" do |t|
|
15
|
+
sys.touch t.name
|
16
|
+
end
|
17
|
+
|
18
|
+
gen SubFile, "sub4.t/sub/file" do |t|
|
19
|
+
sys.touch t.name
|
20
|
+
end
|
21
|
+
|
22
|
+
gen SubFile, "sub5.t", "sub/sub/file" do |t|
|
23
|
+
sys.touch t.name
|
24
|
+
end
|
25
|
+
|
26
|
+
gen SubFile, "file.t" do |t|
|
27
|
+
sys.touch t.name
|
28
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
import %w(autoclean subfile)
|
3
|
+
|
4
|
+
gen AutoClean
|
5
|
+
|
6
|
+
gen SubFile, "sub.t/file" do |t|
|
7
|
+
sys.touch t.name
|
8
|
+
end
|
9
|
+
|
10
|
+
gen SubFile, "sub2.t", "sub.t/file" do |t|
|
11
|
+
sys.touch t.name
|
12
|
+
end
|
13
|
+
|
14
|
+
gen SubFile, "sub3.t", "file" do |t|
|
15
|
+
sys.touch t.name
|
16
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$testImportSubFileDir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestSubFile < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
# Ensure we run in test directory.
|
10
|
+
Dir.chdir($testImportSubFileDir)
|
11
|
+
end
|
12
|
+
def teardown
|
13
|
+
FileUtils.rm_rf Dir["*.t"]
|
14
|
+
end
|
15
|
+
def test_run_cmd
|
16
|
+
assert_rant("sub.t/file")
|
17
|
+
assert(test(?d, "sub.t"))
|
18
|
+
assert(test(?f, "sub.t/file"))
|
19
|
+
end
|
20
|
+
def test_desc
|
21
|
+
out, err = assert_rant("--tasks")
|
22
|
+
assert_match(%r{sub2\.t/file\s*#.*some subfile}, out)
|
23
|
+
end
|
24
|
+
def test_no_block
|
25
|
+
assert_rant("sub2.t/file")
|
26
|
+
assert(test(?d, "sub2.t"))
|
27
|
+
assert(!test(?e, "sub2.t/file"))
|
28
|
+
end
|
29
|
+
def test_fail_no_basedir
|
30
|
+
assert_rant(:fail, "sub3.t/file")
|
31
|
+
assert(!test(?e, "sub3.t"))
|
32
|
+
assert(!test(?e, "sub3.t/file"))
|
33
|
+
end
|
34
|
+
def test_basedir
|
35
|
+
FileUtils.mkdir "sub3.t"
|
36
|
+
assert_rant("sub3.t/file")
|
37
|
+
assert(test(?d, "sub3.t"))
|
38
|
+
assert(test(?f, "sub3.t/file"))
|
39
|
+
end
|
40
|
+
def test_dirtask_exists
|
41
|
+
assert_rant("sub.t/file2")
|
42
|
+
assert(test(?d, "sub.t"))
|
43
|
+
assert(test(?f, "sub.t/file2"))
|
44
|
+
assert(!test(?e, "sub.t/file"))
|
45
|
+
end
|
46
|
+
def test_make_two
|
47
|
+
assert_rant("sub.t/file", "sub.t/file2")
|
48
|
+
assert(test(?f, "sub.t/file"))
|
49
|
+
assert(test(?f, "sub.t/file2"))
|
50
|
+
end
|
51
|
+
def test_two_dirs
|
52
|
+
assert_rant("sub4.t/sub/file")
|
53
|
+
assert(test(?f, "sub4.t/sub/file"))
|
54
|
+
end
|
55
|
+
def test_basedir_two_dirs
|
56
|
+
FileUtils.mkdir "sub5.t"
|
57
|
+
out, err = assert_rant("sub5.t/sub/sub/file")
|
58
|
+
assert(!out.strip.empty?)
|
59
|
+
assert(test(?f, "sub5.t/sub/sub/file"))
|
60
|
+
out, err = assert_rant("sub5.t/sub/sub/file")
|
61
|
+
assert(out.strip.empty?)
|
62
|
+
end
|
63
|
+
def test_make_dir
|
64
|
+
assert_rant("sub.t")
|
65
|
+
assert(test(?d, "sub.t"))
|
66
|
+
assert(!test(?e, "sub.t/file"))
|
67
|
+
end
|
68
|
+
def test_only_file
|
69
|
+
assert_rant("file.t")
|
70
|
+
assert(test(?f, "file.t"))
|
71
|
+
out, err = assert_rant("file.t")
|
72
|
+
assert(out.strip.empty?)
|
73
|
+
end
|
74
|
+
def test_autoclean
|
75
|
+
assert_rant("-fautoclean.rf", "sub.t/file")
|
76
|
+
assert(test(?f, "sub.t/file"))
|
77
|
+
FileUtils.mkdir "sub2.t"
|
78
|
+
assert_rant("-fautoclean.rf", "sub2.t/sub.t/file")
|
79
|
+
assert(test(?f, "sub2.t/sub.t/file"))
|
80
|
+
FileUtils.mkdir "sub3.t"
|
81
|
+
assert_rant("-fautoclean.rf", "sub3.t/file")
|
82
|
+
assert(test(?f, "sub3.t/file"))
|
83
|
+
assert_rant("-fautoclean.rf", "autoclean")
|
84
|
+
assert(test(?d, "sub2.t"))
|
85
|
+
assert(test(?d, "sub3.t"))
|
86
|
+
%w(sub.t sub2.t/sub.t sub3.t/file).each { |f|
|
87
|
+
assert(!test(?e, f),
|
88
|
+
"#{f} should have been unlinked by AutoClean")
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
data/test/import/truth/Rantfile
CHANGED
@@ -11,6 +11,13 @@ file("rm.t") { |t|
|
|
11
11
|
"touch rm.t" %
|
12
12
|
"this file is useless"
|
13
13
|
|
14
|
+
task :sys_pipe do |t|
|
15
|
+
sys.touch %w(a.t b.t)
|
16
|
+
test(?f, "a.t") && test(?f, "b.t") or t.fail
|
17
|
+
sys["*.t"] % :rm
|
18
|
+
test(?f, "a.t") || test(?f, "b.t") and t.fail
|
19
|
+
end
|
20
|
+
|
14
21
|
drag :AutoClean, :clean
|
15
22
|
|
16
23
|
# vim:ft=ruby
|
data/test/project2/buildfile
CHANGED
@@ -15,7 +15,9 @@ class TestProject2 < Test::Unit::TestCase
|
|
15
15
|
include ::Rant::Sys
|
16
16
|
|
17
17
|
def app *args
|
18
|
-
@app = ::Rant::RantApp.new
|
18
|
+
@app = ::Rant::RantApp.new
|
19
|
+
@app.args.concat(args.flatten)
|
20
|
+
@app
|
19
21
|
end
|
20
22
|
def setup
|
21
23
|
Dir.chdir($testProject2Dir) unless Dir.pwd == $testProject2Dir
|
@@ -51,8 +53,8 @@ class TestProject2 < Test::Unit::TestCase
|
|
51
53
|
capture_std do
|
52
54
|
app("b_f2")
|
53
55
|
@app.rootdir = $testProject2Dir
|
54
|
-
|
55
|
-
"source should return
|
56
|
+
assert_equal(:return_val, @app.source("buildfile"),
|
57
|
+
"source should return value of last expression in Rantfile")
|
56
58
|
assert_equal(@app.run, 0)
|
57
59
|
end
|
58
60
|
assert(File.exist?("b_f2"))
|