rake 0.8.7 → 0.9.0
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/.gemtest +0 -0
- data/CHANGES +77 -9
- data/{README → README.rdoc} +14 -10
- data/Rakefile +129 -118
- data/TODO +1 -1
- data/doc/command_line_usage.rdoc +18 -6
- data/doc/glossary.rdoc +2 -2
- data/doc/jamis.rb +2 -2
- data/doc/proto_rake.rdoc +22 -22
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +55 -32
- data/doc/rational.rdoc +6 -6
- data/doc/release_notes/rake-0.4.15.rdoc +1 -1
- data/doc/release_notes/rake-0.5.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.2.rdoc +3 -3
- data/doc/release_notes/rake-0.7.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.0.rdoc +1 -1
- data/doc/release_notes/rake-0.8.2.rdoc +3 -3
- data/doc/release_notes/rake-0.8.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.4.rdoc +1 -1
- data/doc/release_notes/rake-0.8.5.rdoc +1 -1
- data/doc/release_notes/rake-0.8.6.rdoc +1 -1
- data/doc/release_notes/rake-0.8.7.rdoc +1 -1
- data/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/install.rb +14 -12
- data/lib/rake/alt_system.rb +7 -6
- data/lib/rake/application.rb +589 -0
- data/lib/rake/classic_namespace.rb +1 -0
- data/lib/rake/clean.rb +2 -4
- data/lib/rake/cloneable.rb +25 -0
- data/lib/rake/contrib/compositepublisher.rb +2 -5
- data/lib/rake/contrib/ftptools.rb +5 -8
- data/lib/rake/contrib/publisher.rb +2 -8
- data/lib/rake/contrib/rubyforgepublisher.rb +2 -4
- data/lib/rake/contrib/sshpublisher.rb +4 -6
- data/lib/rake/contrib/sys.rb +7 -25
- data/lib/rake/default_loader.rb +10 -0
- data/lib/rake/dsl.rb +2 -0
- data/lib/rake/dsl_definition.rb +143 -0
- data/lib/rake/early_time.rb +18 -0
- data/lib/rake/ext/core.rb +27 -0
- data/lib/rake/ext/module.rb +39 -0
- data/lib/rake/ext/string.rb +167 -0
- data/lib/rake/ext/time.rb +14 -0
- data/lib/rake/file_creation_task.rb +24 -0
- data/lib/rake/file_list.rb +403 -0
- data/lib/rake/file_task.rb +47 -0
- data/lib/rake/file_utils.rb +112 -0
- data/lib/rake/file_utils_ext.rb +142 -0
- data/lib/rake/gempackagetask.rb +6 -90
- data/lib/rake/invocation_chain.rb +51 -0
- data/lib/rake/invocation_exception_mixin.rb +16 -0
- data/lib/rake/loaders/makefile.rb +13 -15
- data/lib/rake/multi_task.rb +16 -0
- data/lib/rake/name_space.rb +25 -0
- data/lib/rake/packagetask.rb +13 -12
- data/lib/rake/pathmap.rb +1 -0
- data/lib/rake/pseudo_status.rb +24 -0
- data/lib/rake/rake_module.rb +29 -0
- data/lib/rake/rake_test_loader.rb +10 -2
- data/lib/rake/rdoctask.rb +211 -190
- data/lib/rake/ruby182_test_unit_fix.rb +9 -7
- data/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/lib/rake/runtest.rb +4 -6
- data/lib/rake/task.rb +327 -0
- data/lib/rake/task_argument_error.rb +7 -0
- data/lib/rake/task_arguments.rb +74 -0
- data/lib/rake/task_manager.rb +307 -0
- data/lib/rake/tasklib.rb +1 -2
- data/lib/rake/testtask.rb +57 -27
- data/lib/rake/version.rb +10 -0
- data/lib/rake/win32.rb +4 -4
- data/lib/rake.rb +29 -2470
- data/test/contrib/test_sys.rb +8 -31
- data/test/data/access/Rakefile +33 -0
- data/test/data/comments/Rakefile +18 -0
- data/test/data/default/Rakefile +1 -1
- data/test/data/deprecated_import/Rakefile +1 -0
- data/test/data/dryrun/Rakefile +1 -1
- data/test/data/file_creation_task/Rakefile +1 -1
- data/test/data/namespace/Rakefile +9 -0
- data/test/data/rakelib/test1.rb +1 -0
- data/test/data/verbose/Rakefile +34 -0
- data/test/{filecreation.rb → file_creation.rb} +11 -7
- data/test/functional/functional_test.rb +25 -0
- data/test/{session_functional.rb → functional/session_based_tests.rb} +141 -23
- data/test/in_environment.rb +7 -5
- data/test/{test_application.rb → lib/application_test.rb} +331 -143
- data/test/{test_clean.rb → lib/clean_test.rb} +1 -0
- data/test/{test_definitions.rb → lib/definitions_test.rb} +3 -3
- data/test/lib/dsl_test.rb +52 -0
- data/test/{test_earlytime.rb → lib/earlytime_test.rb} +1 -2
- data/test/{test_extension.rb → lib/extension_test.rb} +2 -2
- data/test/{test_file_creation_task.rb → lib/file_creation_task_test.rb} +1 -1
- data/test/{test_file_task.rb → lib/file_task_test.rb} +4 -4
- data/test/{test_filelist.rb → lib/filelist_test.rb} +38 -24
- data/test/{test_fileutils.rb → lib/fileutils_test.rb} +27 -22
- data/test/{test_multitask.rb → lib/multitask_test.rb} +14 -6
- data/test/lib/package_task_test.rb +82 -0
- data/test/{test_pathmap.rb → lib/pathmap_test.rb} +3 -2
- data/test/{test_rake.rb → lib/rake_test.rb} +1 -1
- data/test/{test_rdoc_task.rb → lib/rdoc_task_test.rb} +19 -23
- data/test/{test_require.rb → lib/require_test.rb} +8 -2
- data/test/{test_rules.rb → lib/rules_test.rb} +2 -3
- data/test/{test_task_arguments.rb → lib/task_arguments_test.rb} +5 -5
- data/test/{test_task_manager.rb → lib/task_manager_test.rb} +15 -5
- data/test/{test_tasks.rb → lib/task_test.rb} +84 -21
- data/test/{test_test_task.rb → lib/test_task_test.rb} +3 -3
- data/test/lib/testtask_test.rb +49 -0
- data/test/{test_top_level_functions.rb → lib/top_level_functions_test.rb} +5 -3
- data/test/{test_win32.rb → lib/win32_test.rb} +19 -0
- data/test/rake_test_setup.rb +5 -9
- data/test/ruby_version_test.rb +3 -0
- data/test/test_helper.rb +19 -0
- metadata +108 -49
- data/test/functional.rb +0 -15
- data/test/test_package_task.rb +0 -118
- /data/test/{test_ftp.rb → lib/ftp_test.rb} +0 -0
- /data/test/{test_invocation_chain.rb → lib/invocation_chain_test.rb} +0 -0
- /data/test/{test_makefile_loader.rb → lib/makefile_loader_test.rb} +0 -0
- /data/test/{test_namespace.rb → lib/namespace_test.rb} +0 -0
- /data/test/{test_pseudo_status.rb → lib/pseudo_status_test.rb} +0 -0
- /data/test/{test_tasklib.rb → lib/tasklib_test.rb} +0 -0
data/doc/command_line_usage.rdoc
CHANGED
|
@@ -9,7 +9,7 @@ Options are:
|
|
|
9
9
|
[<tt><em>name</em>=<em>value</em></tt>]
|
|
10
10
|
Set the environment variable <em>name</em> to <em>value</em>
|
|
11
11
|
during the execution of the <b>rake</b> command. You can access
|
|
12
|
-
the value by using ENV['<em>name</em>'].
|
|
12
|
+
the value by using ENV['<em>name</em>'].
|
|
13
13
|
|
|
14
14
|
[<tt>--classic-namespace</tt> (-n)]
|
|
15
15
|
Import the Task, FileTask, and FileCreateTask into the top-level
|
|
@@ -80,23 +80,35 @@ Options are:
|
|
|
80
80
|
Use the project level Rakefile, ignoring the system-wide (global)
|
|
81
81
|
rakefiles.
|
|
82
82
|
|
|
83
|
-
[<tt>--tasks</tt> (-T)]
|
|
83
|
+
[<tt>--tasks</tt> <em>pattern</em> (-T)]
|
|
84
84
|
Display a list of the major tasks and their comments. Comments
|
|
85
|
-
are defined using the "desc" command.
|
|
85
|
+
are defined using the "desc" command. If a pattern is given, then
|
|
86
|
+
only tasks matching the pattern are displayed.
|
|
87
|
+
|
|
88
|
+
[<tt>--no-top-level-dsl</tt> (-X)]
|
|
89
|
+
Do not put the Rake DSL commands into the top level scope.
|
|
90
|
+
|
|
91
|
+
[<tt>--top-level-dsl</tt>]
|
|
92
|
+
Put the Rake DSL commands into the top level scope (default).
|
|
93
|
+
|
|
94
|
+
NOTE: Although currently Rake defaults to its DSL in the top level
|
|
95
|
+
scope, the plan is to deprecate this in the future and default ot
|
|
96
|
+
having the DSL commands *not* appear in the top level scope.
|
|
86
97
|
|
|
87
98
|
[<tt>--trace</tt> (-t)]
|
|
88
99
|
Turn on invoke/execute tracing. Also enable full backtrace on
|
|
89
100
|
errors.
|
|
90
101
|
|
|
91
|
-
[<tt>--usage</tt> (-h)]
|
|
92
|
-
Display a usage message and exit.
|
|
93
|
-
|
|
94
102
|
[<tt>--verbose</tt> (-v)]
|
|
95
103
|
Echo the Sys commands to standard output.
|
|
96
104
|
|
|
97
105
|
[<tt>--version</tt> (-V)]
|
|
98
106
|
Display the program version and exit.
|
|
99
107
|
|
|
108
|
+
[<tt>--where</tt> <em>pattern</em> (-W)]
|
|
109
|
+
Display tasks that match <em>pattern</em> and the file and line
|
|
110
|
+
number where the task is defined.
|
|
111
|
+
|
|
100
112
|
In addition, any command line option of the form
|
|
101
113
|
<em>VAR</em>=<em>VALUE</em> will be added to the environment hash
|
|
102
114
|
<tt>ENV</tt> and may be tested in the Rakefile.
|
data/doc/glossary.rdoc
CHANGED
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
not needed. This may change in the future.
|
|
38
38
|
|
|
39
39
|
[<b>prerequisites</b>]
|
|
40
|
-
Every task has a set (
|
|
40
|
+
Every task has a set (possibly empty) of prerequisites. A
|
|
41
41
|
prerequisite P to Task T is itself a task that must be invoked
|
|
42
|
-
before Task T.
|
|
42
|
+
before Task T.
|
|
43
43
|
|
|
44
44
|
[<b>rule</b>]
|
|
45
45
|
A rule is a recipe for synthesizing a task when no task is
|
data/doc/jamis.rb
CHANGED
|
@@ -183,7 +183,7 @@ h3, h4, h5, h6 {
|
|
|
183
183
|
CSS
|
|
184
184
|
|
|
185
185
|
XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?>
|
|
186
|
-
<!DOCTYPE html
|
|
186
|
+
<!DOCTYPE html
|
|
187
187
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
188
188
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
189
189
|
}
|
|
@@ -510,7 +510,7 @@ FILE_INDEX = XHTML_PREAMBLE + <<HTML
|
|
|
510
510
|
<!--
|
|
511
511
|
body {
|
|
512
512
|
background-color: #EEE;
|
|
513
|
-
font-family: #{FONTS};
|
|
513
|
+
font-family: #{FONTS};
|
|
514
514
|
color: #000;
|
|
515
515
|
margin: 0px;
|
|
516
516
|
}
|
data/doc/proto_rake.rdoc
CHANGED
|
@@ -4,54 +4,54 @@ This is the original 100 line prototype rake program.
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
#!/usr/bin/env ruby
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
require 'ftools'
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
class Task
|
|
11
11
|
TASKS = Hash.new
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
attr_reader :prerequisites
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
def initialize(task_name)
|
|
16
16
|
@name = task_name
|
|
17
17
|
@prerequisites = []
|
|
18
18
|
@actions = []
|
|
19
19
|
end
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
def enhance(deps=nil, &block)
|
|
22
22
|
@prerequisites |= deps if deps
|
|
23
23
|
@actions << block if block_given?
|
|
24
24
|
self
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
def name
|
|
28
28
|
@name.to_s
|
|
29
29
|
end
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
def invoke
|
|
32
32
|
@prerequisites.each { |n| Task[n].invoke }
|
|
33
33
|
execute if needed?
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
def execute
|
|
37
37
|
return if @triggered
|
|
38
38
|
@triggered = true
|
|
39
39
|
@actions.collect { |act| result = act.call(self) }.last
|
|
40
40
|
end
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
def needed?
|
|
43
43
|
true
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
def timestamp
|
|
47
47
|
Time.now
|
|
48
48
|
end
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
class << self
|
|
51
51
|
def [](task_name)
|
|
52
52
|
TASKS[intern(task_name)] or fail "Don't know how to rake #{task_name}"
|
|
53
53
|
end
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
def define_task(args, &block)
|
|
56
56
|
case args
|
|
57
57
|
when Hash
|
|
@@ -66,18 +66,18 @@ This is the original 100 line prototype rake program.
|
|
|
66
66
|
deps = deps.collect {|d| intern(d) }
|
|
67
67
|
get(task_name).enhance(deps, &block)
|
|
68
68
|
end
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
def get(task_name)
|
|
71
71
|
name = intern(task_name)
|
|
72
72
|
TASKS[name] ||= self.new(name)
|
|
73
73
|
end
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
def intern(task_name)
|
|
76
76
|
(Symbol === task_name) ? task_name : task_name.intern
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
class FileTask < Task
|
|
82
82
|
def needed?
|
|
83
83
|
return true unless File.exist?(name)
|
|
@@ -85,25 +85,25 @@ This is the original 100 line prototype rake program.
|
|
|
85
85
|
return false if latest_prereq.nil?
|
|
86
86
|
timestamp < latest_prereq
|
|
87
87
|
end
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
def timestamp
|
|
90
90
|
File.new(name.to_s).mtime
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
def task(args, &block)
|
|
95
95
|
Task.define_task(args, &block)
|
|
96
96
|
end
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
def file(args, &block)
|
|
99
99
|
FileTask.define_task(args, &block)
|
|
100
100
|
end
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
def sys(cmd)
|
|
103
103
|
puts cmd
|
|
104
104
|
system(cmd) or fail "Command Failed: [#{cmd}]"
|
|
105
105
|
end
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
def rake
|
|
108
108
|
begin
|
|
109
109
|
here = Dir.pwd
|
|
@@ -119,9 +119,9 @@ This is the original 100 line prototype rake program.
|
|
|
119
119
|
rescue Exception => ex
|
|
120
120
|
puts "rake aborted ... #{ex.message}"
|
|
121
121
|
puts ex.backtrace.find {|str| str =~ /Rakefile/ } || ""
|
|
122
|
-
end
|
|
122
|
+
end
|
|
123
123
|
end
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
if __FILE__ == $0 then
|
|
126
126
|
rake
|
|
127
127
|
end
|
data/doc/rake.1.gz
CHANGED
|
Binary file
|
data/doc/rakefile.rdoc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
= Rakefile Format (as of version 0.8.
|
|
1
|
+
= Rakefile Format (as of version 0.8.7)
|
|
2
2
|
|
|
3
3
|
First of all, there is no special format for a Rakefile. A Rakefile
|
|
4
4
|
contains executable Ruby code. Anything legal in a ruby script is
|
|
@@ -27,7 +27,7 @@ parameter that is the name of the task.
|
|
|
27
27
|
|
|
28
28
|
=== Tasks with Prerequisites
|
|
29
29
|
|
|
30
|
-
Any prerequisites are given as a list (
|
|
30
|
+
Any prerequisites are given as a list (enclosed in square brackets)
|
|
31
31
|
following the name and an arrow (=>).
|
|
32
32
|
|
|
33
33
|
task :name => [:prereq1, :prereq2]
|
|
@@ -45,7 +45,7 @@ following ...
|
|
|
45
45
|
|
|
46
46
|
Actions are defined by passing a block to the +task+ method. Any Ruby
|
|
47
47
|
code can be placed in the block. The block may reference the task
|
|
48
|
-
object via the block
|
|
48
|
+
object via the block parameter.
|
|
49
49
|
|
|
50
50
|
task :name => [:prereq1, :prereq2] do |t|
|
|
51
51
|
# actions (may reference t)
|
|
@@ -119,14 +119,14 @@ Rake allows parallel execution of prerequisites using the following syntax:
|
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
In this example, +copy_files+ is a normal rake task. Its actions are
|
|
122
|
-
executed
|
|
122
|
+
executed whenever all of its prerequisites are done. The big
|
|
123
123
|
difference is that the prerequisites (+copy_src+, +copy_bin+ and
|
|
124
124
|
+copy_doc+) are executed in parallel. Each of the prerequisites are
|
|
125
125
|
run in their own Ruby thread, possibly allowing faster overall runtime.
|
|
126
126
|
|
|
127
127
|
=== Secondary Prerequisites
|
|
128
128
|
|
|
129
|
-
If any of the primary
|
|
129
|
+
If any of the primary prerequisites of a multitask have common secondary
|
|
130
130
|
prerequisites, all of the primary/parallel prerequisites will wait
|
|
131
131
|
until the common prerequisites have been run.
|
|
132
132
|
|
|
@@ -183,6 +183,22 @@ argument string should be quoted. Something like this:
|
|
|
183
183
|
(Quoting rules vary between operating systems and shells, so make sure
|
|
184
184
|
you consult the proper docs for your OS/shell).
|
|
185
185
|
|
|
186
|
+
=== Tasks Arguments and the Environment
|
|
187
|
+
|
|
188
|
+
Task argument values can also be picked up from the environment. For
|
|
189
|
+
example, if the "release" task expected a parameter named
|
|
190
|
+
"release_version", then either
|
|
191
|
+
|
|
192
|
+
rake release[0.8.2]
|
|
193
|
+
|
|
194
|
+
or
|
|
195
|
+
|
|
196
|
+
RELEASE_VERSION rake release
|
|
197
|
+
|
|
198
|
+
will work. Environment variable names must either match the task
|
|
199
|
+
parameter exactly, or match an all-uppercase version of the task
|
|
200
|
+
parameter.
|
|
201
|
+
|
|
186
202
|
=== Tasks that Expect Parameters
|
|
187
203
|
|
|
188
204
|
Parameters are only given to tasks that are setup to expect them. In
|
|
@@ -195,10 +211,10 @@ declared as:
|
|
|
195
211
|
task :name, [:first_name, :last_name]
|
|
196
212
|
|
|
197
213
|
The first argument is still the name of the task (:name in this case).
|
|
198
|
-
The next
|
|
214
|
+
The next two arguments are the names of the parameters expected by
|
|
199
215
|
:name in an array (:first_name and :last_name in the example).
|
|
200
216
|
|
|
201
|
-
To access the values of the
|
|
217
|
+
To access the values of the parameters, the block defining the task
|
|
202
218
|
behaviour can now accept a second parameter:
|
|
203
219
|
|
|
204
220
|
task :name, [:first_name, :last_name] do |t, args|
|
|
@@ -210,7 +226,8 @@ The first argument of the block "t" is always bound to the current
|
|
|
210
226
|
task object. The second argument "args" is an open-struct like object
|
|
211
227
|
that allows access to the task arguments. Extra command line
|
|
212
228
|
arguments to a task are ignored. Missing command line arguments are
|
|
213
|
-
|
|
229
|
+
picked up from matching environment variables. If there are no
|
|
230
|
+
matching environment variables, they are given the nil value.
|
|
214
231
|
|
|
215
232
|
If you wish to specify default values for the arguments, you can use
|
|
216
233
|
the with_defaults method in the task body. Here is the above example
|
|
@@ -239,11 +256,12 @@ for tasks with arguments. For example:
|
|
|
239
256
|
There is an older format for declaring task parameters that omitted
|
|
240
257
|
the task argument array and used the :needs keyword to introduce the
|
|
241
258
|
dependencies. That format is still supported for compatibility, but
|
|
242
|
-
is not recommended for use.
|
|
259
|
+
is not recommended for use. The older format may be dropped in future
|
|
260
|
+
versions of rake.
|
|
243
261
|
|
|
244
|
-
== Accessing Task
|
|
262
|
+
== Accessing Task Programmatically
|
|
245
263
|
|
|
246
|
-
Sometimes it is useful to manipulate tasks
|
|
264
|
+
Sometimes it is useful to manipulate tasks programmatically in a
|
|
247
265
|
Rakefile. To find a task object, use the <tt>:[]</tt> operator on the
|
|
248
266
|
<tt>Rake::Task</tt>.
|
|
249
267
|
|
|
@@ -260,7 +278,7 @@ actions.
|
|
|
260
278
|
|
|
261
279
|
task :dont do
|
|
262
280
|
Rake::Task[:doit].clear
|
|
263
|
-
end
|
|
281
|
+
end
|
|
264
282
|
|
|
265
283
|
Running this example:
|
|
266
284
|
|
|
@@ -269,7 +287,7 @@ Running this example:
|
|
|
269
287
|
DONE
|
|
270
288
|
$ rake dont doit
|
|
271
289
|
(in /Users/jim/working/git/rake/x)
|
|
272
|
-
$
|
|
290
|
+
$
|
|
273
291
|
|
|
274
292
|
The ability to programmatically manipulate tasks gives rake very
|
|
275
293
|
powerful meta-programming capabilities w.r.t. task execution, but
|
|
@@ -294,7 +312,7 @@ Rake is able to find a file named "mycode.c", it will automatically
|
|
|
294
312
|
create a task that builds "mycode.o" from "mycode.c".
|
|
295
313
|
|
|
296
314
|
If the file "mycode.c" does not exist, rake will attempt
|
|
297
|
-
to recursively synthesize a rule for it.
|
|
315
|
+
to recursively synthesize a rule for it.
|
|
298
316
|
|
|
299
317
|
When a task is synthesized from a rule, the +source+ attribute of the
|
|
300
318
|
task is set to the matching source file. This allows us to write
|
|
@@ -312,7 +330,7 @@ The following rule is equivalent to the example above.
|
|
|
312
330
|
proc {|task_name| task_name.sub(/\.[^.]+$/, '.c') }
|
|
313
331
|
]) do |t|
|
|
314
332
|
sh "cc #{t.source} -c -o #{t.name}"
|
|
315
|
-
end
|
|
333
|
+
end
|
|
316
334
|
|
|
317
335
|
<b>NOTE:</b> Because of a _quirk_ in Ruby syntax, parenthesis are
|
|
318
336
|
required on *rule* when the first argument is a regular expression.
|
|
@@ -322,7 +340,7 @@ The following rule might be used for Java files ...
|
|
|
322
340
|
rule '.java' => [
|
|
323
341
|
proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') }
|
|
324
342
|
] do |t|
|
|
325
|
-
java_compile(t.source, t.name)
|
|
343
|
+
java_compile(t.source, t.name)
|
|
326
344
|
end
|
|
327
345
|
|
|
328
346
|
<b>NOTE:</b> +java_compile+ is a hypothetical method that invokes the
|
|
@@ -340,12 +358,17 @@ invoked. This make generated dependency files difficult to use. By
|
|
|
340
358
|
the time rake gets around to updating the dependencies file, it is too
|
|
341
359
|
late to load it.
|
|
342
360
|
|
|
343
|
-
The +import+ command addresses this by specifying a file to be
|
|
344
|
-
_after_ the main rakefile is loaded, but _before_ any targets
|
|
345
|
-
command line are
|
|
346
|
-
explicit task, that task is invoked before loading the
|
|
347
|
-
allows dependency files to be generated and used in a
|
|
348
|
-
command invocation.
|
|
361
|
+
The +Rake.import+ command addresses this by specifying a file to be
|
|
362
|
+
loaded _after_ the main rakefile is loaded, but _before_ any targets
|
|
363
|
+
on the command line are invoked. In addition, if the file name
|
|
364
|
+
matches an explicit task, that task is invoked before loading the
|
|
365
|
+
file. This allows dependency files to be generated and used in a
|
|
366
|
+
single rake command invocation.
|
|
367
|
+
|
|
368
|
+
<b>NOTE:</b> Starting in Rake version 0.9.0, the top level +import+
|
|
369
|
+
command is deprecated and we recommend using the scoped
|
|
370
|
+
"+Rake.import+" command mentioned above. Future versions of Rake will
|
|
371
|
+
drop support for the top level +import+ command.
|
|
349
372
|
|
|
350
373
|
=== Example:
|
|
351
374
|
|
|
@@ -355,7 +378,7 @@ command invocation.
|
|
|
355
378
|
sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
|
|
356
379
|
end
|
|
357
380
|
|
|
358
|
-
import ".depends.mf"
|
|
381
|
+
Rake.import ".depends.mf"
|
|
359
382
|
|
|
360
383
|
If ".depends" does not exist, or is out of date w.r.t. the source
|
|
361
384
|
files, a new ".depends" file is generated using +makedepend+ before
|
|
@@ -374,9 +397,9 @@ then you need to use the +desc+ command to describe the task.
|
|
|
374
397
|
task :package => [ ... ] do ... end
|
|
375
398
|
|
|
376
399
|
The "-T" switch (or "--tasks" if you like to spell things out) will
|
|
377
|
-
display a list of tasks that have a
|
|
378
|
-
|
|
379
|
-
|
|
400
|
+
display a list of tasks that have a description. If you use +desc+ to
|
|
401
|
+
describe your major tasks, you have a semi-automatic way of generating
|
|
402
|
+
a summary of your Rake file.
|
|
380
403
|
|
|
381
404
|
traken$ rake -T
|
|
382
405
|
(in /home/.../rake)
|
|
@@ -403,7 +426,7 @@ common for task names to begin to clash. For example, if you might
|
|
|
403
426
|
have a main program and a set of sample programs built by a single
|
|
404
427
|
Rakefile. By placing the tasks related to the main program in one
|
|
405
428
|
namespace, and the tasks for building the sample programs in a
|
|
406
|
-
different namespace, the task names will not will not
|
|
429
|
+
different namespace, the task names will not will not interfere with
|
|
407
430
|
each other.
|
|
408
431
|
|
|
409
432
|
For example:
|
|
@@ -429,7 +452,7 @@ Nested namespaces are supported, so
|
|
|
429
452
|
|
|
430
453
|
Note that the name given in the +task+ command is always the unadorned
|
|
431
454
|
task name without any namespace prefixes. The +task+ command always
|
|
432
|
-
defines a task in the current namespace.
|
|
455
|
+
defines a task in the current namespace.
|
|
433
456
|
|
|
434
457
|
=== FileTasks
|
|
435
458
|
|
|
@@ -499,17 +522,17 @@ Or give it a glob pattern:
|
|
|
499
522
|
|
|
500
523
|
== Odds and Ends
|
|
501
524
|
|
|
502
|
-
=== do/end
|
|
525
|
+
=== do/end versus { }
|
|
503
526
|
|
|
504
527
|
Blocks may be specified with either a +do+/+end+ pair, or with curly
|
|
505
528
|
braces in Ruby. We _strongly_ recommend using +do+/+end+ to specify the
|
|
506
529
|
actions for tasks and rules. Because the rakefile idiom tends to
|
|
507
|
-
leave off
|
|
530
|
+
leave off parentheses on the task/file/rule methods, unusual
|
|
508
531
|
ambiguities can arise when using curly braces.
|
|
509
532
|
|
|
510
533
|
For example, suppose that the method +object_files+ returns a list of
|
|
511
534
|
object files in a project. Now we use +object_files+ as the
|
|
512
|
-
|
|
535
|
+
prerequisites in a rule specified with actions in curly braces.
|
|
513
536
|
|
|
514
537
|
# DON'T DO THIS!
|
|
515
538
|
file "prog" => object_files {
|
|
@@ -531,4 +554,4 @@ This is the proper way to specify the task ...
|
|
|
531
554
|
|
|
532
555
|
== See
|
|
533
556
|
|
|
534
|
-
* README -- Main documentation for Rake.
|
|
557
|
+
* README.rdoc -- Main documentation for Rake.
|
data/doc/rational.rdoc
CHANGED
|
@@ -38,13 +38,13 @@ too much work. And that was the end of that!
|
|
|
38
38
|
... Except I couldn't get the thought out of my head. What exactly
|
|
39
39
|
would be needed to make the about syntax work as a make file? Hmmm, you
|
|
40
40
|
would need to register the tasks, you need some way of specifying
|
|
41
|
-
dependencies between tasks, and some way of kicking off the process.
|
|
41
|
+
dependencies between tasks, and some way of kicking off the process.
|
|
42
42
|
Hey! What if we did ... and fifteen minutes later I had a working
|
|
43
43
|
prototype of Ruby make, complete with dependencies and actions.
|
|
44
44
|
|
|
45
45
|
I showed the code to my coworker and we had a good laugh. It was just
|
|
46
46
|
about a page worth of code that reproduced an amazing amount of the
|
|
47
|
-
functionality of make. We were both
|
|
47
|
+
functionality of make. We were both truly stunned with the power of
|
|
48
48
|
Ruby.
|
|
49
49
|
|
|
50
50
|
But it didn't do everything make did. In particular, it didn't have
|
|
@@ -53,7 +53,7 @@ prerequisite files have a later timestamp). Obviously THAT would be a
|
|
|
53
53
|
pain to add and so Ruby Make would remain an interesting experiment.
|
|
54
54
|
|
|
55
55
|
... Except as I walked back to my desk, I started thinking about what
|
|
56
|
-
file based
|
|
56
|
+
file based dependencies would really need. Rats! I was hooked again,
|
|
57
57
|
and by adding a new class and two new methods, file/timestamp
|
|
58
58
|
dependencies were implemented.
|
|
59
59
|
|
|
@@ -97,7 +97,7 @@ Here's another task with dependencies ...
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
Task :clobber depends upon task :clean, so :clean will be run before
|
|
100
|
-
:clobber is executed.
|
|
100
|
+
:clobber is executed.
|
|
101
101
|
|
|
102
102
|
Files are specified by using the "file" command. It is similar to the
|
|
103
103
|
task command, except that the task name represents a file, and the task
|
|
@@ -115,7 +115,7 @@ Here is a file based dependency that will compile "hello.cc" to
|
|
|
115
115
|
|
|
116
116
|
I normally specify file tasks with string (rather than symbols). Some
|
|
117
117
|
file names can't be represented by symbols. Plus it makes the
|
|
118
|
-
distinction between them more clear to the casual reader.
|
|
118
|
+
distinction between them more clear to the casual reader.
|
|
119
119
|
|
|
120
120
|
Currently writing a task for each and every file in the project would be
|
|
121
121
|
tedious at best. I envision a set of libraries to make this job
|
|
@@ -133,7 +133,7 @@ created for rake.
|
|
|
133
133
|
That's it. There's no documentation (other than whats in this
|
|
134
134
|
message). Does this sound interesting to anyone? If so, I'll continue
|
|
135
135
|
to clean it up and write it up and publish it on RAA. Otherwise, I'll
|
|
136
|
-
leave it as an interesting
|
|
136
|
+
leave it as an interesting exercise and a tribute to the power of Ruby.
|
|
137
137
|
|
|
138
138
|
Why /might/ rake be interesting to Ruby programmers. I don't know,
|
|
139
139
|
perhaps ...
|
|
@@ -24,7 +24,7 @@ Rake:
|
|
|
24
24
|
appliation instead of using its own data.
|
|
25
25
|
|
|
26
26
|
* Fixed the method name leak from FileUtils (bug found by Glenn
|
|
27
|
-
Vanderburg).
|
|
27
|
+
Vanderburg).
|
|
28
28
|
|
|
29
29
|
* Added test for noop, bad_option and verbose flags to sh command.
|
|
30
30
|
|
|
@@ -40,13 +40,13 @@ Rake:
|
|
|
40
40
|
The following new features are available in Rake version 0.7.2:
|
|
41
41
|
|
|
42
42
|
* Added square and curly bracket patterns to FileList#include (Tilman
|
|
43
|
-
Sauerbeck).
|
|
43
|
+
Sauerbeck).
|
|
44
44
|
|
|
45
45
|
* FileLists can now pass a block to FileList#exclude to exclude files
|
|
46
46
|
based on calculated values.
|
|
47
47
|
|
|
48
48
|
* Added plain filename support to rule dependents (suggested by Nobu
|
|
49
|
-
Nakada).
|
|
49
|
+
Nakada).
|
|
50
50
|
|
|
51
51
|
* Added pathmap support to rule dependents. In other words, if a
|
|
52
52
|
pathmap format (beginning with a '%') is given as a Rake rule
|
|
@@ -46,14 +46,14 @@ new features and numerous bug fixes.
|
|
|
46
46
|
|
|
47
47
|
* Fixed bug with rules involving multiple source, where only the first
|
|
48
48
|
dependency of a rule has any effect (Patch supplied by Emanuel
|
|
49
|
-
|
|
49
|
+
Indermühle)
|
|
50
50
|
|
|
51
51
|
* FileList#clone and FileList#dup have better sematics w.r.t. taint
|
|
52
52
|
and freeze.
|
|
53
53
|
|
|
54
54
|
* Changed from using Mutex to Monitor. Evidently Mutex causes thread
|
|
55
55
|
join errors when Ruby is compiled with -disable-pthreads. (Patch
|
|
56
|
-
supplied by Ittay Dror)
|
|
56
|
+
supplied by Ittay Dror)
|
|
57
57
|
|
|
58
58
|
* Fixed bug in makefile parser that had problems with extra spaces in
|
|
59
59
|
file task names. (Patch supplied by Ittay Dror)
|
|
@@ -157,7 +157,7 @@ otherwise helpful comments. Thanks to ...
|
|
|
157
157
|
* Gavin Stark
|
|
158
158
|
* Adam Q. Salter
|
|
159
159
|
* Adam Majer
|
|
160
|
-
* Emanuel
|
|
160
|
+
* Emanuel Indermühle
|
|
161
161
|
* Ittay Dror
|
|
162
162
|
* Bheeshmar Redheendran (for spending an afternoon with me debugging
|
|
163
163
|
windows issues)
|
|
@@ -12,7 +12,7 @@ Rake version 0.8.3 is a bug-fix release of rake.
|
|
|
12
12
|
directory.
|
|
13
13
|
|
|
14
14
|
* Added fix to handle ruby installations in directories with spaces in
|
|
15
|
-
their name.
|
|
15
|
+
their name.
|
|
16
16
|
|
|
17
17
|
== What is Rake
|
|
18
18
|
|
|
@@ -104,7 +104,7 @@ otherwise helpful comments. Thanks to ...
|
|
|
104
104
|
* Gavin Stark
|
|
105
105
|
* Adam Q. Salter
|
|
106
106
|
* Adam Majer
|
|
107
|
-
* Emanuel
|
|
107
|
+
* Emanuel Indermühle
|
|
108
108
|
* Ittay Dror
|
|
109
109
|
* Bheeshmar Redheendran (for spending an afternoon with me debugging
|
|
110
110
|
windows issues)
|
|
@@ -69,7 +69,7 @@ Otherwise, you can get it from the more traditional places:
|
|
|
69
69
|
|
|
70
70
|
Home Page:: http://rake.rubyforge.org/
|
|
71
71
|
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
|
72
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
|
72
|
+
GitHub:: git://github.com/jimweirich/rake.git
|
|
73
73
|
|
|
74
74
|
== Task Argument Examples
|
|
75
75
|
|
|
@@ -39,7 +39,7 @@ Otherwise, you can get it from the more traditional places:
|
|
|
39
39
|
|
|
40
40
|
Home Page:: http://rake.rubyforge.org/
|
|
41
41
|
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
|
42
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
|
42
|
+
GitHub:: git://github.com/jimweirich/rake.git
|
|
43
43
|
|
|
44
44
|
== Thanks
|
|
45
45
|
|
|
@@ -41,7 +41,7 @@ Otherwise, you can get it from the more traditional places:
|
|
|
41
41
|
|
|
42
42
|
Home Page:: http://rake.rubyforge.org/
|
|
43
43
|
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
|
44
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
|
44
|
+
GitHub:: git://github.com/jimweirich/rake.git
|
|
45
45
|
|
|
46
46
|
== Thanks
|
|
47
47
|
|
|
@@ -42,7 +42,7 @@ Otherwise, you can get it from the more traditional places:
|
|
|
42
42
|
|
|
43
43
|
Home Page:: http://rake.rubyforge.org/
|
|
44
44
|
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
|
45
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
|
45
|
+
GitHub:: git://github.com/jimweirich/rake.git
|
|
46
46
|
|
|
47
47
|
== Thanks
|
|
48
48
|
|