rake-0.8.2.rdoc   [plain text]


= Rake 0.8.2 Released

Rake version 0.8.2 is a new release of rake that includes a number of
new features and numerous bug fixes.

== Changes

=== New Features in Version 0.8.2

* Switched from getoptlong to optparse (patches supplied by Edwin
  Pratomo).

* The -T option will now attempt to dynamically sense the size of the
  terminal. The -T output will only self-truncate if the output is a
  tty. However, if RAKE_COLUMNS is explicitly set, it will be honored
  in any case. (Patch provided by Gavin Stark).

* The following public methods have been added to rake task objects:

  * task.clear -- Clear both the prerequisites and actions of the
    target rake task.
  * task.clear_prerequisites -- Clear all the existing prerequisites
    from the target rake task.
  * task.clear_actions -- Clear all the existing actions from the
    target rake task.
  * task.reenable -- Re-enable a task, allowing its actions to be
    executed again if the task is invoked.

* Changed RDoc test task to have no default template. This makes it
  easier for the tempate to pick up the template from the environment.

* Default values for task arguments can easily be specified with the
  :with_defaults method. (Idea for default argument merging supplied
  by (Adam Q. Salter)

=== Bug Fixes in Version 0.8.2

* Fixed bug in package task so that it will include the subdir
  directory in the package for testing. (Bug found by Adam Majer)

* Fixed filename dependency order bug in test_inspect_pending and
  test_to_s_pending. (Bug found by Adam Majer)

* Fixed check for file utils options to make them immune to the
  symbol/string differences. (Patch supplied by Edwin Pratomo)

* Fixed bug with rules involving multiple source, where only the first
  dependency of a rule has any effect (Patch supplied by Emanuel
  Indermühle)

* FileList#clone and FileList#dup have better sematics w.r.t. taint
  and freeze.

* Changed from using Mutex to Monitor. Evidently Mutex causes thread
  join errors when Ruby is compiled with -disable-pthreads. (Patch
  supplied by Ittay Dror) 

* Fixed bug in makefile parser that had problems with extra spaces in
  file task names. (Patch supplied by Ittay Dror)

== Other changes in Version 0.8.2

* Added ENV var to rake's own Rakefile to prevent OS X from including
  extended attribute junk in the rake package tar file. (Bug found by
  Adam Majer)

* Added a performance patch for reading large makefile dependency
  files. (Patch supplied by Ittay Dror)

== 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

== Task Argument Examples

Prior to version 0.8.0, rake was only able to handle command line
arguments of the form NAME=VALUE that were passed into Rake via the
ENV hash.  Many folks had asked for some kind of simple command line
arguments, perhaps using "--" to separate regular task names from
argument values on the command line.  The problem is that there was no
easy way to associate positional arguments on the command line with
different tasks.  Suppose both tasks :a and :b expect a command line
argument: does the first value go with :a?  What if :b is run first?
Should it then get the first command line argument.

Rake 0.8.0 solves this problem by explicitly passing values directly
to the tasks that need them.  For example, if I had a release task
that required a version number, I could say:

   rake release[0.8.2]

And the string "0.8.2" will be passed to the :release task.  Multiple
arguments can be passed by separating them with a comma, for example:

   rake name[john,doe]

Just a few words of caution.  The rake task name and its arguments
need to be a single command line argument to rake.  This generally
means no spaces.  If spaces are needed, then the entire rake +
argument string should be quoted.  Something like this:

   rake "name[billy bob, smith]"

(Quoting rules vary between operating systems and shells, so make sure
you consult the proper docs for your OS/shell).

=== Tasks that Expect Parameters

Parameters are only given to tasks that are setup to expect them.  In
order to handle named parameters, the task declaration syntax for
tasks has been extended slightly.

For example, a task that needs a first name and last name might be
declared as:

   task :name, :first_name, :last_name

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
:name (:first_name and :last_name in the example).

To access the values of the paramters, the block defining the task
behaviour can now accept a second parameter:

   task :name, :first_name, :last_name do |t, args|
     puts "First name is #{args.first_name}"
     puts "Last  name is #{args.last_name}"
   end

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.

== 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 ...

* Edwin Pratomo
* Gavin Stark
* Adam Q. Salter
* Adam Majer
* Emanuel Indermühle
* Ittay Dror
* Bheeshmar Redheendran (for spending an afternoon with me debugging
  windows issues)

-- Jim Weirich