|
Bundle.rb monkey-patching uses alias_method names used by other common libraries
Though this problem exhibits itself in the use of bundles, it is a problem with the textmate code base itself.
On latest versions (as of 12/3/2009) of both textmate and, for example, ruby-on-rails-tmbundle, rake tasks, including anything with Ctrl-\, do not work. These same tasks work fine from the command line.
If you turn on tracing, you see that the problem is the Builder.rb in /Applications/TextMate.app/Contents/SharedSupport/Support/lib
If you go the line number at the top of the trace, you'll notice some monkey-patching into Kernel and Object. My guess is -- though I'm new to ruby -- that the name "blank_slate_method_added" was already patched by some other common library to Object (and maybe Kernel). This fact plus the implementation here yields recursive behavior that yields a stack overflow. Hence, the fix is to rename the alias. Somewhat goofily, I chose "my_blank_slate_method_added" as so:
module Kernel
class << self
alias_method :my_blank_slate_method_added, :method_added
def method_added(name)
my_blank_slate_method_added(name)
return if self != Kernel
Builder::BlankSlate.hide(name)
end
end
end
class Object
class << self
alias_method :my_blank_slate_method_added, :method_added
def method_added(name)
my_blank_slate_method_added(name)
return if self != Object
Builder::BlankSlate.hide(name)
end
end
end
|