def self.method_added(method)
return if self == Heroku::Command::Base
return if self == Heroku::Command::BaseWithApp
return if private_method_defined?(method)
return if protected_method_defined?(method)
help = extract_help_from_caller(caller.first)
resolved_method = (method.to_s == "index") ? nil : method.to_s
default_command = [ self.namespace, resolved_method ].compact.join(":")
command = extract_command(help) || default_command
banner = extract_banner(help) || command
permute = !banner.index("*")
banner.gsub!("*", "")
Heroku::Command.register_command(
:klass => self,
:method => method,
:namespace => self.namespace,
:command => command,
:banner => banner,
:help => help,
:summary => extract_summary(help),
:description => extract_description(help),
:options => extract_options(help),
:permute => permute
)
end