I have a Rakefile which, on my own-built Ruby 1.9.3 installation, correctly outputs the Unix shell equivalent when I use a FileUtils method such as cp
, mkdir
etc.
However, on the stock Ruby that ships with Mac OS X (specifically 10.5), which is version 1.8.6, they don't do this.
I'd like them to output the commands as they're performed. Is there a way to enable this in OS X's 1.8.6 Ruby, short of adding :verbose => true
to every call? (Which may not even work.)
The Rakefile in question is: https://github.com/dpkendal/tools-osx/blob/master/Rakefile
That doesn't make sense. 1.9.3 should not do
:verbose
unless explicitly told to do so. You can look at the implementation ofmkdir
in the 1.9.3 lib for example:There you can see that the message is not generated unless the
:verbose
option is explicitly supplied.However to enable
:verbose
across allFileUtils
methods you can simplyinclude FileUtils::Verbose
into your namespace. This works in both 1.8 and 1.9 ruby:BTW, it might be that Rake already does this in 1.9.3, which would explain why it does what it does in 1.9.3 and not in 1.8.6. I did not check this, but that's the only explanation I can think of.
Rake provides its own FileUtils extension called
Rake::FileUtilsExt
. This module has averbose
flag. To activate it simply add this to the top of the Rakefile: