[Rake-devel] Should unsuccessful File Tasks delete their target file?

rake-devel at rubyforge.org rake-devel at rubyforge.org
Fri Nov 28 00:35:17 EST 2003


I've been going through the backlog of requests and suggestions and came 
across this one from Chris ...
Chris Thomas wrote:

> 4. FileTask needs to delete the target when an exception is raised 
> during execute. Otherwise, the next rake invocation may find a 
> partially-constructed target and not see the need to rebuild it. I'm not 
> sure if FileTask is the right place for this, perhaps it should be the 
> subclass's responsibility.

This seems like a reasonable request, and I already have the unit test 
for it (see testtasks.rb, the FileTaskTest class, last test method). 
However, unconditionally deleting a file on failure may be a bit drastic 
and I would like some feedback before I implement it.

(1) What's a realistic scenario where it would be desired.
(2) Is there a realistic scenario where deleting the target file would 
not be desired?
(3) What defines success and failure.  I'm strongly leaning toward an 
exception thrown during a task action is considered failure.  Any other 
thoughts.

In general ...
The code base is beginning to stabilize for 0.3.0.  FileLists now use 
the ant-like include/exclude nomenclature.  I've broken PackageTask from 
GemPackageTask so that packaging doesn't depend upon the presence of 
RubyGems.  Documentation is fairly up to date (I've got some catchup to 
do in the package area).

I try to keep CVS up to date with the latest.

Thanks to everyone for their suggestions and comments.

-- 
-- Jim Weirich       jweirich at one.net      http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



More information about the Rake-devel mailing list