Receives a namespace, arguments and the behavior to invoke the generator.
It’s used as the default entry point for generate, destroy and update
commands.
# File railties/lib/rails/generators.rb, line 167
def self.invoke(namespace, args=ARGV, config={})
names = namespace.to_s.split(':')
if klass = find_by_namespace(names.pop, names.any? && names.join(':'))
args << "--help" if args.empty? && klass.arguments.any? { |a| a.required? }
klass.start(args, config)
else
puts "Could not find generator #{namespace}."
end
end