p. Corey
10/12/2007 12:09:00 PM
> I find it easier than using sh due to FileUtils::Verbose and
> FileUtils::DryRun. Replacing RubyGems' setup.rb with a tiny,
> debuggable installer was incredibly easy using FileUtils and Dir.
First off I totally agree with you here, the FileUtils::DryRun and
FileUtils::Verbose are very helpful over sh to do such things. And Pow
does nothing to emulate that great functionality.
> How is FileUtils cumbersome?
Individual FileUtil commands are not cumbersome, but the combination
of them with other methods is. Rarely do I just need mv a predefined
path to a new predefined. First I have to build the src_path using a
combination of File.dirname and File.join, then I have to do the same
with the dest_path as well as mkdir_p'ing it to make sure path
hierarchy exists. When I find myself using FileUtils it usually
involves doing this with multiples files and multiple commands, that's
where it becomes cumbersome. FileUtils just emulates shell commands,
which are great on the command line but archaic compared to the rest
of ruby's syntax and style.