Skip to content

Commit

Permalink
* lib/rake/*: Updated to rake 0.9.6
Browse files Browse the repository at this point in the history
* doc/rake/*:  ditto
* test/rake/*:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
drbrain committed Dec 21, 2012
1 parent 7764dd9 commit 4f7a6aa
Show file tree
Hide file tree
Showing 20 changed files with 917 additions and 91 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -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>

* vm_trace.c (rb_suppress_tracing): remove unused variable 'vm_tracing'
Expand Down
87 changes: 77 additions & 10 deletions doc/rake/command_line_usage.rdoc
Expand Up @@ -2,14 +2,26 @@

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:

[<tt><em>name</em>=<em>value</em></tt>]
Set the environment variable <em>name</em> to <em>value</em>
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)]
Import the Task, FileTask, and FileCreateTask into the top-level
Expand All @@ -18,6 +30,11 @@ Options are:
'rake/classic_namespace'</code> in your Rakefile to get the
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)]
Describe the tasks (matching optional PATTERN), then exit.

Expand All @@ -31,15 +48,40 @@ Options are:
[<tt>--execute-print</tt> _code_ (-p)]
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.

[<tt>--help</tt> (-H)]
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)]
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)]
Do not search for a Rakefile in parent directories.

Expand All @@ -60,6 +102,16 @@ Options are:
[<tt>--rakelibdir</tt> _rakelibdir_ (-R)]
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)]
Require _name_ before executing the Rakefile.

Expand All @@ -69,6 +121,11 @@ Options are:
[<tt>--silent (-s)</tt>]
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)]
Use the system wide (global) rakefiles. The project Rakefile is
ignored. By default, the system wide rakefiles are used only if no
Expand All @@ -80,23 +137,33 @@ Options are:
Use the project level Rakefile, ignoring the system-wide (global)
rakefiles.

[<tt>--tasks</tt> (-T)]
[<tt>--tasks</tt> <em>pattern</em> (-T)]
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
errors.

[<tt>--usage</tt> (-h)]
Display a usage message and exit.
errors. The _output_ parameter is optional, but if specified it
controls where the trace output is sent. If _output_ is
<tt>stdout</tt>, then trace output is directed to stardard output.
If _output_ is <tt>stderr</tt>, or if it is missing, then trace
output is sent to standard error.

[<tt>--verbose</tt> (-v)]
Echo the Sys commands to standard output.

[<tt>--version</tt> (-V)]
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
<em>VAR</em>=<em>VALUE</em> will be added to the environment hash
<tt>ENV</tt> and may be tested in the Rakefile.
4 changes: 2 additions & 2 deletions doc/rake/glossary.rdoc
Expand Up @@ -37,9 +37,9 @@
not needed. This may change in the future.

[<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
before Task T.
before Task T.

[<b>rule</b>]
A rule is a recipe for synthesizing a task when no task is
Expand Down
44 changes: 22 additions & 22 deletions doc/rake/proto_rake.rdoc
Expand Up @@ -4,54 +4,54 @@ This is the original 100 line prototype rake program.

---
#!/usr/bin/env ruby

require 'ftools'

class Task
TASKS = Hash.new

attr_reader :prerequisites

def initialize(task_name)
@name = task_name
@prerequisites = []
@actions = []
end

def enhance(deps=nil, &block)
@prerequisites |= deps if deps
@actions << block if block_given?
self
end

def name
@name.to_s
end

def invoke
@prerequisites.each { |n| Task[n].invoke }
execute if needed?
end

def execute
return if @triggered
@triggered = true
@actions.collect { |act| result = act.call(self) }.last
end

def needed?
true
end

def timestamp
Time.now
end

class << self
def [](task_name)
TASKS[intern(task_name)] or fail "Don't know how to rake #{task_name}"
end

def define_task(args, &block)
case args
when Hash
Expand All @@ -66,44 +66,44 @@ This is the original 100 line prototype rake program.
deps = deps.collect {|d| intern(d) }
get(task_name).enhance(deps, &block)
end

def get(task_name)
name = intern(task_name)
TASKS[name] ||= self.new(name)
end

def intern(task_name)
(Symbol === task_name) ? task_name : task_name.intern
end
end
end

class FileTask < Task
def needed?
return true unless File.exist?(name)
latest_prereq = @prerequisites.collect{|n| Task[n].timestamp}.max
return false if latest_prereq.nil?
timestamp < latest_prereq
end

def timestamp
File.new(name.to_s).mtime
end
end

def task(args, &block)
Task.define_task(args, &block)
end

def file(args, &block)
FileTask.define_task(args, &block)
end

def sys(cmd)
puts cmd
system(cmd) or fail "Command Failed: [#{cmd}]"
end

def rake
begin
here = Dir.pwd
Expand All @@ -119,9 +119,9 @@ This is the original 100 line prototype rake program.
rescue Exception => ex
puts "rake aborted ... #{ex.message}"
puts ex.backtrace.find {|str| str =~ /Rakefile/ } || ""
end
end
end

if __FILE__ == $0 then
rake
end

0 comments on commit 4f7a6aa

Please sign in to comment.