[Rake-devel] redefine rake task broken in 0.8.x for a rails app

Charlie Savage cfis at savagexi.com
Sat Dec 29 01:47:31 EST 2007

Hi John,

Thanks for the code snippet from before - I got a lot of use out of it.

To run it with 0.8.x, the first argument to resolve_args should be an 
array.  So:

      def self.redefine_task(args, &block)
        task_name, deps = Rake.application.resolve_args([args])
        define_task(args, &block)

Hope this helps,


John Dell wrote:
> Hi All,
> We have a need to redefine 'rake test' in one of our rails apps.  I'll spare the reasons for that here, but happy to share if anyone is interested.
> There is a code snippet .rake file I found that allowed us to redefine the rake task 'test' without touching the original rails task code, and it worked up to rake 0.7.3, but broke with the latest release of rake 0.8.x
> The sample rake task is here: http://snippets.dzone.com/posts/show/2031
> Using that code now bombs with the following:
> undefined method `last' for {}:Hash
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.0/lib/rake.rb:1654:in `resolve_args'
> ...
> My efforts to track this down have failed (so far).  Anybody willing to take a peak at this? Or offer suggestions?
> Thanks,
> John
> P.S. The problem is also mentioned in user comments by other folks in the rake 0.8 release here, so I'm not the only one hitting this:
> https://rubyforge.org/forum/forum.php?thread_id=20548&forum_id=20061
> _______________________________________________
> Rake-devel mailing list
> Rake-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rake-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
Url : http://rubyforge.org/pipermail/rake-devel/attachments/20071228/1fb9ee01/attachment-0001.bin 

More information about the Rake-devel mailing list