pere.noel
11/25/2006 10:11:00 AM
Paul Lutus <nospam@nosite.zzz> wrote:
>
> Figure out what your search path is and symlink the desired Ruby version
> into the earliest (first searched) executable directory.
i don't understand, if the desired version is the first hit in my search
path then, no need for a symlink...
this is the case obviously i arranged the PATH such a way it hits first
/opt/local/bin/ruby.
and then using the shebang "/usr/bin env ruby" i get the right one on my
computer that's to say the ones under /opt and a user of mine using the
ones installed by Apple (being /usr/bin/ruby) with the same script and
the same shebang said : "OK works fine !"
again normally i don't care of the Apple default supplied Ruby BUT for
testing purpose i might have to use it in order to verify my script
under testing is able to work with the default ruby version on MacOS X
(i've never done X-platform ruby).
And unfortunately, on my box, due to env vars the Apple's one isn't
working with the shell i'm using (zsh).
When i'm testing a script under the Apple's installed Ruby, generally
it's nearly the last step for me, the script is supposed to work under
ruby 1.8.5 then i want only to verify it could work with 1.8.2 AND
without any added extension to Ruby (otherwise i would have to embed in
a bundle the ruby under /opt with the needed extensions).
To summarize the prob i want to solve is why, when i do :
$ /usr/bin/ruby <a_script>
then using the default Apple's ruby, i get an error message :
/usr/bin/ruby: No such file to load -- ubygems (LoadError)
for a script which don't use any gem and also with no one env var set to
"ubygems" rather i do have effectively :
export RUBYOPT=rubygems
then the first "r" is mangled at leat...
in the mean time i've added an alias (*) to my shell setup :
alias aruby='/usr/bin/ruby' # Apple's ruby
then doing :
$ aruby --version # gave me :
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
Right this is exactly wht i wanted except when i use it with a script :
$ aruby wav2xml.rb truc.wav # i get :
/usr/bin/ruby: No such dile to load -- ubygems (LoadError)
which i don't understand where it comes from...
* I think it's better to use aliases rather than symlink because with
that way i leave everything installed by Apple untouched.
>
> Example. Let's say you have directory /usr/local/bin, and it is the first
> searched executable directory, and you want to execute /opt/local/bin/ruby
> instead of the Ruby version located at /usr/bin/ruby.
>
> Move to directory /usr/local/bin, type this as root:
>
> # ln -s /opt/local/bin/ruby ruby
>
> Then test whether this worked. As a normal user:
>
> $ ruby -version
>
> But having multiple Ruby versions installed is a bad idea, because the
> different versions use libraries, some of them shared, that may cause
> conflicts.
Quiet frankly i don't think it is a bad idea having different version
because the first one is the default installed ny Apple MacOS X and
seems to be used by MacOS X then this one i want to leave it untouched.
the second one (which appears to be the first in my PATH) is absolutely
independant of the first one, that's the policy of MacPort the reason to
install it under /opt, only MacPort use that directory, MacOS X doesn't
use it.
for the third being under my HOME, no prob at all it doesn't interfere
with the previous ones because all the command are prefixed by "j" for
jRuby and it isn't in my PATh at all, here i'm using zsh (shell) aliases
rather :
alias jruby="$JRUBY_HOME/jruby"
alias jgem="$JRUBY_HOME/jruby $JRUBY_BIN/gem --config-file
$HOME/.jgemrc"
etc...
--
une bévue