module Rails::Command
def find_by_namespace(namespace, command_name = nil) # :nodoc:
"webrat", "webrat:integration", "rails:webrat", "rails:webrat:integration"
Will search for the following commands:
find_by_namespace :webrat, :integration
looks in load paths and loads the command just before it's going to be used.
Command names must end with "_command.rb". This is required because Rails
Rails finds namespaces similar to Thor, it only adds one rule:
def find_by_namespace(namespace, command_name = nil) # :nodoc: lookups = [ namespace ] lookups << "#{namespace}:#{command_name}" if command_name lookups.concat lookups.map { |lookup| "rails:#{lookup}" } lookup(lookups) namespaces = subclasses.index_by(&:namespace) namespaces[(lookups & namespaces.keys).first] end