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
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
body {
|
|
2
|
+
color:#333;
|
|
3
|
+
background-color:white;
|
|
4
|
+
/* background-color:gray; */
|
|
5
|
+
margin:20px;
|
|
6
|
+
padding:0px;
|
|
7
|
+
font:12px verdana, arial, helvetica, sans-serif;
|
|
8
|
+
}
|
|
9
|
+
h1 {
|
|
10
|
+
margin:0px 0px 15px 0px;
|
|
11
|
+
padding:0px;
|
|
12
|
+
font-size:28px;
|
|
13
|
+
font-weight:900;
|
|
14
|
+
color:#ccc;
|
|
15
|
+
}
|
|
16
|
+
h2 {
|
|
17
|
+
font:bold 14px/15px verdana, arial, helvetica, sans-serif;
|
|
18
|
+
margin:0px 0px 5px 0px;
|
|
19
|
+
padding:0px;
|
|
20
|
+
}
|
|
21
|
+
h3 {
|
|
22
|
+
font:bold 12px/14px verdana, arial, helvetica, sans-serif;
|
|
23
|
+
margin:0px 0px 5px 0px;
|
|
24
|
+
padding:0px;
|
|
25
|
+
}
|
|
26
|
+
p {
|
|
27
|
+
font:12px/20px verdana, arial, helvetica, sans-serif;
|
|
28
|
+
margin:0px 0px 16px 0px;
|
|
29
|
+
padding:0px;
|
|
30
|
+
}
|
|
31
|
+
.Content>p {margin:0px;}
|
|
32
|
+
.Content>p+p {text-indent:30px;}
|
|
33
|
+
|
|
34
|
+
a {
|
|
35
|
+
color:#09c;
|
|
36
|
+
font-size:12px;
|
|
37
|
+
font-family:verdana, arial, helvetica, sans-serif;
|
|
38
|
+
font-weight:600;
|
|
39
|
+
text-decoration:none;
|
|
40
|
+
}
|
|
41
|
+
a:link {color:#09c;}
|
|
42
|
+
a:visited {color:#07a;}
|
|
43
|
+
a:hover {background-color:#eee;}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/* All the content boxes belong to the content class. */
|
|
47
|
+
.content {
|
|
48
|
+
position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */
|
|
49
|
+
width:auto;
|
|
50
|
+
min-width:120px;
|
|
51
|
+
margin:0px 210px 20px 170px;
|
|
52
|
+
border:1px solid black;
|
|
53
|
+
background-color:white;
|
|
54
|
+
padding:10px;
|
|
55
|
+
z-index:3; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#navAlpha {
|
|
59
|
+
position:absolute;
|
|
60
|
+
/* width:150px; */
|
|
61
|
+
top:20px;
|
|
62
|
+
left:20px;
|
|
63
|
+
border:1px dashed black;
|
|
64
|
+
background-color:#eee;
|
|
65
|
+
padding:10px;
|
|
66
|
+
z-index:2;
|
|
67
|
+
|
|
68
|
+
/* Here is the ugly brilliant hack that protects IE5/Win from its own stupidity.
|
|
69
|
+
Thanks to Tantek Celik for the hack and to Eric Costello for publicizing it.
|
|
70
|
+
IE5/Win incorrectly parses the "\"}"" value, prematurely closing the style
|
|
71
|
+
declaration. The incorrect IE5/Win value is above, while the correct value is
|
|
72
|
+
below. See http://glish.com/css/hacks.asp for details. */
|
|
73
|
+
voice-family: "\"}\"";
|
|
74
|
+
voice-family:inherit;
|
|
75
|
+
/* width:128px; */
|
|
76
|
+
}
|
|
77
|
+
/* I've heard this called the "be nice to Opera 5" rule. Basically, it feeds correct
|
|
78
|
+
length values to user agents that exhibit the parsing error exploited above yet get
|
|
79
|
+
the CSS box model right and understand the CSS2 parent-child selector. ALWAYS include
|
|
80
|
+
a "be nice to Opera 5" rule every time you use the Tantek Celik hack (above). */
|
|
81
|
+
body>#navAlpha {width:128px;}
|
|
82
|
+
|
|
83
|
+
#navBeta {
|
|
84
|
+
position:absolute;
|
|
85
|
+
width:190px;
|
|
86
|
+
top:20px;
|
|
87
|
+
right:20px;
|
|
88
|
+
border:1px dashed black;
|
|
89
|
+
background-color:#eee;
|
|
90
|
+
padding:10px;
|
|
91
|
+
z-index:1;
|
|
92
|
+
/* Again, the ugly brilliant hack. */
|
|
93
|
+
voice-family: "\"}\"";
|
|
94
|
+
voice-family:inherit;
|
|
95
|
+
width:168px;
|
|
96
|
+
}
|
|
97
|
+
/* Again, "be nice to Opera 5". */
|
|
98
|
+
body>#navBeta {width:168px;}
|
data/doc/rant.1
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
.\" rant.1 - rant manpage
|
|
2
|
+
.\" Date of last change to this manpage.
|
|
3
|
+
.TH RANT 1 "September 17, 2005"
|
|
4
|
+
.SH NAME
|
|
5
|
+
rant \- A flexible and portable build tool.
|
|
6
|
+
.SH SYNOPSIS
|
|
7
|
+
.B rant
|
|
8
|
+
.RI [OPTION]\ ...\ [TARGET]\ ...
|
|
9
|
+
.br
|
|
10
|
+
.SH DESCRIPTION
|
|
11
|
+
.B Striking features
|
|
12
|
+
|
|
13
|
+
* Defining custom tasks.
|
|
14
|
+
|
|
15
|
+
* Automated packaging, testing and RDoc generation for Ruby
|
|
16
|
+
applications and libraries.
|
|
17
|
+
|
|
18
|
+
* Creation of a monolithic script tailored to the needs of a specific
|
|
19
|
+
project which can be used instead of an Rant installation - users
|
|
20
|
+
don't need to install Rant.
|
|
21
|
+
|
|
22
|
+
* Creating gzipped tar and zip archives -- without installing
|
|
23
|
+
additional software.
|
|
24
|
+
|
|
25
|
+
* Optional recognition of file changes based on MD5 checksums instead
|
|
26
|
+
of file modification times.
|
|
27
|
+
|
|
28
|
+
* Dependency checking for C/C++ source files (integrated makedepend
|
|
29
|
+
replacement).
|
|
30
|
+
|
|
31
|
+
* Primitive support for compiling C# sources with csc, cscc and mcs.
|
|
32
|
+
|
|
33
|
+
.B Startup
|
|
34
|
+
|
|
35
|
+
On startup, rant will look for a file called
|
|
36
|
+
.IR Rantfile
|
|
37
|
+
,
|
|
38
|
+
.IR rantfile
|
|
39
|
+
or
|
|
40
|
+
.IR root.rant
|
|
41
|
+
which contains the build specification (which in fact is valid Ruby
|
|
42
|
+
code). After reading the Rantfile(s), rant will execute the following
|
|
43
|
+
tasks:
|
|
44
|
+
|
|
45
|
+
.B If at least one target was given on the commandline:
|
|
46
|
+
|
|
47
|
+
rant will execute all tasks necessary to build all targets given on
|
|
48
|
+
the commandline.
|
|
49
|
+
|
|
50
|
+
.B else:
|
|
51
|
+
|
|
52
|
+
rant tries to build the target called "default". If no task with this
|
|
53
|
+
name exists, rant invokes the first defined task.
|
|
54
|
+
|
|
55
|
+
If you want to know which task(s) will be invoked when no target is
|
|
56
|
+
given on the commandline, run rant with the
|
|
57
|
+
.IR -T
|
|
58
|
+
option. Example:
|
|
59
|
+
|
|
60
|
+
$ rant -T
|
|
61
|
+
.br
|
|
62
|
+
rant # => test
|
|
63
|
+
.br
|
|
64
|
+
rant package # Create packages for distribution.
|
|
65
|
+
.br
|
|
66
|
+
rant doc # Generate documentation.
|
|
67
|
+
.br
|
|
68
|
+
rant publish-docs # Publish html docs on make.rubyfore.org.
|
|
69
|
+
.br
|
|
70
|
+
# Note: scp will prompt for rubyforge password.
|
|
71
|
+
.br
|
|
72
|
+
rant test # Run basic tests.
|
|
73
|
+
|
|
74
|
+
The
|
|
75
|
+
.B first line
|
|
76
|
+
always shows the target that will be built if no target argument is
|
|
77
|
+
given. In this case, it would be the
|
|
78
|
+
.RI test
|
|
79
|
+
target.
|
|
80
|
+
|
|
81
|
+
.PP
|
|
82
|
+
.SH OPTIONS
|
|
83
|
+
.TP
|
|
84
|
+
--help -h
|
|
85
|
+
Print a help message and exit.
|
|
86
|
+
.TP
|
|
87
|
+
--version -V
|
|
88
|
+
Print version of Rant and exit.
|
|
89
|
+
.TP
|
|
90
|
+
--verbose -v
|
|
91
|
+
Print more messages to stderr.
|
|
92
|
+
.TP
|
|
93
|
+
--quiet -q
|
|
94
|
+
Don't print commands.
|
|
95
|
+
.TP
|
|
96
|
+
--err-commands
|
|
97
|
+
Print failed commands and their exit status.
|
|
98
|
+
.TP
|
|
99
|
+
--directory DIRECTORY -C DIRECTORY
|
|
100
|
+
Run rant in DIRECTORY.
|
|
101
|
+
.TP
|
|
102
|
+
--cd-parent -c
|
|
103
|
+
With this option, Rant starts to search for an Rantfile in the
|
|
104
|
+
current working directory as usual, but if it doesn't find one,
|
|
105
|
+
it changes to the parent directory and looks there for an
|
|
106
|
+
Rantfile. This is repeated until an Rantfile is found or the
|
|
107
|
+
working directory is the root directory of the filesystem.
|
|
108
|
+
.TP
|
|
109
|
+
--look-up -u
|
|
110
|
+
Look in parent directories for root Rantfile.
|
|
111
|
+
.TP
|
|
112
|
+
--rantfile RANTFILE -f RANTFILE
|
|
113
|
+
Process RANTFILE instead of standard rantfiles.
|
|
114
|
+
Multiple files may be specified by repeating this option.
|
|
115
|
+
.TP
|
|
116
|
+
--force-run TARGET -a TARGET
|
|
117
|
+
Force rebuild of TARGET and all dependencies.
|
|
118
|
+
.TP
|
|
119
|
+
--tasks -T
|
|
120
|
+
Show a list of all described tasks and exit.
|
|
121
|
+
|
|
122
|
+
.SH AUTHOR
|
|
123
|
+
rant was developed by Stefan Lang <langstefan@gmx.at>
|
|
124
|
+
.SH COPYRIGHT
|
|
125
|
+
Copyright (C) 2005 Stefan Lang <langstefan@gmx.at>
|
|
126
|
+
.SH SEE ALSO
|
|
127
|
+
For extensive documentation visit the Rant homepage
|
|
128
|
+
.IR http://make.ruby-co.de
|
|
129
|
+
.\" vim:ft=nroff
|
data/doc/rant.rdoc
CHANGED
|
@@ -17,7 +17,7 @@ run rant with the <tt>--tasks</tt> (short form: <tt>-T</tt>) option:
|
|
|
17
17
|
rant cov # Run all tests and generate coverage with rcov.
|
|
18
18
|
rant clean # Remove autogenerated files.
|
|
19
19
|
rant publish-docs # Publish html docs on RubyForge.
|
|
20
|
-
|
|
20
|
+
# Note: scp will prompt for rubyforge password.
|
|
21
21
|
This lists the "public" tasks for the project. The first line always
|
|
22
22
|
tells you the task(s) that will be invoked when no argument is given
|
|
23
23
|
to rant, in the above example, this would be the +test+ task.
|
|
@@ -30,12 +30,11 @@ steps (roughly):
|
|
|
30
30
|
equivalent. Arguments of the form <tt>VAR=VAL</tt> set variables
|
|
31
31
|
available in the Rantfile(s). All other arguments are names of
|
|
32
32
|
tasks to be invoked.
|
|
33
|
-
2. Load
|
|
33
|
+
2. Load Rantfile in working directory. Rantfiles with the following
|
|
34
34
|
names are recognized:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
rantfile.rb
|
|
35
|
+
Rantfile
|
|
36
|
+
rantfile
|
|
37
|
+
root.rant
|
|
39
38
|
3. Calculate task dependencies and invoke required tasks. If no task
|
|
40
39
|
was given on the commandline, a task called "default" will be
|
|
41
40
|
invoked. If the "default" task doesn't exist, the first task will
|
data/doc/rantfile.rdoc
CHANGED
|
@@ -12,30 +12,26 @@ starts, it instantiates one Rant application which will read one or
|
|
|
12
12
|
more Rantfiles. The Rantfile communicates with the following list of
|
|
13
13
|
methods with the Rant application:
|
|
14
14
|
|
|
15
|
-
+task+::
|
|
16
|
-
+file+::
|
|
17
|
-
+desc+::
|
|
18
|
-
|
|
19
|
-
+gen+::
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
+import+::
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
+
|
|
28
|
-
|
|
29
|
-
+
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
look for Rantfiles.
|
|
36
|
-
+var+:: Provides access to variables accessible in Rantfiles
|
|
37
|
-
and from the commandline.
|
|
38
|
-
+rac+:: The "Rant compiler" which is compiling the Rantfiles.
|
|
15
|
+
+task+:: Defines a task with prerequisites and an action.
|
|
16
|
+
+file+:: A special form of task which creates one file.
|
|
17
|
+
+desc+:: Describes the next defined task. A task with
|
|
18
|
+
description is considered a "public" task.
|
|
19
|
+
+gen+:: Takes a _generator_ object as first argument which
|
|
20
|
+
usually creates one or more tasks. An example would be
|
|
21
|
+
the +RubyPackage+ generator which produces tasks for
|
|
22
|
+
packaging.
|
|
23
|
+
+import+:: Imports additional code which usually provides
|
|
24
|
+
additional generators. Example: to use the
|
|
25
|
+
+RubyPackage+ generator you have to <tt>import
|
|
26
|
+
"rubypackage"</tt> first.
|
|
27
|
+
+sys+:: Run external commands or do usual file system
|
|
28
|
+
operations (copy files, unlink files, install, ...).
|
|
29
|
+
+source+:: Takes a filename as argument and causes Rant to read
|
|
30
|
+
it in as Rantfile.
|
|
31
|
+
+subdirs+:: Takes a list of subdirectories in which Rant should
|
|
32
|
+
look for Rantfiles.
|
|
33
|
+
+var+:: Provides access to variables accessible in Rantfiles
|
|
34
|
+
and from the commandline.
|
|
39
35
|
+make+:: Immediately build a target.
|
|
40
36
|
|
|
41
37
|
=== Defining a task
|
|
@@ -150,15 +146,16 @@ shows this descriptions:
|
|
|
150
146
|
rant clean # Remove autogenerated files.
|
|
151
147
|
Only the tasks which have a description are listed.
|
|
152
148
|
|
|
153
|
-
=== The +sys+
|
|
149
|
+
=== The +sys+ command
|
|
154
150
|
|
|
155
|
-
After using the +sys+
|
|
156
|
-
explain it a little bit. The +sys+
|
|
151
|
+
After using the +sys+ command quite often in the examples, I should
|
|
152
|
+
explain it a little bit. The +sys+ command can be used in three ways:
|
|
157
153
|
|
|
158
154
|
1. <b>File system operations</b>
|
|
159
155
|
|
|
160
|
-
The first form is with no arguments. It returns an object on which
|
|
161
|
-
can invoke the methods of the +FileUtils+ module that comes
|
|
156
|
+
The first form is with no arguments. It returns an object on which
|
|
157
|
+
you can invoke the methods of the +FileUtils+ module that comes
|
|
158
|
+
with ruby.
|
|
162
159
|
Examples are:
|
|
163
160
|
sys.rm "file1", "file2", ... # remove files
|
|
164
161
|
sys.cp "src", "dest" # copy from "src" do "dest"
|
|
@@ -174,7 +171,7 @@ explain it a little bit. The +sys+ function can be used in three ways:
|
|
|
174
171
|
|
|
175
172
|
2. <b>Running external commands</b>
|
|
176
173
|
|
|
177
|
-
Invoke the +sys+
|
|
174
|
+
Invoke the +sys+ command with a string as argument to run a shell:
|
|
178
175
|
sys "echo *.c"
|
|
179
176
|
will print a list of C files to stdout.
|
|
180
177
|
|
|
@@ -183,6 +180,28 @@ explain it a little bit. The +sys+ function can be used in three ways:
|
|
|
183
180
|
sys "echo", "*.c"
|
|
184
181
|
will print "*.c" to stdout.
|
|
185
182
|
|
|
183
|
+
When the external program returns with an exit code other than 0,
|
|
184
|
+
Rant will abort with an error message. Sometimes this is not
|
|
185
|
+
desirable. E.g. the +diff+, which compares two files, returns 0 if
|
|
186
|
+
the files are equal, 1 if have differences and something else if an
|
|
187
|
+
error occurs. Rant allows you to handle/ignore the exit code of a
|
|
188
|
+
program yourself. Example:
|
|
189
|
+
|
|
190
|
+
task :diff do |t|
|
|
191
|
+
sys "diff -u a/util.c b/util.c > util.diff" do |ps|
|
|
192
|
+
# ps is an instance of Process::Status
|
|
193
|
+
case ps.exitstatus
|
|
194
|
+
when 0:
|
|
195
|
+
puts "a/util.c and b/util.c are equal"
|
|
196
|
+
when 1:
|
|
197
|
+
puts "a/util.c and b/util.c are not equal"
|
|
198
|
+
else
|
|
199
|
+
t.fail "diff error"
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
|
|
186
205
|
3. <b>Selecting files</b>
|
|
187
206
|
|
|
188
207
|
To select files with the help of glob patterns use +sys+ with the
|
|
@@ -401,11 +420,15 @@ Rantfile. Simply put a +subdirs+ command into the src/Rantfile. Rant
|
|
|
401
420
|
integrates well into your file system :)
|
|
402
421
|
|
|
403
422
|
If you want to refer to a task in the main Rantfile from a subdir
|
|
404
|
-
Rantfile, put a
|
|
405
|
-
task "a" => "
|
|
423
|
+
Rantfile, put a <tt>@</tt> in front of the task name:
|
|
424
|
+
task "a" => "@b"
|
|
406
425
|
But note that this Rantfile won't work as a standalone buildfile,
|
|
407
426
|
because it refers to a main Rantfile.
|
|
408
427
|
|
|
428
|
+
For further documentation about managing build files in project
|
|
429
|
+
subdirectories, read
|
|
430
|
+
doc/subdirs.rdoc[link:files/doc/subdirs_rdoc.html].
|
|
431
|
+
|
|
409
432
|
== See also
|
|
410
433
|
|
|
411
434
|
Advanced Rantfiles::
|
data/doc/subdirs.rdoc
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
|
|
2
|
+
== Buildfiles in subdirectories
|
|
3
|
+
|
|
4
|
+
When a software project grows, it is often desired to split the build
|
|
5
|
+
file up and create multiple buildfiles, e.g. one per directory. Rant
|
|
6
|
+
has support for this case built in (unlike make). Part of this support
|
|
7
|
+
is the +subdirs+ command which is described in
|
|
8
|
+
doc/rantfile.rdoc[link:files/doc/rantfile_rdoc.html]. This section
|
|
9
|
+
will describe one possible technique.
|
|
10
|
+
|
|
11
|
+
First, a project needs to have a so called "root Rantfile". This file
|
|
12
|
+
lives in the top directory of the project and is called +Rantfile+ or
|
|
13
|
+
<tt>root.rant</tt>. Each subdirectory which needs specialized tasks,
|
|
14
|
+
has a buildfile called <tt>sub.rant</tt>.
|
|
15
|
+
|
|
16
|
+
A simple example would be a Ruby project where the test task(s) are
|
|
17
|
+
defined in a seperate buildfile in the +test+ directory. The
|
|
18
|
+
directory structure could look like:
|
|
19
|
+
|
|
20
|
+
rubyproject/
|
|
21
|
+
README
|
|
22
|
+
root.rant
|
|
23
|
+
bin/
|
|
24
|
+
... some scripts
|
|
25
|
+
lib/
|
|
26
|
+
... ruby library scripts
|
|
27
|
+
test/
|
|
28
|
+
sub.rant
|
|
29
|
+
tc_reader.rb
|
|
30
|
+
tc_writer.rb
|
|
31
|
+
tc_filter.rb
|
|
32
|
+
tc_metautils.rb
|
|
33
|
+
|
|
34
|
+
The project has one <tt>root.rant</tt> file and any number of
|
|
35
|
+
<tt>sub.rant</tt> files (in this case only one). In root.rant we
|
|
36
|
+
define tasks for packaging, installation, cleanup, etc. and in the
|
|
37
|
+
test/sub.rant file we define tasks that run unit tests.
|
|
38
|
+
|
|
39
|
+
<tt>root.rant</tt> could look like:
|
|
40
|
+
|
|
41
|
+
import "md5" # use MD5 checksums instead of timestamps, optional
|
|
42
|
+
import "rubypackage", "rubydoc", "autoclean"
|
|
43
|
+
|
|
44
|
+
# reference the "all" task defined in test/sub.rant
|
|
45
|
+
task :default => "test/all"
|
|
46
|
+
|
|
47
|
+
desc "Create package for distribution."
|
|
48
|
+
gen RubyPackage, "foo" do |t|
|
|
49
|
+
t.version = "1.0.1"
|
|
50
|
+
t.summary = "Foo is a ruby library and program for ..."
|
|
51
|
+
t.files = sys["bin/*", "lib/**/*.rb", "test/tc_*.rb", "**/*.rant"].shun("pkg")
|
|
52
|
+
t.package_task
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
desc "Generate HTML docs."
|
|
56
|
+
gen RubyDoc
|
|
57
|
+
|
|
58
|
+
desc "Remove generated files and directories."
|
|
59
|
+
gen AutoClean, :clobber
|
|
60
|
+
|
|
61
|
+
# read test/sub.rant
|
|
62
|
+
subdirs "test"
|
|
63
|
+
|
|
64
|
+
and <tt>test/sub.rant</tt> contains:
|
|
65
|
+
|
|
66
|
+
desc "Run all unit tests."
|
|
67
|
+
task :all do
|
|
68
|
+
sys "testrb", sys["tc_*.rb"]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
desc "Run IO related unit tests."
|
|
72
|
+
task :io do
|
|
73
|
+
sys "testrb tc_reader.rb tc_writer.rb"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
desc "Test internals."
|
|
77
|
+
task :internals do
|
|
78
|
+
sys "testrb tc_filter.rb tc_metautils.rb"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
Now we run from the shell:
|
|
82
|
+
|
|
83
|
+
First let rant list all public tasks:
|
|
84
|
+
|
|
85
|
+
<rubyproject> $ rant -T
|
|
86
|
+
rant # => test/all
|
|
87
|
+
rant package # Create package for distribution.
|
|
88
|
+
rant doc # Generate HTML docs.
|
|
89
|
+
rant clobber # Remove generated files and directories.
|
|
90
|
+
rant test/all # Run all unit tests.
|
|
91
|
+
rant test/io # Run IO related unit tests.
|
|
92
|
+
rant test/internals # Test internals.
|
|
93
|
+
|
|
94
|
+
We see that if we run rant without arguments, it will run the test/all
|
|
95
|
+
task.
|
|
96
|
+
|
|
97
|
+
Change to the test directory:
|
|
98
|
+
|
|
99
|
+
<rubyproject> $ cd test
|
|
100
|
+
<test> $ rant -T
|
|
101
|
+
(root is /home/stefan/Ruby/misc/rant/rbtest, in test)
|
|
102
|
+
rant all # Run all unit tests.
|
|
103
|
+
rant io # Run IO related unit tests.
|
|
104
|
+
rant internals # Test internals.
|
|
105
|
+
rant @package # Create package for distribution.
|
|
106
|
+
rant @doc # Generate HTML docs.
|
|
107
|
+
rant @clobber # Remove generated files and directories.
|
|
108
|
+
|
|
109
|
+
If rant is started from a directory with a sub.rant file, it searches
|
|
110
|
+
upwards in the directory tree until it finds a file called +Rantfile+
|
|
111
|
+
or <tt>root.rant</tt>. This file will be read first, the directory
|
|
112
|
+
which contains this file is viewed as the projects root directory.
|
|
113
|
+
Then it ensures that the sub.rant file in the current directory is
|
|
114
|
+
read and starts operating. Task names given on the commandline are
|
|
115
|
+
interpreted relative to the current directory. Tasks defined in other
|
|
116
|
+
directories can be referenced by prepending them with an <tt>@</tt>
|
|
117
|
+
character.
|
|
118
|
+
|
|
119
|
+
To run the IO related tests from the test directory we type:
|
|
120
|
+
|
|
121
|
+
<test> $ rant io
|
|
122
|
+
(root is /home/stefan/Ruby/misc/rant/rbtest, in test)
|
|
123
|
+
testrb tc_reader.rb tc_writer.rb
|
|
124
|
+
... output of testrb ...
|
|
125
|
+
|
|
126
|
+
To run the clobber task from the test directory:
|
|
127
|
+
|
|
128
|
+
<test> $ rant @clobber
|
|
129
|
+
(root is /home/stefan/Ruby/misc/rant/rbtest, in test)
|
|
130
|
+
(in /home/stefan/Ruby/misc/rant/rbtest)
|
|
131
|
+
rm -f ...
|
|
132
|
+
... more output ...
|
|
133
|
+
|
|
134
|
+
== See also
|
|
135
|
+
|
|
136
|
+
Rantfile basics::
|
|
137
|
+
doc/rantfile.rdoc[link:files/doc/rantfile_rdoc.html]
|
|
138
|
+
Advanced Rantfiles::
|
|
139
|
+
doc/advanced.rdoc[link:files/doc/advanced_rdoc.html]
|
|
140
|
+
Support for C/C++::
|
|
141
|
+
doc/c.rdoc[link:files/doc/c_rdoc.html]
|
|
142
|
+
Packaging::
|
|
143
|
+
doc/package.rdoc[link:files/doc/package_rdoc.html]
|
|
144
|
+
Ruby project howto::
|
|
145
|
+
doc/rubyproject.rdoc[link:files/doc/rubyproject_rdoc.html]
|
|
146
|
+
Rant Overview::
|
|
147
|
+
README[link:files/README.html]
|