Module: Rake::TaskManager

Defined in:
lib/has_many_polymorphs/rake_task_redefine_task.rb

Instance Method Summary collapse

Instance Method Details

#redefine_task(task_class, args, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/has_many_polymorphs/rake_task_redefine_task.rb', line 7

def redefine_task(task_class, args, &block)
  task_name, deps = resolve_args(args)
  task_name = task_class.scope_name(@scope, task_name)
  deps = [deps] unless deps.respond_to?(:to_ary)
  deps = deps.collect {|d| d.to_s }
  task = @tasks[task_name.to_s] = task_class.new(task_name, self)
  task.application = self
  task.add_comment(@last_comment)
  @last_comment = nil
  task.enhance(deps, &block)
  task
end