Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > has anyone implemented a failable dependency for Rake?

Reply
Thread Tools

has anyone implemented a failable dependency for Rake?

 
 
Larry Fast
Guest
Posts: n/a
 
      03-31-2007
What I find myself writing in Rake is the following:

task xyz => ['abc?'] do
enc

# test before proceeding
task abc? do
if !abc
exit
end
end

What I'm creating is failable dependencies. XYZ should not be executed
unless abc succeeds. Unfortunately the structure I've shown stops on
the first failure. What I'd like to do is report all failures but only
execute if everything passes.

This could be implemented by processing prerequisites until a prereq
returns false. Any task containing any false prereqs would not be
processed.

Does this exist anywhere?

Thanks,
Larry Fast

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Jim Weirich
Guest
Posts: n/a
 
      04-01-2007
Larry Fast wrote:
> What I find myself writing in Rake is the following:
>
> task xyz => ['abc?'] do
> enc
>
> # test before proceeding
> task abc? do
> if !abc
> exit
> end
> end
>
> What I'm creating is failable dependencies. XYZ should not be executed
> unless abc succeeds. Unfortunately the structure I've shown stops on
> the first failure. What I'd like to do is report all failures but only
> execute if everything passes.
>
> This could be implemented by processing prerequisites until a prereq
> returns false. Any task containing any false prereqs would not be
> processed.
>
> Does this exist anywhere?


It's not directly supported by Rake.

The way I think I would approach this is to let each of the
prerequisites vote on whether the xyz task should run or not. The
prereqs would register the voting with in some central location (e.g. a
global or maybe some central voting object). I would then write the xyz
task like this:

task yz => [:abc?, :acb?] do
if XYZ_SHOULD_RUN.ok?
do_xyz_stuff
end
end

This way all the prerequisites get a chance to run and the xyz task is
responsible for detecting the vote.

-- Jim Weirich

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Larry Fast
Guest
Posts: n/a
 
      04-01-2007
Jim Weirich wrote:

> The way I think I would approach this is to let each of the
> prerequisites vote on whether the xyz task should run or not. The
> prereqs would register the voting with in some central location (e.g. a
> global or maybe some central voting object). I would then write the xyz
> task like this:
>
> task yz => [:abc?, :acb?] do
> if XYZ_SHOULD_RUN.ok?
> do_xyz_stuff
> end
> end
>
> This way all the prerequisites get a chance to run and the xyz task is
> responsible for detecting the vote.
>
> -- Jim Weirich


That's one step in the right direction but I have a few dozen of these.
I'd like to inherit and extend the Rake::Task so I could write all my
tasks as:

task_failable yz => [...]

Each action would be attempted only if no dependency had failed. BUT all
the failures would be reported.

This would be most important in a long build process. You walk away
hoping it will complete. The next morning, most of it has completed and
you can follow up on the errors. I suspect that's what file_tasks do
but I have some non-file based testing to do.

On the other hand, I may have just talked myself out of this approach.
It may be easier to create files to represent the completion of these
actions.

Thanks,
Larry Fast

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP!! anyone ??can help me about my project "quick sort implemented with shell sort? comsciepartner General Computer Support 0 10-06-2008 01:02 PM
Is anyone aware of a VHDL dependency finder? bwilson79@gmail.com VHDL 25 02-14-2008 08:57 PM
Anyone implemented customized Realm for Tomcat and other J2EE ? jacksuyu@gmail.com Java 2 11-05-2005 03:26 PM
Has anyone implemented BASIC in Python? Leif K-Brooks Python 19 08-25-2004 08:12 PM
How to remove dependency on a header file which has a typedef? Vikas C++ 1 08-01-2003 08:47 PM



Advertisments