jimweirich/rake — pull request #79 by sunaku (2011-10-12 05:52:26+00:00)
Title: ignore nil values passed to sh() and ruby()

This patch allows you to pass nil values to Rake's sh() and ruby()
methods. This is useful when you want to conditionally pass arguments
to the child program you are executing.

For example, suppose you want to pass `-v` to a child program if the
user ran Rake in tracing mode (`rake --trace`), but not otherwise:

```ruby
sh 'asciidoc', ('-v' if Rake.application.options.trace), 'input.txt'
```

Without this patch, you have to carefully construct an arguments array
so that it does not contain nil values:

```ruby
args = []
args << '-v' if Rake.application.options.trace
args << 'input.txt'
sh 'asciidoc', *args
```

Sadly, this becomes very tiresome when performed more than a few times.

See http://redmine.ruby-lang.org/issues/3631 for more information.