Skip to content

Commit

Permalink
Updated docs to reflect the task argument / environment variable matc…
Browse files Browse the repository at this point in the history
…hup.
  • Loading branch information
jimweirich committed May 25, 2009
1 parent 9cbc5a6 commit 9224cf9
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions doc/rakefile.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,22 @@ argument string should be quoted. Something like this:
(Quoting rules vary between operating systems and shells, so make sure
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 uppcase version of the task
parameter.

=== Tasks that Expect Parameters

Parameters are only given to tasks that are setup to expect them. In
Expand Down Expand Up @@ -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
that allows access to the task arguments. Extra command line
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
the with_defaults method in the task body. Here is the above example
Expand Down Expand Up @@ -239,7 +256,8 @@ for tasks with arguments. For example:
There is an older format for declaring task parameters that omitted
the task argument array and used the :needs keyword to introduce the
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

Expand Down

0 comments on commit 9224cf9

Please sign in to comment.