rant 0.4.4 → 0.4.6
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 +38 -0
- data/README +4 -2
- data/Rantfile +50 -12
- data/doc/examples/c_cpp/c++/problem_1_1/another_test.cpp +6 -0
- data/doc/examples/c_cpp/c++/problem_1_1/another_test.h +5 -0
- data/doc/examples/c_cpp/c++/problem_1_1/main.cpp +12 -0
- data/doc/examples/c_cpp/c++/problem_1_1/test.cpp +6 -0
- data/doc/examples/c_cpp/c++/problem_1_1/test.h +5 -0
- data/doc/examples/c_cpp/c++/template.rf +15 -0
- data/doc/examples/c_cpp/c/problem_1_1/another_test.c +6 -0
- data/doc/examples/c_cpp/c/problem_1_1/another_test.h +7 -0
- data/doc/examples/c_cpp/c/problem_1_1/main.c +12 -0
- data/doc/examples/c_cpp/c/problem_1_1/test.c +6 -0
- data/doc/examples/c_cpp/c/problem_1_1/test.h +7 -0
- data/doc/examples/c_cpp/c/template.rf +15 -0
- data/doc/examples/c_cpp/root.rant +46 -0
- data/doc/homepage/index.html +115 -0
- data/doc/homepage/rant_home.css +98 -0
- data/doc/rant.1 +129 -0
- data/doc/rant.rdoc +5 -6
- data/doc/rantfile.rdoc +55 -32
- data/doc/subdirs.rdoc +147 -0
- data/lib/rant.rb +47 -49
- data/lib/rant/coregen.rb +20 -20
- data/lib/rant/import.rb +63 -11
- data/lib/rant/import/archive.rb +47 -15
- data/lib/rant/import/archive/tgz.rb +1 -1
- data/lib/rant/import/autoclean.rb +28 -26
- data/lib/rant/import/c/dependencies.rb +1 -1
- data/lib/rant/import/directedrule.rb +1 -4
- data/lib/rant/import/metadata.rb +30 -7
- data/lib/rant/import/nodes/default.rb +67 -13
- data/lib/rant/import/rubypackage.rb +1 -1
- data/lib/rant/import/rubytest.rb +25 -19
- data/lib/rant/import/signedfile.rb +14 -8
- data/lib/rant/import/sys/more.rb +22 -0
- data/lib/rant/import/sys/tgz.rb +43 -0
- data/lib/rant/import/sys/zip.rb +42 -0
- data/lib/rant/node.rb +19 -13
- data/lib/rant/plugin/configure.rb +1 -1
- data/lib/rant/progress.rb +33 -0
- data/lib/rant/rantenv.rb +7 -7
- data/lib/rant/rantlib.rb +246 -256
- data/lib/rant/rantsys.rb +61 -22
- data/lib/rant/rantvar.rb +7 -9
- data/misc/TODO +18 -0
- data/misc/devel-notes +4 -1
- data/test/Rantfile +17 -3
- data/test/deprecated/README +6 -0
- data/test/deprecated/test_0_4_8.rb +41 -0
- data/test/deprecated/test_0_5_2.rb +33 -0
- data/test/import/md5/root.rant +9 -0
- data/test/import/md5/test_md5.rb +45 -0
- data/test/import/metadata/Rantfile +2 -2
- data/test/import/metadata/test_metadata.rb +2 -2
- data/test/import/package/test_package.rb +40 -1
- data/test/import/signedfile/sub1/Rantfile +1 -1
- data/test/import/sys/data/pkg.tgz +0 -0
- data/test/import/sys/data/pkg.zip +0 -0
- data/test/import/sys/data/pkg/bin/test +0 -0
- data/test/import/sys/data/pkg/bin/test.o +0 -0
- data/test/import/sys/data/pkg/test.c +6 -0
- data/test/import/sys/data/pkg/test.h +7 -0
- data/test/import/sys/data/pkg2.zip +0 -0
- data/test/import/sys/test_tgz.rb +38 -0
- data/test/import/sys/test_zip.rb +68 -0
- data/test/import/sys/tgz.rf +6 -0
- data/test/import/sys/zip.rf +15 -0
- data/test/project2/{rantfile.rb → root.rant} +0 -0
- data/test/project2/test_project.rb +3 -8
- data/test/project_rb1/{rantfile.rb → rantfile} +1 -1
- data/test/project_rb1/test_project_rb1.rb +3 -5
- data/test/rant-import/test_rant-import.rb +22 -10
- data/test/subdirs/sub1/Rantfile +1 -1
- data/test/subdirs/sub2/{rantfile.rb → rantfile} +0 -0
- data/test/subdirs/sub2/sub/rantfile +1 -1
- data/test/subdirs2/root.rant +36 -0
- data/test/subdirs2/sub00/sub.rant +8 -0
- data/test/subdirs2/sub1/sub.rant +13 -0
- data/test/subdirs2/test_subdirs2.rb +239 -0
- data/test/test_examples.rb +91 -0
- data/test/test_filetask.rb +51 -11
- data/test/test_rant_interface.rb +24 -0
- data/test/test_rantfile_api.rb +54 -2
- data/test/test_sourcenode.rb +30 -0
- data/test/test_sys.rb +143 -15
- data/test/test_task.rb +16 -22
- data/test/tutil.rb +22 -38
- metadata +67 -9
|
@@ -24,7 +24,7 @@ class TestMetaData < Test::Unit::TestCase
|
|
|
24
24
|
def test_subdir
|
|
25
25
|
out, err = assert_rant("subdir=true", "sub/b")
|
|
26
26
|
assert(err.empty?)
|
|
27
|
-
assert_equal("nil\nnil\ntouch b\n", out)
|
|
27
|
+
assert_equal("nil\nnil\n(in sub)\ntouch b\n", out)
|
|
28
28
|
assert(test(?f, ".rant.meta"))
|
|
29
29
|
assert(test(?f, "sub/.rant.meta"))
|
|
30
30
|
out, err = assert_rant("subdir=true", "sub/b")
|
|
@@ -37,7 +37,7 @@ class TestMetaData < Test::Unit::TestCase
|
|
|
37
37
|
FileUtils.rm ".rant.meta"
|
|
38
38
|
out = run_ruby("make.t", "subdir=true", "sub/b")
|
|
39
39
|
assert_exit
|
|
40
|
-
assert_equal("nil\nnil\ntouch b\n", out)
|
|
40
|
+
assert_equal("nil\nnil\n(in sub)\ntouch b\n", out)
|
|
41
41
|
assert(test(?f, ".rant.meta"))
|
|
42
42
|
assert(test(?f, "sub/.rant.meta"))
|
|
43
43
|
out = run_ruby("make.t", "subdir=true", "sub/b")
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
require 'test/unit'
|
|
3
3
|
require 'tutil'
|
|
4
|
+
require 'rant/import/sys/tgz'
|
|
4
5
|
|
|
5
6
|
$testIPackageDir ||= File.expand_path(File.dirname(__FILE__))
|
|
6
7
|
|
|
7
8
|
class TestImportPackage < Test::Unit::TestCase
|
|
9
|
+
include Rant::TestUtil
|
|
8
10
|
def setup
|
|
9
11
|
# Ensure we run in test directory.
|
|
10
12
|
Dir.chdir $testIPackageDir
|
|
@@ -23,7 +25,12 @@ class TestImportPackage < Test::Unit::TestCase
|
|
|
23
25
|
FileUtils.cp archive, "u.t"
|
|
24
26
|
FileUtils.cd "u.t"
|
|
25
27
|
archive = File.basename archive
|
|
26
|
-
|
|
28
|
+
case atype
|
|
29
|
+
when :tgz: Rant::Sys.unpack_tgz(archive)
|
|
30
|
+
when :zip: Rant::Sys.unpack_zip(archive)
|
|
31
|
+
else
|
|
32
|
+
raise "unknown archive type -- #{atype}"
|
|
33
|
+
end
|
|
27
34
|
if @pkg_dir
|
|
28
35
|
assert(test(?d, @pkg_dir))
|
|
29
36
|
FileUtils.cd @pkg_dir
|
|
@@ -558,4 +565,36 @@ class TestImportPackage < Test::Unit::TestCase
|
|
|
558
565
|
ensure
|
|
559
566
|
FileUtils.rm_f %w(make.t empty.rf empty.t.tgz)
|
|
560
567
|
end
|
|
568
|
+
def test_package_tgz_flag_manifest_opt_files
|
|
569
|
+
in_local_temp_dir do
|
|
570
|
+
write_to_file "root.rant", <<-EOF
|
|
571
|
+
import "md5", "package/tgz", "autoclean"
|
|
572
|
+
gen Package::Tgz, "a-b", :manifest, :files => sys["*"].exclude("u")
|
|
573
|
+
gen AutoClean
|
|
574
|
+
EOF
|
|
575
|
+
write_to_file "a", "a\n"
|
|
576
|
+
out, err = assert_rant "a-b.tgz"
|
|
577
|
+
assert err.empty?
|
|
578
|
+
assert !out.empty?
|
|
579
|
+
assert(test(?f, "a-b.tgz"))
|
|
580
|
+
assert(test(?f, "MANIFEST"))
|
|
581
|
+
Rant::Sys.unpack_tgz "a-b.tgz", :in => "u"
|
|
582
|
+
assert_nothing_raised do
|
|
583
|
+
assert Rant::Sys.compare_file("root.rant", "u/a-b/root.rant")
|
|
584
|
+
assert_equal "a\n", File.read("u/a-b/a")
|
|
585
|
+
entries = File.read("u/a-b/MANIFEST").split(/\n/)
|
|
586
|
+
assert_equal 3, entries.size
|
|
587
|
+
assert entries.include?("MANIFEST")
|
|
588
|
+
assert entries.include?("a")
|
|
589
|
+
assert entries.include?("root.rant")
|
|
590
|
+
end
|
|
591
|
+
out, err = assert_rant "a-b.tgz"
|
|
592
|
+
assert err.empty?
|
|
593
|
+
assert out.empty?
|
|
594
|
+
assert_rant "autoclean"
|
|
595
|
+
assert !test(?e, "a-b.tgz")
|
|
596
|
+
assert !test(?e, "a-b")
|
|
597
|
+
assert !test(?e, ".rant.meta")
|
|
598
|
+
end
|
|
599
|
+
end
|
|
561
600
|
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
require 'tutil'
|
|
4
|
+
|
|
5
|
+
$test_import_sys_dir ||= File.expand_path(File.dirname(__FILE__))
|
|
6
|
+
|
|
7
|
+
class TestImportSysTgz < Test::Unit::TestCase
|
|
8
|
+
include Rant::TestUtil
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
# Ensure we run in test directory.
|
|
12
|
+
Dir.chdir($test_import_sys_dir)
|
|
13
|
+
end
|
|
14
|
+
def test_unpack_tgz
|
|
15
|
+
assert !test(?e, "pkg")
|
|
16
|
+
begin
|
|
17
|
+
out, err = assert_rant "-ftgz.rf"
|
|
18
|
+
assert err.empty?
|
|
19
|
+
assert !out.empty?
|
|
20
|
+
assert out.split(/\n/).size < 3
|
|
21
|
+
dirs = %w(pkg pkg/bin)
|
|
22
|
+
files = %w(pkg/test.c pkg/test.h pkg/bin/test pkg/bin/test.o)
|
|
23
|
+
dirs.each { |dir|
|
|
24
|
+
assert test(?d, dir), "dir `#{dir}' missing"
|
|
25
|
+
}
|
|
26
|
+
files.each { |fn|
|
|
27
|
+
src_fn = File.join "data", fn
|
|
28
|
+
assert test(?f, fn), "file `#{fn}' missing"
|
|
29
|
+
assert Rant::Sys.compare_file(fn, src_fn), "#{fn} corrupted"
|
|
30
|
+
}
|
|
31
|
+
actual = Rant::FileList["pkg", "pkg/**/*", "pkg/**/.*"]
|
|
32
|
+
actual.shun ".", ".."
|
|
33
|
+
assert_equal((files + dirs).sort, actual.sort)
|
|
34
|
+
ensure
|
|
35
|
+
Rant::Sys.rm_rf "pkg"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
require 'tutil'
|
|
4
|
+
|
|
5
|
+
$test_import_sys_dir ||= File.expand_path(File.dirname(__FILE__))
|
|
6
|
+
|
|
7
|
+
class TestImportSysZip < Test::Unit::TestCase
|
|
8
|
+
include Rant::TestUtil
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
# Ensure we run in test directory.
|
|
12
|
+
Dir.chdir($test_import_sys_dir)
|
|
13
|
+
end
|
|
14
|
+
def test_unpack_zip_in_dir
|
|
15
|
+
assert !test(?e, "dir.t")
|
|
16
|
+
out, err = assert_rant "-fzip.rf"
|
|
17
|
+
assert err.empty?
|
|
18
|
+
assert !out.empty?
|
|
19
|
+
assert test(?f, "t.zip")
|
|
20
|
+
assert out.split(/\n/).size < 6
|
|
21
|
+
dirs = %w(pkg pkg/bin)
|
|
22
|
+
files = %w(pkg/test.c pkg/test.h pkg/bin/test pkg/bin/test.o)
|
|
23
|
+
dirs.each { |dir|
|
|
24
|
+
dir = File.join("dir.t", dir)
|
|
25
|
+
assert test(?d, dir), "dir `#{dir}' missing"
|
|
26
|
+
}
|
|
27
|
+
files.each { |fn|
|
|
28
|
+
src_fn = File.join "data", fn
|
|
29
|
+
fn = File.join("dir.t", fn)
|
|
30
|
+
assert test(?f, fn), "file `#{fn}' missing"
|
|
31
|
+
assert Rant::Sys.compare_file(fn, src_fn), "#{fn} corrupted"
|
|
32
|
+
}
|
|
33
|
+
actual = Rant::FileList["dir.t/**/*", "dir.t/**/.*"]
|
|
34
|
+
actual.shun ".", ".."
|
|
35
|
+
actual.map! { |e| e.sub(/^dir\.t\//, '') }
|
|
36
|
+
assert_equal((files + dirs).sort, actual.sort)
|
|
37
|
+
out, err = assert_rant "-fzip.rf"
|
|
38
|
+
assert err.empty?
|
|
39
|
+
assert out.empty?
|
|
40
|
+
out, err = assert_rant "-fzip.rf", "src=data/pkg2.zip"
|
|
41
|
+
assert err.empty?
|
|
42
|
+
assert !out.empty?
|
|
43
|
+
assert out.split(/\n/).size < 6
|
|
44
|
+
dirs = %w(pkg pkg/bin)
|
|
45
|
+
files = %w(pkg/test.c pkg/test.h pkg/bin/test)
|
|
46
|
+
dirs.each { |dir|
|
|
47
|
+
dir = File.join("dir.t", dir)
|
|
48
|
+
assert test(?d, dir), "dir `#{dir}' missing"
|
|
49
|
+
}
|
|
50
|
+
files.each { |fn|
|
|
51
|
+
src_fn = File.join "data", fn
|
|
52
|
+
fn = File.join("dir.t", fn)
|
|
53
|
+
assert test(?f, fn), "file `#{fn}' missing"
|
|
54
|
+
assert Rant::Sys.compare_file(fn, src_fn), "#{fn} corrupted"
|
|
55
|
+
}
|
|
56
|
+
actual = Rant::FileList["dir.t/**/*", "dir.t/**/.*"]
|
|
57
|
+
actual.shun ".", ".."
|
|
58
|
+
actual.map! { |e| e.sub(/^dir\.t\//, '') }
|
|
59
|
+
assert_equal((files + dirs).sort, actual.sort)
|
|
60
|
+
out, err = assert_rant "-fzip.rf", "src=data/pkg2.zip"
|
|
61
|
+
assert err.empty?
|
|
62
|
+
assert out.empty?
|
|
63
|
+
assert_rant "-fzip.rf", "autoclean"
|
|
64
|
+
assert !test(?e, "dir.t")
|
|
65
|
+
assert !test(?e, "t.zip")
|
|
66
|
+
assert Dir["**/*.rant.meta"].empty?
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import "md5", "sys/zip", "autoclean"
|
|
3
|
+
|
|
4
|
+
var :src => "data/pkg.zip"
|
|
5
|
+
|
|
6
|
+
gen Directory, "dir.t" => "t.zip" do
|
|
7
|
+
sys.rm_rf "dir.t/pkg"
|
|
8
|
+
sys.unpack_zip "t.zip", :in => "dir.t"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
file "t.zip" => var[:src] do |t|
|
|
12
|
+
sys.cp t.source, t.name
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
gen AutoClean
|
|
File without changes
|
|
@@ -23,9 +23,7 @@ class TestProject2 < Test::Unit::TestCase
|
|
|
23
23
|
Dir.chdir($testProject2Dir) unless Dir.pwd == $testProject2Dir
|
|
24
24
|
end
|
|
25
25
|
def teardown
|
|
26
|
-
|
|
27
|
-
assert_equal(app(%w(-f rantfile.rb -f buildfile clean sub1/clean)).run, 0)
|
|
28
|
-
end
|
|
26
|
+
assert_rant(%w(-f root.rant -f buildfile clean sub1/clean))
|
|
29
27
|
assert(Dir["r_f*"].empty?,
|
|
30
28
|
"r_f* files should have been removed by `clean'")
|
|
31
29
|
assert(Dir["b_f*"].empty?,
|
|
@@ -51,8 +49,7 @@ class TestProject2 < Test::Unit::TestCase
|
|
|
51
49
|
end
|
|
52
50
|
def test_load_rantfile
|
|
53
51
|
capture_std do
|
|
54
|
-
app("b_f2")
|
|
55
|
-
@app.rootdir = $testProject2Dir
|
|
52
|
+
app("b_f2", "-C", $testProject2Dir)
|
|
56
53
|
assert_equal(:return_val, @app.source("buildfile"),
|
|
57
54
|
"source should return value of last expression in Rantfile")
|
|
58
55
|
assert_equal(@app.run, 0)
|
|
@@ -77,11 +74,9 @@ class TestProject2 < Test::Unit::TestCase
|
|
|
77
74
|
end
|
|
78
75
|
def test_opth_directory
|
|
79
76
|
app %w(insub1_s1f1)
|
|
80
|
-
#Rant[:directory] = "sub1"
|
|
81
77
|
@app[:verbose] = 2
|
|
82
|
-
@app[:directory] = "sub1"
|
|
83
78
|
capture_std do
|
|
84
|
-
assert_equal(@app.run, 0)
|
|
79
|
+
assert_equal(@app.run("-Csub1"), 0)
|
|
85
80
|
end
|
|
86
81
|
assert(Dir.pwd !~ /sub1$/,
|
|
87
82
|
"rant should cd to original dir before returning from `run'")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import %w(rubytest rubydoc rubypackage clean)
|
|
2
2
|
|
|
3
3
|
lib_files = Dir["lib/**/*.rb"]
|
|
4
|
-
dist_files = lib_files + %w(rantfile
|
|
4
|
+
dist_files = lib_files + %w(rantfile README test_project_rb1.rb) + Dir["{test,bin}/*"]
|
|
5
5
|
|
|
6
6
|
desc "Run unit tests."
|
|
7
7
|
gen RubyTest do |t|
|
|
@@ -8,7 +8,7 @@ class TestProjectRb1 < Test::Unit::TestCase
|
|
|
8
8
|
def setup
|
|
9
9
|
@manifest = %w(bin lib test bin/wgrep lib/wgrep.rb
|
|
10
10
|
test/text test/tc_wgrep.rb README test_project_rb1.rb
|
|
11
|
-
rantfile
|
|
11
|
+
rantfile)
|
|
12
12
|
# Ensure we run in test directory.
|
|
13
13
|
Dir.chdir($testProjectRb1Dir)
|
|
14
14
|
end
|
|
@@ -94,8 +94,7 @@ class TestProjectRb1 < Test::Unit::TestCase
|
|
|
94
94
|
FileUtils.mkdir tmp_dir
|
|
95
95
|
FileUtils.cp tar_fn, tmp_dir
|
|
96
96
|
FileUtils.cd tmp_dir do
|
|
97
|
-
|
|
98
|
-
unpack_archive :tgz, tar_fn
|
|
97
|
+
Rant::Sys.unpack_tgz tar_fn
|
|
99
98
|
assert(test(?d, pkg_base),
|
|
100
99
|
"`#{pkg_base}' should be root directory of all files in tar")
|
|
101
100
|
FileUtils.cd pkg_base do
|
|
@@ -115,8 +114,7 @@ class TestProjectRb1 < Test::Unit::TestCase
|
|
|
115
114
|
FileUtils.mkdir tmp_dir
|
|
116
115
|
FileUtils.cp zip_fn, tmp_dir
|
|
117
116
|
FileUtils.cd tmp_dir do
|
|
118
|
-
|
|
119
|
-
unpack_archive :zip, zip_fn
|
|
117
|
+
Rant::Sys.unpack_zip zip_fn
|
|
120
118
|
assert(test(?d, pkg_base),
|
|
121
119
|
"`#{pkg_base}' should be root directory of all files in zip")
|
|
122
120
|
FileUtils.cd pkg_base do
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
require 'test/unit'
|
|
3
|
-
require 'rant/rantlib'
|
|
4
3
|
require 'tutil'
|
|
5
|
-
require '
|
|
4
|
+
require 'rant/import'
|
|
6
5
|
|
|
7
6
|
$testRantImportDir ||= File.expand_path(File.dirname(__FILE__))
|
|
8
7
|
|
|
9
8
|
class TestRantImport < Test::Unit::TestCase
|
|
9
|
+
include Rant::TestUtil
|
|
10
|
+
|
|
10
11
|
def setup
|
|
11
12
|
# Ensure we run in test directory.
|
|
12
13
|
Dir.chdir($testRantImportDir)
|
|
@@ -17,12 +18,27 @@ class TestRantImport < Test::Unit::TestCase
|
|
|
17
18
|
FileUtils.rm_f Dir["make*"]
|
|
18
19
|
FileUtils.rm_rf Dir["*.t"]
|
|
19
20
|
end
|
|
21
|
+
def test_option_help
|
|
22
|
+
out, err = capture_std do
|
|
23
|
+
assert_equal(0, Rant::RantImport.new("--help").run)
|
|
24
|
+
end
|
|
25
|
+
assert err.empty?
|
|
26
|
+
assert out.include?("rant-import")
|
|
27
|
+
assert out.include?("Options are")
|
|
28
|
+
assert out.include?("--help")
|
|
29
|
+
end
|
|
20
30
|
def test_no_import
|
|
21
31
|
run_import("--quiet", "make.rb")
|
|
22
32
|
assert(test(?f, "make.rb"))
|
|
33
|
+
content = File.read("make.rb")
|
|
23
34
|
assert(!test(?f, "action.t"))
|
|
24
35
|
assert_equal(run_rant("hello"), run_ruby("make.rb", "hello"))
|
|
25
36
|
assert(test(?f, "action.t"))
|
|
37
|
+
out, err = capture_std do
|
|
38
|
+
assert_equal(1, Rant::RantImport.new("-iclean", "make.rb").run)
|
|
39
|
+
end
|
|
40
|
+
assert_equal(content, File.read("make.rb"))
|
|
41
|
+
assert_match(/\[ERROR\].*\bmake\.rb\b.*\bexists\b.*--force/m, err)
|
|
26
42
|
end
|
|
27
43
|
def test_import_from_custom_lib
|
|
28
44
|
FileUtils.mkpath "mylib.t/rant/import"
|
|
@@ -85,13 +101,11 @@ class TestRantImport < Test::Unit::TestCase
|
|
|
85
101
|
end
|
|
86
102
|
EOF
|
|
87
103
|
}
|
|
88
|
-
|
|
89
|
-
f << <<-EOF
|
|
104
|
+
write_to_file "rantfile", <<-EOF
|
|
90
105
|
$:.unshift "lib.t"
|
|
91
106
|
import "sub/t"
|
|
92
107
|
gen Sub::T, "hello", "test" do end
|
|
93
|
-
|
|
94
|
-
}
|
|
108
|
+
EOF
|
|
95
109
|
out, err = assert_rant
|
|
96
110
|
assert_match(/.*hello.*\n.*test.*\n.*block_given/, out)
|
|
97
111
|
run_import("--quiet", "--auto", "ant")
|
|
@@ -132,13 +146,11 @@ class TestRantImport < Test::Unit::TestCase
|
|
|
132
146
|
end
|
|
133
147
|
EOF
|
|
134
148
|
}
|
|
135
|
-
|
|
136
|
-
f << <<-EOF
|
|
149
|
+
write_to_file "root.rant", <<-EOF
|
|
137
150
|
$:.unshift "lib.t"
|
|
138
151
|
import "sub2/t"
|
|
139
152
|
gen Sub2::T, "hello", "test" do end
|
|
140
|
-
|
|
141
|
-
}
|
|
153
|
+
EOF
|
|
142
154
|
out, err = assert_rant
|
|
143
155
|
assert_match(/hellotest/, out)
|
|
144
156
|
run_import("--quiet", "--auto", "ant.rb")
|
data/test/subdirs/sub1/Rantfile
CHANGED
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import "autoclean", "subfile"
|
|
3
|
+
|
|
4
|
+
def define_print_task(name)
|
|
5
|
+
task name do |t|
|
|
6
|
+
puts t.full_name
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
desc "show full task name"
|
|
11
|
+
task :a do |t|
|
|
12
|
+
puts t.full_name
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
file "a.t" do |t|
|
|
16
|
+
write t.name
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
file "b.t" do |t|
|
|
20
|
+
write t.name
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
gen SubFile, "t/t", "a.t" => "b.t" do |t|
|
|
24
|
+
write(t.name, "abc")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
gen AutoClean
|
|
28
|
+
|
|
29
|
+
subdirs sys["sub?"] # doesn't cover sub00, per intent
|
|
30
|
+
|
|
31
|
+
def self.write(fn, content=nil)
|
|
32
|
+
puts "writing to #{fn}"
|
|
33
|
+
open fn, "w" do |f|
|
|
34
|
+
f.write(content || "#{fn}\n")
|
|
35
|
+
end
|
|
36
|
+
end
|