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)

 

 

Missing on posterous

There are two things I'm missing on posterous currently:

The first one is that adding another counter other than google analytics doesn't work for me because I'm always losing the javascript code. Maybe there is a work around with escape the javascript.

The other point is a simple css style for formating source code in a post. A simple drop down box to format source code would be great.

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.

Game theory on iTunes U

A few days ago I found some webcasts in iTunes U about Game Theory. Ben Polak gives a wonderul introduction into this amazing part of mathematics, economics and politics. (If you have ever watched Numb3rs you know that Charlie Epps explains every second problem using method out of game theory.)

I just watched only the first few parts. But he is speaking so good that you want to see more and more. He explains e.g. why you should always shoot to the left or right on soccer-penalties and never towards the middle. (His only fault is that he is an Englishman and he thinks that German players should should shoot towards the middle so England will win against Germany. But this will never happen as you can see on this years match. I just say 4-1 ;-)))

Another conclusion is why politicans share mostly a similar opinion and seldom have extreme ones. Or why supermarkets and gas stations are always at the same spot and not evenly distributed.

These webcasts have been recorded at Yale University. I love the idea of public available lectures. So anyone interested in some kind of science has a simple access to those excellent material.

vBulletin stats