undefined method `last' for {}:Hash

I was getting this error on some pre-2.0 rails sites when trying to run rake after upgrading it to 0.8.1:

rake aborted!
undefined method `last' for {}:Hash

Luckily gem lets you have multiple versions installed and I was able to add this to my .profile:

alias old_rake="rake _0.7.3_"

Now I just run old_rake whenever I want to use rake on those sites and I don't get the error. I know this is a sucky, hackish solution, but I'm too lazy to find the real problem. Especially when I only work on a couple sites not on rails 2 yet.

Tags: rake  Meta: permalink

Thomas is learning ruby - Part 2

Thomas: rake justins:face:off

Tags: rake  Meta: 0 comments, permalink

Add to the Rails default rake task

By default, running rake by itself just runs the "test" task. You can add more tasks by creating a file called lib/tasks/default.rake, containing:

task :default => "name:of:task"
task :default => "name:of:another:task"
etc...

Mine looks like this:

task :default => "spec"
task :default => "spec:plugins"

If you'd like to completely bypass the default task defined by rails, put this at the top of your file:

Rake::Task[:default].prerequisites.clear

Tags: rake  Meta: permalink