(unknown)

Hello,

This must have been already asked but I can't find anyhting the ruby-talk archives:

What's the ruby equivalent of java classpath ? How can i print in a ruby script this "classpath" ?

Thank you,
Adrian.

$LOAD_PATH

-austin

···

On 7/26/05, Adrian Petru Dimulescu <adrian.dimulescu@free.fr> wrote:

Hello,

This must have been already asked but I can't find anyhting the ruby-talk
archives:

What's the ruby equivalent of java classpath ? How can i print in a ruby
script this "classpath" ?

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

p $:

   require 'English'

   p $LOAD_PATH

cheers.

-a

···

On Tue, 26 Jul 2005, Adrian Petru Dimulescu wrote:

Hello,

This must have been already asked but I can't find anyhting the ruby-talk archives:

What's the ruby equivalent of java classpath ? How can i print in a ruby script this "classpath" ?

Thank you,
Adrian.

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
My religion is very simple. My religion is kindness.
--Tenzin Gyatso

===============================================================================

I believe you are looking for the $: variable (or the alias $LOAD_PATH):

irb(main):001:0> $:
=> ["/usr/local/lib/ruby/site_ruby/1.8", "/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin7.7.0", "/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/1.8", "/usr/local/lib/ruby/1.8/powerpc-darwin7.7.0", "."]
irb(main):002:0> $LOAD_PATH
=> ["/usr/local/lib/ruby/site_ruby/1.8", "/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin7.7.0", "/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/1.8", "/usr/local/lib/ruby/1.8/powerpc-darwin7.7.0", "."]

They're basically Arrays so you can push/unshift new entries. The Ruby command-line option -I will also add directories.

Hope that helps.

James Edward Gray II

···

On Jul 26, 2005, at 7:40 AM, Adrian Petru Dimulescu wrote:

Hello,

This must have been already asked but I can't find anyhting the ruby-talk archives:

What's the ruby equivalent of java classpath ? How can i print in a ruby script this "classpath" ?

I'm not sure if that's what you want, but:

ruby -e 'puts $:.join(", ")'

Why do you want to know the "classpath"?

···

On Tue, Jul 26, 2005 at 09:40:24PM +0900, Adrian Petru Dimulescu wrote:

Hello,

This must have been already asked but I can't find anyhting the ruby-talk
archives:

What's the ruby equivalent of java classpath ? How can i print in a ruby
script this "classpath" ?

--
Esteban Manchado Velázquez <zoso@foton.es> - http://www.foton.es
EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es

Thanks a lot, and sorry for the lack of subkect -- but I realize I still can't solve my problem.

I just installed log4r using

# gem install log4r

and it worked ok as far as the following command says:

# gem list log4r

*** LOCAL GEMS ***

log4r (1.0.5)
     Log4r is a comprehensive and flexible logging library for Ruby.

Still, if I run the following script

$ ruby -e 'require "log4r"'

I get:

-e:1:in `require': No such file to load -- log4r (LoadError)
         from -e:1

So I can't seem to be able to use the log4r package installed via gem.

I also tried

$ ruby -I/usr/lib/ruby/gems/1.8/gems/log4r-1.0.5-/src/log4r -e 'require "log4r"'

getting the same error.

Could you kindly guide me?
Thanks,
Adrian.

Esteban Manchado Velázquez wrote:

Why do you want to know the "classpath"?

Hello,

I wanted to know the classpath (it is solved now :slight_smile: because I installed a Ruby library -- and installed it well I thought -- but my scripts complained about not finding that library.

Regards,
Adrian.

Adrian Petru Dimulescu wrote:

So I can't seem to be able to use the log4r package installed via gem.

I think depending on how you installed gems, you might need to use require_gem instead of require:

require_gem 'log4r'

Sorry for my last message, that won't help.

http://docs.rubygems.org/read/chapter/3#page70

Adrian Petru Dimulescu wrote:

$ ruby -e 'require "log4r"'

$ ruby -rubygems -e 'require "log4r"'

···

--
J Lambert

Thanks! I would have expected it to "just work", somowhat like "perl -MPCAN" -- it seems that simpler usage is on the priority list of future versions of gem.

Joe Cheng wrote:

···

Sorry for my last message, that won't help.

http://docs.rubygems.org/read/chapter/3#page70

use rpa.

-a

···

On Wed, 27 Jul 2005, Adrian Petru Dimulescu wrote:

Thanks! I would have expected it to "just work", somowhat like "perl -MPCAN" -- it seems that simpler usage is on the priority list of future versions of gem.

Joe Cheng wrote:

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
My religion is very simple. My religion is kindness.
--Tenzin Gyatso

===============================================================================

Hi --

···

On Wed, 27 Jul 2005, Adrian Petru Dimulescu wrote:

Thanks! I would have expected it to "just work", somowhat like "perl -MPCAN" -- it seems that simpler usage is on the priority list of future versions of gem.

Hopefully RubyGems will become part of the standard Ruby package at
some point, and then anything less than smoothly integrated can be
smoothed out.

David

--
David A. Black
dblack@wobblini.net