From: Suraj Kurapati <sunaku@...> Date: 2011-10-13T06:50:17+09:00 Subject: [ruby-core:40128] [Ruby 1.9 - Feature #3631] [PATCH] lib/rake.rb: allow passing nil to sh() and ruby() Issue #3631 has been updated by Suraj Kurapati. Patch was rejected upstream, so please close this issue. ---------------------------------------- Feature #3631: [PATCH] lib/rake.rb: allow passing nil to sh() and ruby() http://redmine.ruby-lang.org/issues/3631 Author: Suraj Kurapati Status: Assigned Priority: Normal Assignee: Nobuyoshi Nakada Category: lib Target version: =begin 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: 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: 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. Thanks for your consideration. =end -- http://redmine.ruby-lang.org