module Rails::Generators
def self.lookup(namespaces) #:nodoc:
in the load path.
Receives namespaces in an array and tries to find matching generators
def self.lookup(namespaces) #:nodoc: load_generators_from_railties! paths = namespaces_to_paths(namespaces) paths.each do |raw_path| ["rails/generators", "generators"].each do |base| path = "#{base}/#{raw_path}_generator" begin require path return rescue LoadError => e raise unless e.message =~ /#{Regexp.escape(path)}$/ rescue NameError => e raise unless e.message =~ /Rails::Generator([\s(::)]|$)/ warn "[WARNING] Could not load generator #{path.inspect} because it's a Rails 2.x generator, which is not supported anymore. Error: #{e.message}.\n#{e.backtrace.join("\n")}" rescue Exception => e warn "[WARNING] Could not load generator #{path.inspect}. Error: #{e.message}.\n#{e.backtrace.join("\n")}" end end end end