class Thor::Task

def run(instance, args=[])

implementation to create custom tasks.
By default, a task invokes a method in the thor class. You can change this
def run(instance, args=[])
  public_method?(instance) ?
    instance.send(name, *args) : instance.class.handle_no_task_error(name)
rescue ArgumentError => e
  handle_argument_error?(instance, e, caller) ?
    instance.class.handle_argument_error(self, e) : (raise e)
rescue NoMethodError => e
  handle_no_method_error?(instance, e, caller) ?
    instance.class.handle_no_task_error(name) : (raise e)
end