Class: Rake::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/rake/opt/current_invocation_chain/patches/rake/task.rb

Overview

Class Override for Rake::Task

Instance Method Summary collapse

Instance Method Details

#__invoke_with_call_chain__Object

Save the original invoke_with_call_chain instance method



4
# File 'lib/rake/opt/current_invocation_chain/patches/rake/task.rb', line 4

alias_method "__invoke_with_call_chain__", "invoke_with_call_chain"

#invoke_with_call_chain(task_args, invocation_chain) ⇒ Object

Override the invoke_with_call_chain instance method Provides a thread-safe variable to access information about the currently invoked chain



8
9
10
11
12
13
14
# File 'lib/rake/opt/current_invocation_chain/patches/rake/task.rb', line 8

def invoke_with_call_chain(task_args, invocation_chain)
  old_chain = Thread.current.promise.invocation_chain
  new_chain = ::Rake::InvocationChain.append(self, invocation_chain)
  Thread.current.promise.invocation_chain = new_chain
  __invoke_with_call_chain__(task_args, invocation_chain)  # And call the original invocation
  Thread.current.promise.invocation_chain = old_chain
end