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 🙁

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.

TextMate, rdoc and rvm

Using the Ruby-Bundle of TextMate let you ask the ruby built-in documentation of a command by hitting ctrl-h.

But I ran into some troubles when using rvm. I did’t get the manual for the method I asked for.

The problem seems to be the current version of rdoc as I found here. So I had to downgrade my rdoc gem from version 2.5.9 downto 2.4.3. But that sounds easier than it was for me. Every time I ran gem uninstall rdoc it wasn’t uninstalled. It stayed there. Even if I installed the older version and uninstalled version 2.5.9 rdoc –version brought up 2.5.9.

So I uninstalled my ruby using rvm uninstall 1.8.7 and removed also manually all gems connected with this ruby version in the following directories:

  • ~/.rvm/gemsets/ruby/1.8.7/
  • ~/.rvm/gems

Then I remove rdoc from the files

  • ~/.rvm/gemsets/global.gems
  • ~/.rvm/gemsets/default.gems

Installing ruby 1.8.7 again in rvm with the command rvm install 1.8.7 brought back the ruby version but without the latest rdoc. This one I could reinstall with gem install rdoc –version 2.4.3.

Now TextMate shows the correct help file.

Please see also the update.