Should rake remove t.name on failed tasks?

Discussion in 'Ruby' started by Josef Wolf, Nov 29, 2006.

  1. Josef Wolf

    Josef Wolf Guest

    Hello!

    With rake, I often find myself doing something like that:

    file "custom.iso" => "custom.dir" do |t|
    begin
    sh "mkisofs -r -V My Install CD' -cache-inodes" +
    " -J -l -b isolinux/isolinux.bin" +
    " -c isolinux/boot.cat -no-emul-boot" +
    " -boot-load-size 4 -boot-info-table" +
    " -o #{t.name} #{custom.dir}"

    rescue
    sh "rm #{t.name}"
    raise

    end
    end

    to avoid a broken target lying around.

    I wonder whether I am missing something here. Shouldn't rake remove t.name?
    I mean, once rake has started to build a target, it is pretty much sure that
    the target _have_ to be rebuilt. Thus there's no rason to let a half-baked
    target lying around should the build of that target fail.

    AFAICS, make removes the target if it fails to build it, too.

    What am I missing here? Any suggestions?
     
    Josef Wolf, Nov 29, 2006
    #1
    1. Advertising

  2. Josef Wolf wrote:
    > Hello!
    >
    > With rake, I often find myself doing something like that:
    >
    > file "custom.iso" => "custom.dir" do |t|
    > begin
    > sh "mkisofs -r -V My Install CD' -cache-inodes" +
    > " -J -l -b isolinux/isolinux.bin" +
    > " -c isolinux/boot.cat -no-emul-boot" +
    > " -boot-load-size 4 -boot-info-table" +
    > " -o #{t.name} #{custom.dir}"
    >
    > rescue
    > sh "rm #{t.name}"
    > raise
    >
    > end
    > end
    >
    > to avoid a broken target lying around.
    >
    > I wonder whether I am missing something here. Shouldn't rake remove t.name?


    That seems a reasonable request. Jim, is there any downside to this?

    Regards,

    Dan
     
    Daniel Berger, Nov 29, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Francis Hwang
    Replies:
    0
    Views:
    261
    Francis Hwang
    May 26, 2006
  2. Esad Hajdarevic

    global rake tasks

    Esad Hajdarevic, Oct 9, 2006, in forum: Ruby
    Replies:
    1
    Views:
    122
    Kalman Noel
    Oct 9, 2006
  3. Esad Hajdarevic

    rakelibdir (was: Global rake tasks)

    Esad Hajdarevic, Oct 16, 2006, in forum: Ruby
    Replies:
    0
    Views:
    105
    Esad Hajdarevic
    Oct 16, 2006
  4. peppermonkey
    Replies:
    1
    Views:
    268
    Gregory Brown
    Feb 10, 2007
  5. John Feminella
    Replies:
    0
    Views:
    259
    John Feminella
    Apr 25, 2010
Loading...

Share This Page