Elia Schito

How to declare top rake prerequisites from within a namespace

In Programming, Ruby, Ruby snippets, Snippets, Tutorials on May 28, 2008 at 12:48 pm

Here’s the problem

task :mytask do
  # ...
end

namespace :myscope do
  task :mytask => :mytask
end

This will end up with loop dependency error, so how we can call a top level task with the same name of one from our current scope?

The solution is not documented, i found it directly in the rake’s library code.

task :mytask do
  # ...
end

namespace :myscope do
  task :mytask => "rake:mytask"
end
  1. Thanks, super useful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: