module Rails::Generators
def self.find_by_namespace(name, base=nil, context=nil) #:nodoc:
Rails looks for is the first and last parts of the namespace.
Notice that "rails:generators:webrat" could be loaded as well, what
"rails:webrat", "webrat:integration", "webrat"
Will search for the following generators:
find_by_namespace :webrat, :rails, :integration
==== Examples
looks in load paths and loads the generator just before it's going to be used.
Generators names must end with "_generator.rb". This is required because Rails
Rails finds namespaces similar to thor, it only adds one rule:
def self.find_by_namespace(name, base=nil, context=nil) #:nodoc: lookups = [] lookups << "#{base}:#{name}" if base lookups << "#{name}:#{context}" if context unless base || context unless name.to_s.include?(?:) lookups << "#{name}:#{name}" lookups << "rails:#{name}" end lookups << "#{name}" end lookup(lookups) namespaces = subclasses.inject({}) do |hash, klass| hash[klass.namespace] = klass hash end lookups.each do |namespace| klass = namespaces[namespace] return klass if klass end invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name) end