Hey all,
i'm new to TextMate and i wonder if it's possible to change the default ruby used when doing :
Automation > Run Command > Ruby > Run script
because i've severall rubys installed the one given by "which" being :
/opt/local/bin/ruby
but TextMate uses the latest : /usr/local/bin/ruby
(notice my PATH is setup such a way to get the wanted "/opt/local/bin/ ruby")
then, how to setup TextMate in order to get "/opt/local/bin/ruby" otherwise my scripts aren't working because of dependencies.
best,
Yvon
On 10 Jan 2006, at 13:22, Yvon Thoraval wrote:
Hey all,
i'm new to TextMate and i wonder if it's possible to change the default ruby used when doing :
Automation > Run Command > Ruby > Run script
because i've severall rubys installed the one given by "which" being :
/opt/local/bin/ruby
Hi,
Just add a variable "TM_RUBY" with value "/opt/local/bin/ruby" in TM Preferences under Advanced/Shell Variables.
-- Fred
On 10/01/2006, at 13:22, Yvon Thoraval wrote:
Hey all, i'm new to TextMate and i wonder if it's possible to change the default ruby used
The easiest is setting a TM environment variable, Preferences -> Advanced -> Shell Variable. Add one called TM_RUBY containing the full path to your interpreter. Although the default starts ruby as simply 'ruby' in which case it really should use your PATH. Seems weird.
-- Sune.
Le 10 janv. 06 à 14:01, Sune Foldager a écrit :
On 10/01/2006, at 13:22, Yvon Thoraval wrote:
Hey all, i'm new to TextMate and i wonder if it's possible to change the default ruby used
The easiest is setting a TM environment variable, Preferences -> Advanced -> Shell Variable. Add one called TM_RUBY containing the full path to your interpreter. Although the default starts ruby as simply 'ruby' in which case it really should use your PATH. Seems weird.
ok, fine, thanks a lot to both of them.
that works with 1.8.2...
best,
Yvon
Sune Foldager wrote:
On 10/01/2006, at 13:22, Yvon Thoraval wrote:
Hey all, i'm new to TextMate and i wonder if it's possible to change the default ruby used
The easiest is setting a TM environment variable, Preferences -> Advanced -> Shell Variable. Add one called TM_RUBY containing the full path to your interpreter. Although the default starts ruby as simply 'ruby' in which case it really should use your PATH. Seems weird.
Why are the scripts setup in this way? Wouldn't it be more transparent to call "/usr/bin/env ruby" and just follow what the user has configured?
Jeroen.
Le 10 janv. 06 à 17:30, Jeroen van der Ham a écrit :
Why are the scripts setup in this way? Wouldn't it be more transparent to call "/usr/bin/env ruby" and just follow what the user has configured?
if i launch a simple script as :
------------script.rb #!/usr/bin/env ruby -w puts $0 ------------end
launched from TextMate : /Library/Application Support/TextMate/Bundles/Ruby.tmbundle/Support/ tmruby.rb
from Terminal : script.rb
however it is in this directory : /Users/yvon/work/Ruby/examples
Yvon
Yvon,
Could you explain what those results mean? and why it would be a problem?
Jeroen.
Yvon Thoraval wrote:
Le 10 janv. 06 à 17:30, Jeroen van der Ham a écrit :
Why are the scripts setup in this way? Wouldn't it be more transparent to call "/usr/bin/env ruby" and just follow what the user has configured?
if i launch a simple script as :
------------script.rb #!/usr/bin/env ruby -w puts $0 ------------end
launched from TextMate : /Library/Application Support/TextMate/Bundles/Ruby.tmbundle/Support/tmruby.rb
from Terminal : script.rb
however it is in this directory : /Users/yvon/work/Ruby/examples
Ruby scripts launched from TM are fed directly to the ruby interpreter so unless IT interprets the shebang (and I don't think so), putting one at the start will be ignored.
As for using env... well, in the Run Ruby command, ruby is started like this: ruby ..and given that shell commands started from TM enjoy a full login- shell setup, your PATH should also be correct, leading to the 'usual' ruby being invoked.
-- Sune.
Le 10 janv. 06 à 19:30, Jeroen van der Ham a écrit :
Could you explain what those results mean? and why it would be a problem?
that means when doing :
Automation > Run commans > Ruby > Run Script
this is not the script itself being launched but rather :
/Library/Application Support/TextMate/Bundles/Ruby.tmbundle/Support/ tmruby.rb
which seems to be a [wrapper|launcher] for the proper script.
first, you can no more make use of $0.
for me this isn't a big prob, better to know.
i'll use this TextMate facility for mockup only...
Yvon
On 10/01/2006, at 23:40, Yvon Thoraval wrote:
this is not the script itself being launched but rather :
/Library/Application Support/TextMate/Bundles/Ruby.tmbundle/ Support/tmruby.rb
which seems to be a [wrapper|launcher] for the proper script.
Yes, which catches and formats errors, redirects input and output among other things.
first, you can no more make use of $0. for me this isn't a big prob, better to know.
Yeah, the $0 issue can easily be fixed, I think. I'll do that.
i'll use this TextMate facility for mockup only...
It works for bigger things, but for like.. production stuff, yeah I'd use a terminal.
-- Sune.
On 10/1/2006, at 17:30, Jeroen van der Ham wrote:
Why are the scripts setup in this way? Wouldn't it be more transparent to call "/usr/bin/env ruby" and just follow what the user has configured?
Going though /usr/bin/env is really just a workaround for not having execve() use PATH for the interpreter. So when not using shebang, it doesn't change anything.