From a2e2e73c5ef7c9082810d77c831c50c91011e6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 18 Jan 2010 10:43:10 +0100 Subject: Ensure generators can be invoked by their shortcut and remove attr_reader tasks. --- railties/lib/rails/generators.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails/generators.rb') diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 3713a38b33..ecd0a1c6ea 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -168,6 +168,8 @@ module Rails # Rails looks for is the first and last parts of the namespace. # def self.find_by_namespace(name, base=nil, context=nil) #:nodoc: + base = "rails" unless base || context || name.to_s.include?(?:) + # Mount regexps to lookup regexps = [] regexps << /^#{base}:[\w:]*#{name}$/ if base @@ -203,8 +205,7 @@ module Rails # commands. def self.invoke(namespace, args=ARGV, config={}) names = namespace.to_s.split(':') - - if klass = find_by_namespace(names.pop, names.shift || "rails") + if klass = find_by_namespace(names.pop, names.shift) args << "--help" if klass.arguments.any? { |a| a.required? } && args.empty? klass.start(args, config) else -- cgit v1.2.3