how to setup path

Discussion in 'Ruby' started by Junkone, Oct 21, 2007.

  1. Junkone

    Junkone Guest

    how to setup the ruby path that my code can look at runtime for the
    libraries.
     
    Junkone, Oct 21, 2007
    #1
    1. Advertising

  2. Junkone

    Thomas Adam Guest

    Hi --

    On 21/10/2007, Junkone <> 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
     
    Thomas Adam, Oct 21, 2007
    #2
    1. Advertising

  3. 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/.
     
    Michael Linfield, Oct 21, 2007
    #3
  4. Junkone

    Thomas Adam Guest

    On 21/10/2007, Michael Linfield <> 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
     
    Thomas Adam, Oct 21, 2007
    #4
  5. Thomas Adam wrote:
    > On 21/10/2007, Michael Linfield <> 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! :D
    --
    Posted via http://www.ruby-forum.com/.
     
    Michael Linfield, Oct 21, 2007
    #5
  6. Junkone

    Paul Guest

    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"]
     
    Paul, Oct 22, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Frank Esser

    Target path for web setup?

    Frank Esser, Apr 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    435
    Martin Weber
    Apr 8, 2005
  2. google 24/7
    Replies:
    0
    Views:
    409
    google 24/7
    Feb 18, 2006
  3. Humpdydum

    path problem with "setup.py bdist"

    Humpdydum, Nov 3, 2004, in forum: Python
    Replies:
    0
    Views:
    340
    Humpdydum
    Nov 3, 2004
  4. Chris Shenton
    Replies:
    1
    Views:
    1,491
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Aug 24, 2007
  5. Intransition

    [ANN] Ruby Setup 5 (setup.rb)

    Intransition, Jan 13, 2010, in forum: Ruby
    Replies:
    0
    Views:
    443
    Intransition
    Jan 13, 2010
Loading...

Share This Page