[TxMt] Re: Differing ENV when TM2 started from mate
Simon Gregory
mr.simon.gregory at gmail.com
Mon Sep 24 09:29:50 UTC 2012
> > I have TM_RUBY specified to point to rvm's textmate_ruby. When opening TextMate using 'mate .' it subsequently uses the system ruby, but not the system gemset, and bundle commands start to fail because of incompatabilities.
>
> Are you talking about bundle commands or user scripts (⌘R)?
>
Bundle commands.
> In either case, I guess the issue is that you have gems installed in ~/.gems (or whatever the folder is) which will be picked up by all versions of ruby!?!
>
This is happening at the granular level I'd expect when using rvm and isolated gemsets, here's the error message:
/Users/simon/.rvm/gems/ruby-1.9.3-p194 at imp/gems/nokogiri-1.4.7/lib/nokogiri/nokogiri.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
The gemset it's picking up is the one for the local project, as defined in the projects .rvmrc file.
> Though no bundle commands actually use ruby gems, so, ehm… which bundle commands actually fail?
>
It's in an in development branch of the ActionScript 3 bundle - and as it extends autocompletion it's used by a few people.
> > When opening TextMate directly, or it is already open when I use mate, all is well.
>
> OK, so I suspect the issue is that you have set RUBYLIB, RUBYOPT, or similar in your shell. When you launch TextMate from your shell, this environment is inherited and would explain why the ruby TextMate use would get your third party gems…
>
> Presently I use a blacklist for the inherited environment, I’ll add RUBY* to this list, although it might perhaps be better to move to whitelisting the variables we do wish to inherit.
`env` doesn't list anything starting with RUBY. However it looks like rvm is setting GEM_HOME and GEM_PATH and TextMate is inheriting them.
I think that my assumption that TM_RUBY was working globally is wrong, if I run `ruby -v` via Bundles > Shell Script > Execute Line this is always the system ruby - 1.8.7. ⌘R on a .rb file containing puts ENV['RUBY_VERSION'] gives me the expected version as configured by textmate_ruby.
I'll check through the TextMate docs and see if I can get a better handle on scope and see if I can work things out.
Cheers,
Simon
More information about the textmate
mailing list