* lib/rake/*: Updated to rake 0.9.6

* doc/rake/*:  ditto
* test/rake/*:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2012-12-21 02:34:37 +00:00
parent 7764dd9357
commit 4f7a6aafa5
20 changed files with 917 additions and 91 deletions

View File

@ -1,3 +1,9 @@
Fri Dec 21 11:31:02 2012 Eric Hodel <drbrain@segment7.net>
* lib/rake/*: Updated to rake 0.9.6
* doc/rake/*: ditto
* test/rake/*: ditto
Fri Dec 21 08:56:34 2012 Masaya Tarui <tarui@ruby-lang.org> Fri Dec 21 08:56:34 2012 Masaya Tarui <tarui@ruby-lang.org>
* vm_trace.c (rb_suppress_tracing): remove unused variable 'vm_tracing' * vm_trace.c (rb_suppress_tracing): remove unused variable 'vm_tracing'

View File

@ -2,14 +2,26 @@
Rake is invoked from the command line using: Rake is invoked from the command line using:
% rake [<em>options</em> ...] [<em>VAR</em>=<em>VALUE</em>] [<em>targets</em> ...] % rake [options ...] [VAR=VALUE ...] [targets ...]
Options are: Options are:
[<tt><em>name</em>=<em>value</em></tt>] [<tt><em>name</em>=<em>value</em></tt>]
Set the environment variable <em>name</em> to <em>value</em> Set the environment variable <em>name</em> to <em>value</em>
during the execution of the <b>rake</b> command. You can access during the execution of the <b>rake</b> command. You can access
the value by using ENV['<em>name</em>']. the value by using ENV['<em>name</em>'].
[<tt>--all</tt> (-A)]
Used in combination with the -T and -D options, will force
those options to show all the tasks, even the ones without comments.
[<tt>--backtrace</tt>{=_output_} (-n)]
Enable a full backtrace (i.e. like --trace, but without the task
tracing details). The _output_ parameter is optional, but if
specified it controls where the backtrace output is sent. If
_output_ is <tt>stdout</tt>, then backtrace output is directed to
stardard output. If _output_ is <tt>stderr</tt>, or if it is
missing, then the backtrace output is sent to standard error.
[<tt>--classic-namespace</tt> (-n)] [<tt>--classic-namespace</tt> (-n)]
Import the Task, FileTask, and FileCreateTask into the top-level Import the Task, FileTask, and FileCreateTask into the top-level
@ -18,6 +30,11 @@ Options are:
'rake/classic_namespace'</code> in your Rakefile to get the 'rake/classic_namespace'</code> in your Rakefile to get the
classic behavior. classic behavior.
[<tt>--comments</tt>]
Used in combination with the -W options to force the output to
contain commented options only. This is the reverse of
<tt>--all</tt>.
[<tt>--describe</tt> _pattern_ (-D)] [<tt>--describe</tt> _pattern_ (-D)]
Describe the tasks (matching optional PATTERN), then exit. Describe the tasks (matching optional PATTERN), then exit.
@ -31,15 +48,40 @@ Options are:
[<tt>--execute-print</tt> _code_ (-p)] [<tt>--execute-print</tt> _code_ (-p)]
Execute some Ruby code, print the result, and exit. Execute some Ruby code, print the result, and exit.
[<tt>--execute-continue</tt> _code_ (-p)] [<tt>--execute-continue</tt> _code_ (-E)]
Execute some Ruby code, then continue with normal task processing. Execute some Ruby code, then continue with normal task processing.
[<tt>--help</tt> (-H)] [<tt>--help</tt> (-H)]
Display some help text and exit. Display some help text and exit.
[<tt>--jobs</tt> _number_ (-j)]
Specifies the number of active concurrent tasks used. The
suggested value is equal to the number of CPUs. The concurrent
tasks are used to execute the <tt>multitask</tt> prerequisites.
Also see the <tt>-m</tt> option which turns all tasks into
multitasks.
Sample values:
(no -j) : unlimited concurrent tasks (standard rake behavior)
-j : 2 concurrent tasks (exact number may change)
-j 16 : 16 concurrent tasks
[<tt>--job-stats</tt> _level_]
Display job statistics at the completion of the run. By default,
this will display the requested number of active tasks (from the
-j options) and the maximum number of tasks in play at any given
time.
If the optional _level_ is <tt>history</tt>, then a complete trace
of task history will be displayed on standard output.
[<tt>--libdir</tt> _directory_ (-I)] [<tt>--libdir</tt> _directory_ (-I)]
Add _directory_ to the list of directories searched for require. Add _directory_ to the list of directories searched for require.
[<tt>--multitask</tt> (-m)]
Treat all tasks as multitasks. ('make/drake' semantics)
[<tt>--nosearch</tt> (-N)] [<tt>--nosearch</tt> (-N)]
Do not search for a Rakefile in parent directories. Do not search for a Rakefile in parent directories.
@ -60,6 +102,16 @@ Options are:
[<tt>--rakelibdir</tt> _rakelibdir_ (-R)] [<tt>--rakelibdir</tt> _rakelibdir_ (-R)]
Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib') Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')
[<tt>--reduce-compat</tt>]
Remove the DSL commands from the Object inheritance hierarchy and
do not define top level constants. This reduces the backwards
compatibility of Rake, but allows rake to be used with software
that would otherwise have conflicting definitions.
*NOTE:* The next major version of Rake will only be able to be run
in "reduce-compat" mode.
[<tt>--require</tt> _name_ (-r)] [<tt>--require</tt> _name_ (-r)]
Require _name_ before executing the Rakefile. Require _name_ before executing the Rakefile.
@ -69,6 +121,11 @@ Options are:
[<tt>--silent (-s)</tt>] [<tt>--silent (-s)</tt>]
Like --quiet, but also suppresses the 'in directory' announcement. Like --quiet, but also suppresses the 'in directory' announcement.
[<tt>--suppress-backtrace _pattern_ </tt>]
Line matching the regular expression _pattern_ will be removed
from the backtrace output. Note that the --backtrace option is the
full backtrace without these lines suppressed.
[<tt>--system</tt> (-g)] [<tt>--system</tt> (-g)]
Use the system wide (global) rakefiles. The project Rakefile is Use the system wide (global) rakefiles. The project Rakefile is
ignored. By default, the system wide rakefiles are used only if no ignored. By default, the system wide rakefiles are used only if no
@ -80,16 +137,18 @@ Options are:
Use the project level Rakefile, ignoring the system-wide (global) Use the project level Rakefile, ignoring the system-wide (global)
rakefiles. rakefiles.
[<tt>--tasks</tt> (-T)] [<tt>--tasks</tt> <em>pattern</em> (-T)]
Display a list of the major tasks and their comments. Comments Display a list of the major tasks and their comments. Comments
are defined using the "desc" command. are defined using the "desc" command. If a pattern is given, then
only tasks matching the pattern are displayed.
[<tt>--trace</tt> (-t)] [<tt>--trace</tt>{=_output_} (-t)]
Turn on invoke/execute tracing. Also enable full backtrace on Turn on invoke/execute tracing. Also enable full backtrace on
errors. errors. The _output_ parameter is optional, but if specified it
controls where the trace output is sent. If _output_ is
[<tt>--usage</tt> (-h)] <tt>stdout</tt>, then trace output is directed to stardard output.
Display a usage message and exit. If _output_ is <tt>stderr</tt>, or if it is missing, then trace
output is sent to standard error.
[<tt>--verbose</tt> (-v)] [<tt>--verbose</tt> (-v)]
Echo the Sys commands to standard output. Echo the Sys commands to standard output.
@ -97,6 +156,14 @@ Options are:
[<tt>--version</tt> (-V)] [<tt>--version</tt> (-V)]
Display the program version and exit. Display the program version and exit.
[<tt>--where</tt> <em>pattern</em> (-W)]
Display tasks that match <em>pattern</em> and the file and line
number where the task is defined. By default this option will
display all tasks, not just the tasks that have descriptions.
[<tt>--no-deprecation-warnings</tt> (-W)]
Do not display the deprecation warnings.
In addition, any command line option of the form In addition, any command line option of the form
<em>VAR</em>=<em>VALUE</em> will be added to the environment hash <em>VAR</em>=<em>VALUE</em> will be added to the environment hash
<tt>ENV</tt> and may be tested in the Rakefile. <tt>ENV</tt> and may be tested in the Rakefile.

View File

@ -37,9 +37,9 @@
not needed. This may change in the future. not needed. This may change in the future.
[<b>prerequisites</b>] [<b>prerequisites</b>]
Every task has a set (possiblity empty) of prerequisites. A Every task has a set (possibly empty) of prerequisites. A
prerequisite P to Task T is itself a task that must be invoked prerequisite P to Task T is itself a task that must be invoked
before Task T. before Task T.
[<b>rule</b>] [<b>rule</b>]
A rule is a recipe for synthesizing a task when no task is A rule is a recipe for synthesizing a task when no task is

View File

@ -4,54 +4,54 @@ This is the original 100 line prototype rake program.
--- ---
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'ftools' require 'ftools'
class Task class Task
TASKS = Hash.new TASKS = Hash.new
attr_reader :prerequisites attr_reader :prerequisites
def initialize(task_name) def initialize(task_name)
@name = task_name @name = task_name
@prerequisites = [] @prerequisites = []
@actions = [] @actions = []
end end
def enhance(deps=nil, &block) def enhance(deps=nil, &block)
@prerequisites |= deps if deps @prerequisites |= deps if deps
@actions << block if block_given? @actions << block if block_given?
self self
end end
def name def name
@name.to_s @name.to_s
end end
def invoke def invoke
@prerequisites.each { |n| Task[n].invoke } @prerequisites.each { |n| Task[n].invoke }
execute if needed? execute if needed?
end end
def execute def execute
return if @triggered return if @triggered
@triggered = true @triggered = true
@actions.collect { |act| result = act.call(self) }.last @actions.collect { |act| result = act.call(self) }.last
end end
def needed? def needed?
true true
end end
def timestamp def timestamp
Time.now Time.now
end end
class << self class << self
def [](task_name) def [](task_name)
TASKS[intern(task_name)] or fail "Don't know how to rake #{task_name}" TASKS[intern(task_name)] or fail "Don't know how to rake #{task_name}"
end end
def define_task(args, &block) def define_task(args, &block)
case args case args
when Hash when Hash
@ -66,18 +66,18 @@ This is the original 100 line prototype rake program.
deps = deps.collect {|d| intern(d) } deps = deps.collect {|d| intern(d) }
get(task_name).enhance(deps, &block) get(task_name).enhance(deps, &block)
end end
def get(task_name) def get(task_name)
name = intern(task_name) name = intern(task_name)
TASKS[name] ||= self.new(name) TASKS[name] ||= self.new(name)
end end
def intern(task_name) def intern(task_name)
(Symbol === task_name) ? task_name : task_name.intern (Symbol === task_name) ? task_name : task_name.intern
end end
end end
end end
class FileTask < Task class FileTask < Task
def needed? def needed?
return true unless File.exist?(name) return true unless File.exist?(name)
@ -85,25 +85,25 @@ This is the original 100 line prototype rake program.
return false if latest_prereq.nil? return false if latest_prereq.nil?
timestamp < latest_prereq timestamp < latest_prereq
end end
def timestamp def timestamp
File.new(name.to_s).mtime File.new(name.to_s).mtime
end end
end end
def task(args, &block) def task(args, &block)
Task.define_task(args, &block) Task.define_task(args, &block)
end end
def file(args, &block) def file(args, &block)
FileTask.define_task(args, &block) FileTask.define_task(args, &block)
end end
def sys(cmd) def sys(cmd)
puts cmd puts cmd
system(cmd) or fail "Command Failed: [#{cmd}]" system(cmd) or fail "Command Failed: [#{cmd}]"
end end
def rake def rake
begin begin
here = Dir.pwd here = Dir.pwd
@ -119,9 +119,9 @@ This is the original 100 line prototype rake program.
rescue Exception => ex rescue Exception => ex
puts "rake aborted ... #{ex.message}" puts "rake aborted ... #{ex.message}"
puts ex.backtrace.find {|str| str =~ /Rakefile/ } || "" puts ex.backtrace.find {|str| str =~ /Rakefile/ } || ""
end end
end end
if __FILE__ == $0 then if __FILE__ == $0 then
rake rake
end end

View File

@ -1,4 +1,4 @@
= Rakefile Format (as of version 0.8.3) = Rakefile Format (as of version 0.8.7)
First of all, there is no special format for a Rakefile. A Rakefile First of all, there is no special format for a Rakefile. A Rakefile
contains executable Ruby code. Anything legal in a ruby script is contains executable Ruby code. Anything legal in a ruby script is
@ -27,7 +27,7 @@ parameter that is the name of the task.
=== Tasks with Prerequisites === Tasks with Prerequisites
Any prerequisites are given as a list (inclosed in square brackets) Any prerequisites are given as a list (enclosed in square brackets)
following the name and an arrow (=>). following the name and an arrow (=>).
task :name => [:prereq1, :prereq2] task :name => [:prereq1, :prereq2]
@ -45,7 +45,7 @@ following ...
Actions are defined by passing a block to the +task+ method. Any Ruby Actions are defined by passing a block to the +task+ method. Any Ruby
code can be placed in the block. The block may reference the task code can be placed in the block. The block may reference the task
object via the block paramter.. object via the block parameter.
task :name => [:prereq1, :prereq2] do |t| task :name => [:prereq1, :prereq2] do |t|
# actions (may reference t) # actions (may reference t)
@ -119,14 +119,14 @@ Rake allows parallel execution of prerequisites using the following syntax:
end end
In this example, +copy_files+ is a normal rake task. Its actions are In this example, +copy_files+ is a normal rake task. Its actions are
executed whereever all of its prerequisites are done. The big executed whenever all of its prerequisites are done. The big
difference is that the prerequisites (+copy_src+, +copy_bin+ and difference is that the prerequisites (+copy_src+, +copy_bin+ and
+copy_doc+) are executed in parallel. Each of the prerequisites are +copy_doc+) are executed in parallel. Each of the prerequisites are
run in their own Ruby thread, possibly allowing faster overall runtime. run in their own Ruby thread, possibly allowing faster overall runtime.
=== Secondary Prerequisites === Secondary Prerequisites
If any of the primary prerequites of a multitask have common secondary If any of the primary prerequisites of a multitask have common secondary
prerequisites, all of the primary/parallel prerequisites will wait prerequisites, all of the primary/parallel prerequisites will wait
until the common prerequisites have been run. until the common prerequisites have been run.
@ -183,6 +183,22 @@ argument string should be quoted. Something like this:
(Quoting rules vary between operating systems and shells, so make sure (Quoting rules vary between operating systems and shells, so make sure
you consult the proper docs for your OS/shell). you consult the proper docs for your OS/shell).
=== Tasks Arguments and the Environment
Task argument values can also be picked up from the environment. For
example, if the "release" task expected a parameter named
"release_version", then either
rake release[0.8.2]
or
RELEASE_VERSION rake release
will work. Environment variable names must either match the task
parameter exactly, or match an all-uppercase version of the task
parameter.
=== Tasks that Expect Parameters === Tasks that Expect Parameters
Parameters are only given to tasks that are setup to expect them. In Parameters are only given to tasks that are setup to expect them. In
@ -195,10 +211,10 @@ declared as:
task :name, [:first_name, :last_name] task :name, [:first_name, :last_name]
The first argument is still the name of the task (:name in this case). The first argument is still the name of the task (:name in this case).
The next to argumements are the names of the parameters expected by The next two arguments are the names of the parameters expected by
:name in an array (:first_name and :last_name in the example). :name in an array (:first_name and :last_name in the example).
To access the values of the paramters, the block defining the task To access the values of the parameters, the block defining the task
behaviour can now accept a second parameter: behaviour can now accept a second parameter:
task :name, [:first_name, :last_name] do |t, args| 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
task object. The second argument "args" is an open-struct like object task object. The second argument "args" is an open-struct like object
that allows access to the task arguments. Extra command line that allows access to the task arguments. Extra command line
arguments to a task are ignored. Missing command line arguments are arguments to a task are ignored. Missing command line arguments are
given the nil value. picked up from matching environment variables. If there are no
matching environment variables, they are given the nil value.
If you wish to specify default values for the arguments, you can use If you wish to specify default values for the arguments, you can use
the with_defaults method in the task body. Here is the above example the with_defaults method in the task body. Here is the above example
@ -239,11 +256,12 @@ for tasks with arguments. For example:
There is an older format for declaring task parameters that omitted There is an older format for declaring task parameters that omitted
the task argument array and used the :needs keyword to introduce the the task argument array and used the :needs keyword to introduce the
dependencies. That format is still supported for compatibility, but dependencies. That format is still supported for compatibility, but
is not recommended for use. is not recommended for use. The older format may be dropped in future
versions of rake.
== Accessing Task Programatically == Accessing Task Programmatically
Sometimes it is useful to manipulate tasks programatically in a Sometimes it is useful to manipulate tasks programmatically in a
Rakefile. To find a task object, use the <tt>:[]</tt> operator on the Rakefile. To find a task object, use the <tt>:[]</tt> operator on the
<tt>Rake::Task</tt>. <tt>Rake::Task</tt>.
@ -260,7 +278,7 @@ actions.
task :dont do task :dont do
Rake::Task[:doit].clear Rake::Task[:doit].clear
end end
Running this example: Running this example:
@ -269,7 +287,7 @@ Running this example:
DONE DONE
$ rake dont doit $ rake dont doit
(in /Users/jim/working/git/rake/x) (in /Users/jim/working/git/rake/x)
$ $
The ability to programmatically manipulate tasks gives rake very The ability to programmatically manipulate tasks gives rake very
powerful meta-programming capabilities w.r.t. task execution, but 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
create a task that builds "mycode.o" from "mycode.c". create a task that builds "mycode.o" from "mycode.c".
If the file "mycode.c" does not exist, rake will attempt If the file "mycode.c" does not exist, rake will attempt
to recursively synthesize a rule for it. to recursively synthesize a rule for it.
When a task is synthesized from a rule, the +source+ attribute of the When a task is synthesized from a rule, the +source+ attribute of the
task is set to the matching source file. This allows us to write 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.
proc {|task_name| task_name.sub(/\.[^.]+$/, '.c') } proc {|task_name| task_name.sub(/\.[^.]+$/, '.c') }
]) do |t| ]) do |t|
sh "cc #{t.source} -c -o #{t.name}" sh "cc #{t.source} -c -o #{t.name}"
end end
<b>NOTE:</b> Because of a _quirk_ in Ruby syntax, parenthesis are <b>NOTE:</b> Because of a _quirk_ in Ruby syntax, parenthesis are
required on *rule* when the first argument is a regular expression. required on *rule* when the first argument is a regular expression.
@ -322,7 +340,7 @@ The following rule might be used for Java files ...
rule '.java' => [ rule '.java' => [
proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') } proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') }
] do |t| ] do |t|
java_compile(t.source, t.name) java_compile(t.source, t.name)
end end
<b>NOTE:</b> +java_compile+ is a hypothetical method that invokes the <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
the time rake gets around to updating the dependencies file, it is too the time rake gets around to updating the dependencies file, it is too
late to load it. late to load it.
The +import+ command addresses this by specifying a file to be loaded The +Rake.import+ command addresses this by specifying a file to be
_after_ the main rakefile is loaded, but _before_ any targets on the loaded _after_ the main rakefile is loaded, but _before_ any targets
command line are specified. In addition, if the file name matches an on the command line are invoked. In addition, if the file name
explicit task, that task is invoked before loading the file. This matches an explicit task, that task is invoked before loading the
allows dependency files to be generated and used in a single rake file. This allows dependency files to be generated and used in a
command invocation. single rake command invocation.
<b>NOTE:</b> Starting in Rake version 0.9.0, the top level +import+
command is deprecated and we recommend using the scoped
"+Rake.import+" command mentioned above. Future versions of Rake will
drop support for the top level +import+ command.
=== Example: === Example:
@ -355,7 +378,7 @@ command invocation.
sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}" sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
end end
import ".depends.mf" Rake.import ".depends.mf"
If ".depends" does not exist, or is out of date w.r.t. the source If ".depends" does not exist, or is out of date w.r.t. the source
files, a new ".depends" file is generated using +makedepend+ before 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.
task :package => [ ... ] do ... end task :package => [ ... ] do ... end
The "-T" switch (or "--tasks" if you like to spell things out) will The "-T" switch (or "--tasks" if you like to spell things out) will
display a list of tasks that have a defined comment. If you use display a list of tasks that have a description. If you use +desc+ to
+desc+ to describe your major tasks, you have a semi-automatic way of describe your major tasks, you have a semi-automatic way of generating
generating a summary of your Rake file. a summary of your Rake file.
traken$ rake -T traken$ rake -T
(in /home/.../rake) (in /home/.../rake)
@ -403,12 +426,12 @@ common for task names to begin to clash. For example, if you might
have a main program and a set of sample programs built by a single have a main program and a set of sample programs built by a single
Rakefile. By placing the tasks related to the main program in one Rakefile. By placing the tasks related to the main program in one
namespace, and the tasks for building the sample programs in a namespace, and the tasks for building the sample programs in a
different namespace, the task names will not will not interfer with different namespace, the task names will not will not interfere with
each other. each other.
For example: For example:
namespace "main" namespace "main" do
task :build do task :build do
# Build the main program # Build the main program
end end
@ -429,7 +452,7 @@ Nested namespaces are supported, so
Note that the name given in the +task+ command is always the unadorned Note that the name given in the +task+ command is always the unadorned
task name without any namespace prefixes. The +task+ command always task name without any namespace prefixes. The +task+ command always
defines a task in the current namespace. defines a task in the current namespace.
=== FileTasks === FileTasks
@ -499,17 +522,17 @@ Or give it a glob pattern:
== Odds and Ends == Odds and Ends
=== do/end verses { } === do/end versus { }
Blocks may be specified with either a +do+/+end+ pair, or with curly Blocks may be specified with either a +do+/+end+ pair, or with curly
braces in Ruby. We _strongly_ recommend using +do+/+end+ to specify the braces in Ruby. We _strongly_ recommend using +do+/+end+ to specify the
actions for tasks and rules. Because the rakefile idiom tends to actions for tasks and rules. Because the rakefile idiom tends to
leave off parenthesis on the task/file/rule methods, unusual leave off parentheses on the task/file/rule methods, unusual
ambiguities can arise when using curly braces. ambiguities can arise when using curly braces.
For example, suppose that the method +object_files+ returns a list of For example, suppose that the method +object_files+ returns a list of
object files in a project. Now we use +object_files+ as the object files in a project. Now we use +object_files+ as the
prerequistes in a rule specified with actions in curly braces. prerequisites in a rule specified with actions in curly braces.
# DON'T DO THIS! # DON'T DO THIS!
file "prog" => object_files { file "prog" => object_files {
@ -531,4 +554,4 @@ This is the proper way to specify the task ...
== See == See
* README -- Main documentation for Rake. * README.rdoc -- Main documentation for Rake.

View File

@ -38,13 +38,13 @@ too much work. And that was the end of that!
... Except I couldn't get the thought out of my head. What exactly ... Except I couldn't get the thought out of my head. What exactly
would be needed to make the about syntax work as a make file? Hmmm, you would be needed to make the about syntax work as a make file? Hmmm, you
would need to register the tasks, you need some way of specifying would need to register the tasks, you need some way of specifying
dependencies between tasks, and some way of kicking off the process. dependencies between tasks, and some way of kicking off the process.
Hey! What if we did ... and fifteen minutes later I had a working Hey! What if we did ... and fifteen minutes later I had a working
prototype of Ruby make, complete with dependencies and actions. prototype of Ruby make, complete with dependencies and actions.
I showed the code to my coworker and we had a good laugh. It was just I showed the code to my coworker and we had a good laugh. It was just
about a page worth of code that reproduced an amazing amount of the about a page worth of code that reproduced an amazing amount of the
functionality of make. We were both truely stunned with the power of functionality of make. We were both truly stunned with the power of
Ruby. Ruby.
But it didn't do everything make did. In particular, it didn't have 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
pain to add and so Ruby Make would remain an interesting experiment. pain to add and so Ruby Make would remain an interesting experiment.
... Except as I walked back to my desk, I started thinking about what ... Except as I walked back to my desk, I started thinking about what
file based dependecies would really need. Rats! I was hooked again, file based dependencies would really need. Rats! I was hooked again,
and by adding a new class and two new methods, file/timestamp and by adding a new class and two new methods, file/timestamp
dependencies were implemented. dependencies were implemented.
@ -97,7 +97,7 @@ Here's another task with dependencies ...
end end
Task :clobber depends upon task :clean, so :clean will be run before Task :clobber depends upon task :clean, so :clean will be run before
:clobber is executed. :clobber is executed.
Files are specified by using the "file" command. It is similar to the Files are specified by using the "file" command. It is similar to the
task command, except that the task name represents a file, and the task 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
I normally specify file tasks with string (rather than symbols). Some I normally specify file tasks with string (rather than symbols). Some
file names can't be represented by symbols. Plus it makes the file names can't be represented by symbols. Plus it makes the
distinction between them more clear to the casual reader. distinction between them more clear to the casual reader.
Currently writing a task for each and every file in the project would be Currently writing a task for each and every file in the project would be
tedious at best. I envision a set of libraries to make this job tedious at best. I envision a set of libraries to make this job
@ -133,7 +133,7 @@ created for rake.
That's it. There's no documentation (other than whats in this That's it. There's no documentation (other than whats in this
message). Does this sound interesting to anyone? If so, I'll continue message). Does this sound interesting to anyone? If so, I'll continue
to clean it up and write it up and publish it on RAA. Otherwise, I'll to clean it up and write it up and publish it on RAA. Otherwise, I'll
leave it as an interesting excerise and a tribute to the power of Ruby. leave it as an interesting exercise and a tribute to the power of Ruby.
Why /might/ rake be interesting to Ruby programmers. I don't know, Why /might/ rake be interesting to Ruby programmers. I don't know,
perhaps ... perhaps ...

View File

@ -42,7 +42,7 @@ Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/ Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50 Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git GitHub:: git://github.com/jimweirich/rake.git
== Thanks == Thanks

View File

@ -0,0 +1,112 @@
= Rake 0.9.0 Released
Rake version 0.9.0 has a number of bug fixes and enhancments (see
below for more details). Additionally, the internals have be slightly
restructured and improved.
== Changes
=== New Features / Enhancements / Bug Fixes in Version 0.9.0
* Rake now warns when the deprecated :needs syntax used (and suggests
the proper syntax in the warning).
* Moved Rake DSL commands to top level ruby object 'main'. Rake DSL
commands are no longer private methods in Object. (Suggested by
James M. Lawrence/quix)
* Rake now uses case-insensitive comparisons to find the Rakefile on Windows.
Based on patch by Roger Pack.
* Rake now requires (instead of loads) files in the test task. Patch by Cezary
Baginski.
* Fixed typos. Patches by Sean Scot August Moon and R.T. Lechow.
* Rake now prints the Rakefile directory only when it's different from the
current directory. Patch by Alex Chaffee.
* Improved rakefile_location discovery on Windows. Patch by James Tucker.
* Rake now recognizes "Windows Server" as a windows system. Patch by Matthias
Lüdtke
* Rake::RDocTask is deprecated. Use RDoc::Task from RDoc 2.4.2+ (require
'rdoc/task')
* Rake::GemPackageTask is deprecated. Use Gem::PackageTask (require
'rubygems/package_task')
* Rake now outputs various messages to $stderr instead of $stdout.
* Rake no longer emits warnings for Config. Patch by Santiago Pastorino.
* Removed Rake's DSL methods from the top level scope. If you need to
call 'task :xzy' in your code, include Rake::DSL into your class, or
put the code in a Rake::DSL.environment do ... end block.
* Split rake.rb into individual files.
* Support for the --where (-W) flag for showing where a task is defined.
* Fixed quoting in test task.
(http://onestepback.org/redmine/issues/show/44,
http://www.pivotaltracker.com/story/show/1223138)
* Fixed the silent option parsing problem.
(http://onestepback.org/redmine/issues/show/47)
* Fixed :verbose=>false flag on sh and ruby commands.
* Rake command line options may be given by default in a RAKEOPT
environment variable.
* Errors in Rake will now display the task invocation chain in effect
at the time of the error.
* Accepted change by warnickr to not expand test patterns in shell
(allowing more files in the test suite).
* Fixed that file tasks did not perform prereq lookups in scope
(Redmine #57).
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* James M. Lawrence (quix)
* Roger Pack
* Cezary Baginski
* Sean Scot August Moon
* R.T. Lechow
* Alex Chaffee
* James Tucker
* Matthias Lüdtke
* Santiago Pastorino
Also, bit thanks to Eric Hodel for assisting with getting this release
out the door (where "assisting" includes, but is not by any means
limited to, "pushing" me to get it done).
-- Jim Weirich

View File

@ -0,0 +1,52 @@
= Rake 0.9.1 Released
Rake version 0.9.1 has a number of bug fixes and enhancments (see
below for more details). Additionally, the internals have be slightly
restructured and improved.
== Changes
Rake 0.9.1 adds back the global DSL methods, but with deprecation
messages. This allows Rake 0.9.1 to be used with older rakefiles with
warning messages.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* James M. Lawrence (quix)
* Roger Pack
* Cezary Baginski
* Sean Scot August Moon
* R.T. Lechow
* Alex Chaffee
* James Tucker
* Matthias Lüdtke
* Santiago Pastorino
Also, bit thanks to Eric Hodel for assisting with getting this release
out the door (where "assisting" includes, but is not by any means
limited to, "pushing" me to get it done).
-- Jim Weirich

View File

@ -0,0 +1,55 @@
= Rake 0.9.3 Released
Rake version 0.9.3 is mainly bug fixes.
== Changes
* The rake test loader now removes arguments it has processed. Issue #51
* Rake::TaskArguments now responds to #values_at
* RakeFileUtils.verbose_flag = nil silences output the same as 0.8.7
* Rake tests are now directory-independent
* Rake tests are no longer require flexmock
* Commands constant is no longer polluting top level namespace.
* Show only the interesting portion of the backtrace by default (James M. Lawrence).
* Added --reduce-compat option to remove backward compatible DSL hacks (James M. Lawrence).
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* James M. Lawrence (quix)
* Roger Pack
* Cezary Baginski
* Sean Scot August Moon
* R.T. Lechow
* Alex Chaffee
* James Tucker
* Matthias Lüdtke
* Santiago Pastorino
Also, bit thanks to Eric Hodel for assisting with getting this release
out the door (where "assisting" includes, but is not by any means
limited to, "pushing" me to get it done).
-- Jim Weirich

View File

@ -0,0 +1,49 @@
= Rake 0.9.2 Released
Rake version 0.9.2 has a few small fixes. See below for details.
== Changes
* Support for Ruby 1.8.6 was fixed.
* Global DSL warnings now honor --no-deprecate
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* James M. Lawrence (quix)
* Roger Pack
* Cezary Baginski
* Sean Scot August Moon
* R.T. Lechow
* Alex Chaffee
* James Tucker
* Matthias Lüdtke
* Santiago Pastorino
Also, bit thanks to Eric Hodel for assisting with getting this release
out the door (where "assisting" includes, but is not by any means
limited to, "pushing" me to get it done).
-- Jim Weirich

View File

@ -0,0 +1,102 @@
= Rake 0.9.3 Released
Rake version 0.9.3 contains some new, backwards compatible features and
a number of bug fixes.
== Changes
=== New Features
* Multitask tasks now use a thread pool. Use -j to limit the number of
available threads.
* Use -m to turn regular tasks into multitasks (use at your own risk).
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
programatically add rake task libraries.
* You can specific backtrace suppression patterns (see
--supress-backtrace)
* Directory tasks can now take prerequisites and actions
* Use --backtrace to request a full backtrace without the task trace.
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
output to standard output rather than standard error.
* Optional 'phony' target (enable with 'require 'rake/phony'") for
special purpose builds.
* Task#clear now clears task comments as well as actions and
prerequisites. Task#clear_comment will specifically target comments.
* The --all option will force -T and -D to consider all the tasks,
with and without descriptions.
=== Bug Fixes
* Semi-colons in windows rakefile paths now work.
* Improved Control-C support when invoking multiple test suites.
* egrep method now reads files in text mode (better support for
Windows)
* Better deprecation line number reporting.
* The -W option now works with all tasks, whether they have a
description or not.
* File globs in rake should not be sorted alphabetically, independent
of file system and platform.
* Numerous internal improvements.
* Documentation typos and fixes.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://github.com/jimweirich/rake
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* Aaron Patterson
* Dylan Smith
* Jo Liss
* Jonas Pfenniger
* Kazuki Tsujimoto
* Michael Bishop
* Michael Elufimov
* NAKAMURA Usaku
* Ryan Davis
* Sam Grönblom
* Sam Phippen
* Sergio Wong
* Tay Ray Chuan
* grosser
* quix
Also, many thanks to Eric Hodel for assisting with getting this release
out the door.
-- Jim Weirich

View File

@ -0,0 +1,110 @@
= Rake 0.9.4 Released
Rake version 0.9.4 contains a number of bug fixes.
== Changes
=== New Features (in 0.9.3)
* Multitask tasks now use a thread pool. Use -j to limit the number of
available threads.
* Use -m to turn regular tasks into multitasks (use at your own risk).
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
programatically add rake task libraries.
* You can specific backtrace suppression patterns (see
--supress-backtrace)
* Directory tasks can now take prerequisites and actions
* Use --backtrace to request a full backtrace without the task trace.
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
output to standard output rather than standard error.
* Optional 'phony' target (enable with 'require 'rake/phony'") for
special purpose builds.
* Task#clear now clears task comments as well as actions and
prerequisites. Task#clear_comment will specifically target comments.
* The --all option will force -T and -D to consider all the tasks,
with and without descriptions.
=== Bug Fixes (0.9.3)
* Semi-colons in windows rakefile paths now work.
* Improved Control-C support when invoking multiple test suites.
* egrep method now reads files in text mode (better support for
Windows)
* Better deprecation line number reporting.
* The -W option now works with all tasks, whether they have a
description or not.
* File globs in rake should not be sorted alphabetically, independent
of file system and platform.
* Numerous internal improvements.
* Documentation typos and fixes.
=== Bug Fixes (0.9.4)
* Exit status with failing tests is not correctly set to non-zero.
* Simplified syntax for phony task (for older versions of RDoc).
* Stand alone FileList usage gets glob function (without loading in
extra dependencies)
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://github.com/jimweirich/rake
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* Aaron Patterson
* Dylan Smith
* Jo Liss
* Jonas Pfenniger
* Kazuki Tsujimoto
* Michael Bishop
* Michael Elufimov
* NAKAMURA Usaku
* Ryan Davis
* Sam Grönblom
* Sam Phippen
* Sergio Wong
* Tay Ray Chuan
* grosser
* quix
Also, many thanks to Eric Hodel for assisting with getting this release
out the door.
-- Jim Weirich

View File

@ -0,0 +1,114 @@
= Rake 0.9.5 Released
Rake version 0.9.5 contains a number of bug fixes.
== Changes
=== New Features (in 0.9.3)
* Multitask tasks now use a thread pool. Use -j to limit the number of
available threads.
* Use -m to turn regular tasks into multitasks (use at your own risk).
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
programatically add rake task libraries.
* You can specific backtrace suppression patterns (see
--supress-backtrace)
* Directory tasks can now take prerequisites and actions
* Use --backtrace to request a full backtrace without the task trace.
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
output to standard output rather than standard error.
* Optional 'phony' target (enable with 'require 'rake/phony'") for
special purpose builds.
* Task#clear now clears task comments as well as actions and
prerequisites. Task#clear_comment will specifically target comments.
* The --all option will force -T and -D to consider all the tasks,
with and without descriptions.
=== Bug Fixes (0.9.3)
* Semi-colons in windows rakefile paths now work.
* Improved Control-C support when invoking multiple test suites.
* egrep method now reads files in text mode (better support for
Windows)
* Better deprecation line number reporting.
* The -W option now works with all tasks, whether they have a
description or not.
* File globs in rake should not be sorted alphabetically, independent
of file system and platform.
* Numerous internal improvements.
* Documentation typos and fixes.
=== Bug Fixes (0.9.4)
* Exit status with failing tests is not correctly set to non-zero.
* Simplified syntax for phony task (for older versions of RDoc).
* Stand alone FileList usage gets glob function (without loading in
extra dependencies)
=== Bug Fixes (0.9.5)
* --trace and --backtrace no longer swallow following task names.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://github.com/jimweirich/rake
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* Aaron Patterson
* Dylan Smith
* Jo Liss
* Jonas Pfenniger
* Kazuki Tsujimoto
* Michael Bishop
* Michael Elufimov
* NAKAMURA Usaku
* Ryan Davis
* Sam Grönblom
* Sam Phippen
* Sergio Wong
* Tay Ray Chuan
* grosser
* quix
Also, many thanks to Eric Hodel for assisting with getting this release
out the door.
-- Jim Weirich

View File

@ -0,0 +1,127 @@
= Rake 0.9.6 Released
Rake version 0.9.6 contains a number of fixes mainly for merging
Rake into the Ruby source tree and fixing tests.
== Changes
=== New Features (in 0.9.3)
* Multitask tasks now use a thread pool. Use -j to limit the number of
available threads.
* Use -m to turn regular tasks into multitasks (use at your own risk).
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
programatically add rake task libraries.
* You can specific backtrace suppression patterns (see
--supress-backtrace)
* Directory tasks can now take prerequisites and actions
* Use --backtrace to request a full backtrace without the task trace.
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
output to standard output rather than standard error.
* Optional 'phony' target (enable with 'require 'rake/phony'") for
special purpose builds.
* Task#clear now clears task comments as well as actions and
prerequisites. Task#clear_comment will specifically target comments.
* The --all option will force -T and -D to consider all the tasks,
with and without descriptions.
=== Bug Fixes (0.9.3)
* Semi-colons in windows rakefile paths now work.
* Improved Control-C support when invoking multiple test suites.
* egrep method now reads files in text mode (better support for
Windows)
* Better deprecation line number reporting.
* The -W option now works with all tasks, whether they have a
description or not.
* File globs in rake should not be sorted alphabetically, independent
of file system and platform.
* Numerous internal improvements.
* Documentation typos and fixes.
=== Bug Fixes (0.9.4)
* Exit status with failing tests is not correctly set to non-zero.
* Simplified syntax for phony task (for older versions of RDoc).
* Stand alone FileList usage gets glob function (without loading in
extra dependencies)
=== Bug Fixes (0.9.5)
* --trace and --backtrace no longer swallow following task names.
=== Bug Fixes (0.9.6)
* Better trace output when using a multi-threaded Rakefile.
* Arg parsing is now consistent for tasks and multitasks.
* Skip exit code test in versions of Ruby that don't support it well.
Changes for better integration with the Ruby source tree:
* Fix version literal for Ruby source tree build.
* Better loading of libraries for testing in Ruby build.
* Use the ruby version provided by Ruby's tests.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://github.com/jimweirich/rake
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
GitHub:: git://github.com/jimweirich/rake.git
== Thanks
As usual, it was input from users that drove a alot of these changes. The
following people either contributed patches, made suggestions or made
otherwise helpful comments. Thanks to ...
* Aaron Patterson
* Dylan Smith
* Jo Liss
* Jonas Pfenniger
* Kazuki Tsujimoto
* Michael Bishop
* Michael Elufimov
* NAKAMURA Usaku
* Ryan Davis
* Sam Grönblom
* Sam Phippen
* Sergio Wong
* Tay Ray Chuan
* grosser
* quix
Also, many thanks to Eric Hodel for assisting with getting this release
out the door.
-- Jim Weirich

View File

@ -1,5 +1,5 @@
module Rake module Rake
VERSION = '0.9.5' VERSION = '0.9.6'
module Version # :nodoc: all module Version # :nodoc: all
MAJOR, MINOR, BUILD, = Rake::VERSION.split '.' MAJOR, MINOR, BUILD, = Rake::VERSION.split '.'

View File

@ -43,7 +43,7 @@ class TestRakeDirectoryTask < Rake::TestCase
runlist = [] runlist = []
t1 = directory("a/b/c" => :t2) { |t| runlist << t.name } t1 = directory("a/b/c" => :t2) { |t| runlist << t.name }
t2 = task(:t2) { |t| runlist << t.name } task(:t2) { |t| runlist << t.name }
verbose(false) { verbose(false) {
t1.invoke t1.invoke

View File

@ -438,9 +438,10 @@ class TestRakeFunctional < Rake::TestCase
end end
def test_failing_test_sets_exit_status def test_failing_test_sets_exit_status
skip if uncertain_exit_status?
rakefile_failing_test_task rakefile_failing_test_task
rake rake
assert_equal 1, @exit.exitstatus assert @exit.exitstatus > 0, "should be non-zero"
end end
def test_stand_alone_filelist def test_stand_alone_filelist
@ -449,11 +450,19 @@ class TestRakeFunctional < Rake::TestCase
run_ruby @ruby_options + ["stand_alone_filelist.rb"] run_ruby @ruby_options + ["stand_alone_filelist.rb"]
assert_match(/^stand_alone_filelist\.rb$/, @out) assert_match(/^stand_alone_filelist\.rb$/, @out)
assert_equal 0, @exit.exitstatus assert_equal 0, @exit.exitstatus unless uncertain_exit_status?
end end
private private
# We are unable to accurately verify that Rake returns a proper
# error exit status using popen3 in Ruby 1.8.7 and JRuby. This
# predicate function can be used to skip tests or assertions as
# needed.
def uncertain_exit_status?
RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
end
# Run a shell Ruby command with command line options (using the # Run a shell Ruby command with command line options (using the
# default test options). Output is captured in @out and @err # default test options). Output is captured in @out and @err
def ruby(*option_list) def ruby(*option_list)
@ -474,9 +483,9 @@ class TestRakeFunctional < Rake::TestCase
inn, out, err, wait = Open3.popen3(RUBY, *option_list) inn, out, err, wait = Open3.popen3(RUBY, *option_list)
inn.close inn.close
@exit = wait ? wait.value : $?
@out = out.read @out = out.read
@err = err.read @err = err.read
@exit = wait.value
puts "OUTPUT: [#{@out}]" if @verbose puts "OUTPUT: [#{@out}]" if @verbose
puts "ERROR: [#{@err}]" if @verbose puts "ERROR: [#{@err}]" if @verbose

View File

@ -40,8 +40,8 @@ class TestRakeTask < Rake::TestCase
def test_invoke def test_invoke
runlist = [] runlist = []
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 } t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
t2 = task(:t2) { |t| runlist << t.name } task(:t2) { |t| runlist << t.name }
t3 = task(:t3) { |t| runlist << t.name } task(:t3) { |t| runlist << t.name }
assert_equal ["t2", "t3"], t1.prerequisites assert_equal ["t2", "t3"], t1.prerequisites
t1.invoke t1.invoke
assert_equal ["t2", "t3", "t1"], runlist assert_equal ["t2", "t3", "t1"], runlist
@ -88,8 +88,8 @@ class TestRakeTask < Rake::TestCase
def test_no_double_invoke def test_no_double_invoke
runlist = [] runlist = []
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 } t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
t2 = task(:t2 => [:t3]) { |t| runlist << t.name } task(:t2 => [:t3]) { |t| runlist << t.name }
t3 = task(:t3) { |t| runlist << t.name } task(:t3) { |t| runlist << t.name }
t1.invoke t1.invoke
assert_equal ["t3", "t2", "t1"], runlist assert_equal ["t3", "t2", "t1"], runlist
end end
@ -204,7 +204,7 @@ class TestRakeTask < Rake::TestCase
def test_prerequiste_tasks_fails_if_prerequisites_are_undefined def test_prerequiste_tasks_fails_if_prerequisites_are_undefined
a = task :a => ["b", "c"] a = task :a => ["b", "c"]
b = task :b task :b
assert_raises(RuntimeError) do assert_raises(RuntimeError) do
a.prerequisite_tasks a.prerequisite_tasks
end end
@ -223,8 +223,8 @@ class TestRakeTask < Rake::TestCase
def test_timestamp_returns_now_if_all_prereqs_have_no_times def test_timestamp_returns_now_if_all_prereqs_have_no_times
a = task :a => ["b", "c"] a = task :a => ["b", "c"]
b = task :b task :b
c = task :c task :c
assert_in_delta Time.now, a.timestamp, 0.1, 'computer too slow?' assert_in_delta Time.now, a.timestamp, 0.1, 'computer too slow?'
end end

View File

@ -45,7 +45,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
def test_illegal_keys_in_task_name_hash def test_illegal_keys_in_task_name_hash
ignore_deprecations do ignore_deprecations do
assert_raises RuntimeError do assert_raises RuntimeError do
t = task(:t, :x, :y => 1, :needs => [:pre]) task(:t, :x, :y => 1, :needs => [:pre])
end end
end end
end end
@ -136,14 +136,14 @@ class TestRakeTaskWithArguments < Rake::TestCase
def test_named_args_are_passed_to_prereqs def test_named_args_are_passed_to_prereqs
value = nil value = nil
pre = task(:pre, :rev) { |t, args| value = args.rev } task(:pre, :rev) { |t, args| value = args.rev }
t = task(:t, [:name, :rev] => [:pre]) t = task(:t, [:name, :rev] => [:pre])
t.invoke("bill", "1.2") t.invoke("bill", "1.2")
assert_equal "1.2", value assert_equal "1.2", value
end end
def test_args_not_passed_if_no_prereq_names_on_task def test_args_not_passed_if_no_prereq_names_on_task
pre = task(:pre) { |t, args| task(:pre) { |t, args|
assert_equal({}, args.to_hash) assert_equal({}, args.to_hash)
assert_equal "bill", args.name assert_equal "bill", args.name
} }
@ -152,7 +152,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
end end
def test_args_not_passed_if_no_prereq_names_on_multitask def test_args_not_passed_if_no_prereq_names_on_multitask
pre = task(:pre) { |t, args| task(:pre) { |t, args|
assert_equal({}, args.to_hash) assert_equal({}, args.to_hash)
assert_equal "bill", args.name assert_equal "bill", args.name
} }
@ -161,7 +161,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
end end
def test_args_not_passed_if_no_arg_names def test_args_not_passed_if_no_arg_names
pre = task(:pre, :rev) { |t, args| task(:pre, :rev) { |t, args|
assert_equal({}, args.to_hash) assert_equal({}, args.to_hash)
} }
t = task(:t => [:pre]) t = task(:t => [:pre])