Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > how to setup path

Reply
Thread Tools

how to setup path

 
 
Junkone
Guest
Posts: n/a
 
      10-21-2007
how to setup the ruby path that my code can look at runtime for the
libraries.

 
Reply With Quote
 
 
 
 
Thomas Adam
Guest
Posts: n/a
 
      10-21-2007
Hi --

On 21/10/2007, Junkone <(E-Mail Removed)> wrote:
> how to setup the ruby path that my code can look at runtime for the
> libraries.


If it's a non-standard path, try:

$LOAD_PATH.unshift( '/some/path/to/wherever' )
require 'mylib'

-- Thomas Adam

 
Reply With Quote
 
 
 
 
Michael Linfield
Guest
Posts: n/a
 
      10-21-2007
Junkone wrote:
> ruby path


correct me if im wrong but wouldnt you just use the shebang? Of course
this would be if your libraries were in fact still in the default ruby
installation folders, the only reason you would need to use this would
be if u moved the entire ruby folder elsewhere. Sorry Thomas if this is
what u were explaining.

#!/path/name/here



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

 
Reply With Quote
 
Thomas Adam
Guest
Posts: n/a
 
      10-21-2007
On 21/10/2007, Michael Linfield <(E-Mail Removed)> wrote:
> Junkone wrote:
> > ruby path

>
> correct me if im wrong but wouldnt you just use the shebang? Of course
> this would be if your libraries were in fact still in the default ruby
> installation folders, the only reason you would need to use this would
> be if u moved the entire ruby folder elsewhere. Sorry Thomas if this is
> what u were explaining.


Changing the shebang would only change where to find the ruby
interpreter, _not_ where Ruby itself looked for its libraries. Of
course, there's every need during development to have various files
under some non-standard location (such as
~/projects/ruby/my_new_library) -- it is at this point that adding to
$LOAD_PATH is the right thing to do.

-- Thomas Adam

 
Reply With Quote
 
Michael Linfield
Guest
Posts: n/a
 
      10-21-2007
Thomas Adam wrote:
> On 21/10/2007, Michael Linfield <(E-Mail Removed)> wrote:
>> Junkone wrote:
>> > ruby path

>>


> Changing the shebang would only change where to find the ruby
> interpreter, _not_ where Ruby itself looked for its libraries. Of
> course, there's every need during development to have various files
> under some non-standard location (such as
> ~/projects/ruby/my_new_library) -- it is at this point that adding to
> $LOAD_PATH is the right thing to do.
>
> -- Thomas Adam


Thanks, good to know!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      10-22-2007
C:\Documents and Settings\user>irb
irb(main):001:0> $:
=> ["c:/ruby/lib/ruby/site_ruby/1.8", "c:/ruby/lib/ruby/site_ruby/1.8/
i386-msvcr
t", "c:/ruby/lib/ruby/site_ruby", "c:/ruby/lib/ruby/1.8", "c:/ruby/lib/
ruby/1.8/
i386-mswin32", "."]
irb(main):002:0> $: << 'c:/mylib'
=> ["c:/ruby/lib/ruby/site_ruby/1.8", "c:/ruby/lib/ruby/site_ruby/1.8/
i386-msvcr
t", "c:/ruby/lib/ruby/site_ruby", "c:/ruby/lib/ruby/1.8", "c:/ruby/lib/
ruby/1.8/
i386-mswin32", ".", "c:/mylib"]



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
[ANN] Ruby Setup 5 (setup.rb) Intransition Ruby 0 01-13-2010 04:24 PM
python setup.py: how to override a setup.cfg value ? Chris Shenton Python 1 08-24-2007 06:27 AM
Windows XP Setup Restarts the Setup Program =?Utf-8?B?UmFkYXIxNjU=?= Windows 64bit 21 12-14-2005 04:27 AM
Target path for web setup? Frank Esser ASP .Net 1 04-08-2005 08:37 AM



Advertisments