jimweirich/rake — pull request #150 by dennisjbell (2012-11-22 05:40:11+00:00)
Title: Support variable-length arguments for Tasks

As an alternative implementation to https://github.com/jimweirich/rake/pull/70, this allows tasks to access parameters beyond the named parameters that are currently supported. This is accomplished by storing the sequential list of values provided as arguments to the task, and making them available to the block via args.extras.

I have encountered the need for iterating over a variable number of values in a task many times, such as this contrived example below:
```ruby
desc "Send a message to one or more recipients"
task :email, [:message] do |t, args|
mail = Mail.new(args.message)
recipients = args.extras
recipients.each do |target|
mail.send_to(recipent)
end
end
```

It remains compatible with the current named argument and prerequisites syntax using the arrow notation, and doesn't create any further auto-generated hash keys.

It also adds a to_a method to provide the full list of values passed in, regardless whether they are associated with a named argument or not.