Le 9 mars 06 à 15:45, Allan Odgaard a écrit :

Yes, but add it to your ~/.bash_profile or similar (see [1] for what TM sources when running commands).


or all of those kind of setup could be done thru TextMate setup, but how ?


You could also add them to Preferences -> Advanced -> Shell Variables.



[1] http://macromates.com/textmate/manual/shell_commands#search_path




ok, thanks, i had read that page and, because i'm using a shebang :

#!/usr/bin/env ruby

i've augmented the ~/.MacOSX/environment.plist

having the content :

~%> cat ~/.MacOSX/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>GEM_HOME</key>
        <string>/opt/local/lib/ruby/gems/1.8</string>
        <key>GROOVY_HOME</key>
        <string>/Users/yvon/bin/groovy</string>
        <key>HTML_TIDY</key>
        <string>/Users/yvon/.tidy.rc</string>
        <key>LC_CTYPE</key>
        <string>en_US.UTF-8</string>
        <key>OSXANT_HOME</key>
        <string>/Users/yvon/bin/OSXAnt</string>
        <key>PATH</key>
        <string>/opt/local/bin:/usr/local/bin:/usr/local/mysql/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/Users/yvon/bin:/Developer/qt/bin:/usr/local/pgsql/bin:/Users/yvon/bin/groovy/bin</string>
        <key>RUBYOPT</key>
        <string>-rrubygems</string>
</dict>
</plist>


i've also added a ~/.bash_profile having :
[ -f /etc/profile ] && . /etc/profile
[ -f ~/.bashrc ]    && . ~/.bashrc

export PATH="/opt/local/bin:/usr/local/bin:/usr/local/mysql/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/Users/yvon/bin:/usr/local/pgsql/bin:/Users/yvon/bin/groovy/bin:$PATH"

export RUBYOPT="-rrubygems"
export GEM_HOME="/opt/local/lib/ruby/gems/1.8"


and finally set the TextMate preferences :

TM_RUBY /opt/local/bin/ruby
RUBYOPT -rrubygems
GEM_HOME /opt/local/lib/ruby/gems/1.8

i've tested with a simple script ("try.rb") :
#!/usr/bin/env ruby

p "#{GEM_HOME}"


i get :
NameError: uninitialized constant GEM_HOME
at top level
in try.rb at line 3


the same arroses with the constant TM_RUBY

however, changing the above script content to :
which_ruby=`which ruby`.chomp
p "#{which_ruby}"
p $LOAD_PATH


i get the correct ruby (dp install) and the correct LOAD_PATH

best,

Yvon