TextMate: Ruby On Rails bundle, partials

When using the Ruby On Rails Textmate Bundle I got an error when generating a partial using the shortcut shift-ctrl-h.

Applications/TextMate.app/Contents/SharedSupport/Support/lib/ui.rb:355:in `to_plist‘: An object in the argument tree could not be converted (ArgumentError)
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/ui.rb:355:in `request_string_core‘
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/ui.rb:193:in `request_string‘

It seems to me to be a problem of ruby 1.9.x. When using ruby 1.8.7 everything’s okay. This got be confirmed by a post by Allan Odgaard himself.

So google was my friend and brought up a solution:

# Updating osx-plist for Ruby 1.9 compatibility
$> git clone git://github.com/kballard/osx-plist.git
$> cd osx-plist/ext/plist
$> ruby extconf.rb && make
$> cp plist.bundle /Applications/TextMate.app/Contents/SharedSupport/Support/lib/osx/

This breaks the function when using ruby 1.8.7 but with 1.9.2 everything’s okay.

Update: Unfortunately this breaks other functions like ctrl-h for rdoc 🙁

Once again: TextMate, rdoc and rvm

It seems to me that I did something yesterday that disrupted my ctrl-h function on TextMate once again. I tried several things to reestablish the correct behaviour but I had no luck.

But I learned much about TextMate and rvm/ruby.

First of all I upgraded all my bundles of TextMate. I moved the directory/Library/Application Support/TextMate/Bundles to Bundles.old and got the whole directory from subversion:

svn co http://svn.textmate.org/trunk/Bundles

Then I saw that there is no more a Ruby-Bundle. So I installed it in my user’s directory

~/Library/Application Support/TextMate/Bundles/

from github.

I even cloned the repository to fix a bug. My repro is here http://github.com/JerryWho/ruby-tmbundle

The next lesson I learned is that ctrl-h runs Support/bin/linked_ri.rb which itself runs ri. But not the version I told textmate to use. It used the default rvm-ruby-ri version. So I set the TextMate environment variable TM_RUBY_RI to ~/.rvm/bin/textmate_ri

Now the correct version of ri is run.

The cause for the main problem is that ri doesn’t support the parameter plain to the option -f anymore. So I changed it html and removed the escaping of any tags (see commit)

Update: TextMate, rdoc and rvm

Once again I started coding some ruby code using TextMate. But now I installed Ruby 1.9.2 using rvm. As I did some month ago I wanted to use TextMate’s ctrl-h to show the ri info for a method or so.

So I installed the latest version of rdoc and rdoc-data. I generated the textmate wrapper as shown here. But this won’t work because running

rdoc-data –install

results in an error message:

~/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/fileutils.rb:121:in `chdir‘: No such file or directory – ~/.rvm/gems/ruby-1.9.2-p0@test/gems/rdoc-data-2.5.3/data/1.9.2 (Errno::ENOENT)

And that’s correct because rdoc-data does not yet support ruby 1.9.2 as you can read here.

So I copied ~/.rvm/gems/ruby-1.9.2-p0@test/gems/rdoc-data-2.5.3/data/1.9.1 to ~/.rvm/gems/ruby-1.9.2-p0@test/gems/rdoc-data-2.5.3/data/1.9.2 hoping that the differences between 1.9.1 and 1.9.2 won’t matter.

Updating the textmate wrapper

rvm wrapper 1.9.2@mygemset textmate

and everything’s just fine.