From: badboy Date: 2009-04-26T22:12:03+09:00 Subject: Re: Odd Ruby/Rubygems/gem path problem Pito Salas schrieb: > Eric Hodel wrote: >> On Apr 24, 2009, at 17:38, Pito Salas wrote: >>>> the -r command line option uses rb_require() the C function, not >>>> Kernel#require the method. 1.9 does not have this limitation. >>> Eric, thanks. I am not sure of the implication of that. Are you saying >>> therefore that one cannot rely on -rrubygems -rshoulda to work? >> With ruby 1.8, no. There is a workaround though: >> >> ruby -rubygems -e 'require "shoulda"; ...' > > Another slight confusion: I've read about -rubygems as well as putting > "rubygems" into RUBY_OPT in a document about gems. > > But, in fact if I do a man ruby or a ruby --help there's no mention of > the -rubygems option: > > $ruby --h > Usage: ruby [switches] [--] [programfile] [arguments] > -0[octal] specify record separator (\0, if no argument) > -a autosplit mode with -n or -p (splits $_ into $F) > -c check syntax only > -Cdirectory cd to directory, before executing your script > -d set debugging flags (set $DEBUG to true) > -e 'command' one line of script. Several -e's allowed. Omit > [programfile] > -Fpattern split() pattern for autosplit (-a) > -i[extension] edit ARGV files in place (make backup if extension > supplied) > -Idirectory specify $LOAD_PATH directory (may be used more than > once) > -Kkcode specifies KANJI (Japanese) code-set > -l enable line ending processing > -n assume 'while gets(); ... end' loop around your script > -p assume loop like -n but print line also like sed > -rlibrary require the library, before executing your script > -s enable some switch parsing for switches after script > name > -S look for the script using PATH environment variable > -T[level] turn on tainting checks > -v print version number, then turn on verbose mode > -w turn warnings on for your script > -W[level] set warning level; 0=silence, 1=medium, 2=verbose > (default) > -x[directory] strip off text before #!ruby line and perhaps cd to > directory > --copyright print the copyright > --version print the version > > $ ruby -v > ruby 1.8.7 (2009-04-08 patchlevel 160) [powerpc-darwin9] > > By the way, my ruby install is via port, in case that matters. > $ which ruby > /opt/local/bin/ruby > > > At this point I am just confused and curious about what's going on. > What's up with that -rubygems switch? in fact it's just the -r switch with ubygems to load I have the ubygems.rb in /usr/lib/ruby/site_ruby/1.8/ and the first line says: # This file allows for the running of rubygems with a nice # command line look-and-feel: ruby -rubygems foo.rb all code it contains is: require 'rubygems'