[TxMt] Re: TextMate 1.5 and Ruby 2.0.0

Matt Neuburg matt at tidbits.com
Sat Mar 23 21:34:29 UTC 2013


Allan Odgaard <mailinglist at textmate.org>
wrote:

> On Mar 12, 2013, at 8:42 PM, Matt Neuburg
> <matt at tidbits.com> wrote:
> 
> >> […] set TM_RUBY to your desired version rather than change PATH to have
> >your custom install eclipse the one in /usr/bin :)
> > 
> > I've never actually figured out what you mean by that. The way I do this
> > *is* by changing TextMate's PATH […]
> 
> You can set "TM_RUBY=$HOME/.rbenv/versions/1.9.3-p327" or similar.

The whole point of rbenv (or any similar ruby version management system)
is that I give a command at the command line, like this:

$ rbenv global 2.0.0-p0 

And presto, my entire system sees that ruby as its ruby, along with all
concomitants (the corresponding rdoc command, gem command, actual gems,
library, etc.).

The problem is that TextMate doesn't get the memo. The reason is that
TextMate doesn't pass through my .bash_profile, so it doesn't have
$HOME/.rbenv/bin in its path and doesn't do eval "$(rbenv init -)". To
solve this problem, I have modified TextMate's PATH so that it starts
like this:

/Users/mattleopard/.rbenv/bin:/Users/mattleopard/.rbenv/shims: ...

The first is so that the "rbenv" command itself is visible. The second
is so that rbenv's "ruby", "rdoc", "gem" and other shims are visible.
That's the genius of rbenv - those commands are actually shims, simple
scripts that turn to rbenv itself to exec the real command.

So, the point is, I'm already using the rbenv command at the command
line to switch, nimbly, between ruby versions. I do this many times a
day, testing a script under different ruby configurations. There is not
a snowball's chance that I'm *also* going to give some *explicit*
command pointing TextMate's TM_RUBY at a specific ruby. That would not
be nimble at all! TextMate's job is to follow the lead I am *already*
giving when I set my ruby version globally thru rbenv. My adjustment to
the PATH is how I get TextMate to follow that lead.

As I've said before, as far as I know, this is what *every* TextMate
user does (if they want to be nimble with Ruby versions).

So, I'm not sure where TextMate is headed with this, but I hope it's in
the direction of playing even *more* nicely with rbenv and my choice of
global ruby version - not less nicely. I have a lot of functionality
built upon this; obviously I don't want it to break. m.

-- 
matt neuburg, phd = matt at tidbits.com, http://www.apeth.net/matt/
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html



More information about the textmate mailing list