class Rake::Task

def task_defined?(task_name)

TRUE if the task name is already defined.
def task_defined?(task_name)
  Rake.application.lookup(task_name) != nil
end