Forum: Ruby on Rails app: rake task namespacing for new engines.

E27bafac86eeb3ca98a93edf4bce348f?d=identicon&s=25 Yuriy Trofimenko (Guest)
on 2013-08-23 12:59
(Received via mailing list)
At the moment when you create a new engine, its rakefile has such lines:

APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'

It loads only selected db tasks under the global rake namespace and
makes
all the engine's rake tasks available under the app: namespace.

The other approach would be to bring all the tasks of the engine to the
global rake namespace by doing something like this:

load File.expand_path("../spec/dummy/Rakefile", __FILE__)

Could anyone explain me what is the reasoning behind this task
selectivity
and app: namespacing?
It does seem clearer to me to see only really required for the
development
of the gem tasks in the global namespace, but is it the only reason?
The problem is that some gems expect to see such tasks as
db:test:prepare
and db:abort_if_pending_migrations in the global namespace and fail to
work
properly when the tasks are in the app: namespace.
So is it a fail on the side of these gems?

I published this question on the Ruby on Rails: Core group as well, but
somehow my post just didn't appear here, so I'm trying to post it here.
Sorry if in the end the post appears at both the groups.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.