module Rails::Generators

def self.invoke(namespace, args=ARGV, config={})

commands.
It's used as the default entry point for generate, destroy and update
Receives a namespace, arguments and the behavior to invoke the generator.
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