module Rake::TaskManager

def lookup(task_name, initial_scope=nil)

current scope. Return nil if the task cannot be found.
are recognized. If no scope argument is supplied, use the
synthesize file tasks or rules. Special scope names (e.g. '^')
This method performs straight lookups without trying to
Lookup a task, using scope and the scope hints in the task name.
def lookup(task_name, initial_scope=nil)
  initial_scope ||= @scope
  task_name = task_name.to_s
  if task_name =~ /^rake:/
    scopes = []
    task_name = task_name.sub(/^rake:/, '')
  elsif task_name =~ /^(\^+)/
    scopes = initial_scope[0, initial_scope.size - $1.size]
    task_name = task_name.sub(/^(\^+)/, '')
  else
    scopes = initial_scope
  end
  lookup_in_scope(task_name, scopes)
end