Forum: Ruby on Rails Rake Namespaces - How to keep them separate?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David W. (Guest)
on 2007-05-16 13:22
Good morning,

In our app we have a number of custom Rake tasks living in lib/tasks.

Each has a different namespace, but if I do this (yes, I know, global
variables bad):

namespace :spider_uk_foo do
  @ss = Scraper.new
  @ss.set_name

  task :perform do
  end
end

Then @ss.set_name is run when running any other rake file, though each
has a different namespace.

@ss would also appear to be available to other rake files, again in
different namespaces, where it is not even defined.

Any ideas, please?

Any advice, or pointing out of something obvious that I've missed,
gratefully received.

Thank you,

Dave
This topic is locked and can not be replied to.