[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Using RubyGems

Nathan Farrar

9/14/2006 1:41:00 AM

I'm reading through the RubyGems docs and found this:

Using RUBYOPT

By setting the RUBYOPT environment variable to the value rubygems, you
tell Ruby to load RubyGems every time it starts up. This is similar to
the -rubygems options above, but you only have to specify this once
(rather than each time you run a Ruby script).

Unix users will want to put the following line in their .profile (or
equivalent):
export RUBYOPT=rubygems

I'm new to unix. I'm using ubuntu. How would I do this, do I really
want to do this, and what exactly does it do?
Thanks Again. :)

--
Posted via http://www.ruby-....

1 Answer

Tim Becker

9/14/2006 6:34:00 AM

0

Unix shells are customizable through a system of environment variables
(Among other things). Try typing the command:

env

and you see a list of all the variables currently set in your
environment. These specify can everything from how you'd like your
prompt to appear and what editor you prefer to use.

Programmes you start from the shell are able to inspect the
environment variables that are set. For example if you commit
something in cvs or svn, the version control software looks at the
$EDITOR variable to determine what editor to launch for you to compose
the comments for the commit in.

Ruby also looks at a number of environment variables. If $RUBYOPT is
set to some value, the interpreter behaves as if that value was set as
a command line option. So if there's some command line option you find
yourself using with every call to the ruby interpreter, set that
option in RUBYOPT. (i.e. if you find yourself calling `ruby -w` all
the time, you can do `export RUBYOPT="-w" and just call `ruby` in
future)

Problem is, that now you'll need to set the value of RUBYOPT every
time you start a new shell. That's where `.profile` comes in.
`.profile` is a file that the shell executes each time it starts up.

The main disadvantage to setting stuff like this up is that these
sorts of little tweaks tend to make your system messy sooner or
later.. One also tends to forget about these sorts of helpers, so at
some point you'll find yourself on a different system wondering why
all your script don't work. Apart from that, it's basically standard
Unix fare.

Cheers,
-tim




On 9/14/06, Nathan Farrar <atraeyu@gmail.com> wrote:
> I'm reading through the RubyGems docs and found this:
>
> Using RUBYOPT
>
> By setting the RUBYOPT environment variable to the value rubygems, you
> tell Ruby to load RubyGems every time it starts up. This is similar to
> the -rubygems options above, but you only have to specify this once
> (rather than each time you run a Ruby script).
>
> Unix users will want to put the following line in their .profile (or
> equivalent):
> export RUBYOPT=rubygems
>
> I'm new to unix. I'm using ubuntu. How would I do this, do I really
> want to do this, and what exactly does it do?
> Thanks Again. :)
>
> --
> Posted via http://www.ruby-....
>
>