Small patch that extends the 'fail' method to show the task stack at
 the moment of the error. It has helped me a lot when debugging
 complicated rakefiles.
--- rake-org.rb	2008-04-23 12:41:49.312849649 +0200
+++ rake.rb	2008-04-23 14:35:05.208844714 +0200
@@ -236,6 +236,17 @@
   end
 end # class String
 
+
+######################################################################
+# Enhance 'fail' method to give a task-stack dump
+#
+$task_stack = []
+alias original_fail fail
+def fail(msg)
+	msg += "\n\t" + $task_stack.reverse.join(' <- ') if not $task_stack.empty?
+	original_fail msg 
+end
+
 ##############################################################################
 module Rake
 
@@ -504,8 +515,10 @@
         end
         return if @already_invoked
         @already_invoked = true
+        $task_stack << name
         invoke_prerequisites(task_args, new_chain)
         execute(task_args) if needed?
+        $task_stack.pop
       end
     end
     protected :invoke_with_call_chain
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to