I'm on OS X 10.4.6
i want to be able to require my files without the full path. i want to keep them in my home directory so i don't lose them. i tried:
sudo ln -s /Users/curi/me/rubylib /usr/local/lib/ruby/site_ruby/myrubylib
it made the link. observe:
curi-g5:/usr/local/lib/ruby/site_ruby curi$ cd myrubylib
curi-g5:/usr/local/lib/ruby/site_ruby/myrubylib curi$ ls
curi.rb
however:
require "curi" # can't find the file
require "/Users/curi/me/rubylib/curi" # this works
require "/usr/local/lib/ruby/site_ruby/myrubylib/curi" # this works too
not sure what i'm doing wrong or how to do this properly..
BTW:
curi-g5:/usr/local/lib/ruby/site_ruby curi$ ruby -e "puts $:"
/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin8.5.0
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/powerpc-darwin8.5.0
.
-- Elliot Temple
A philosophy blog
Elliot Temple wrote:
I'm on OS X 10.4.6
i want to be able to require my files without the full path. i want to keep them in my home directory so i don't lose them. i tried:
sudo ln -s /Users/curi/me/rubylib /usr/local/lib/ruby/site_ruby/myrubylib
it made the link. observe:
curi-g5:/usr/local/lib/ruby/site_ruby curi$ cd myrubylib
curi-g5:/usr/local/lib/ruby/site_ruby/myrubylib curi$ ls
curi.rb
however:
require "curi" # can't find the file
require "/Users/curi/me/rubylib/curi" # this works
require "/usr/local/lib/ruby/site_ruby/myrubylib/curi" # this works too
not sure what i'm doing wrong or how to do this properly..
BTW:
curi-g5:/usr/local/lib/ruby/site_ruby curi$ ruby -e "puts $:"
/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin8.5.0
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/powerpc-darwin8.5.0
.
-- Elliot Temple
Curiosity Blog – Elliot Temple
Might it be simpler for you to just add your home directory to Ruby's search path by using the RUBYLIB environment variable?
export RUBYLIB=/Users/curi/me/rubylib
Try this:
# .profile/.bash_profile/.whatever
export RUBYLIB="$HOME/to/your/files
Straight out of Ruby's man page.
$ man ruby
-- Daniel
···
On Jun 4, 2006, at 8:35 PM, Elliot Temple wrote:
I'm on OS X 10.4.6
i want to be able to require my files without the full path. i want to keep them in my home directory so i don't lose them.
I'm on OS X 10.4.6
i want to be able to require my files without the full path. i want to keep them in my home directory so i don't lose them. i tried:
sudo ln -s /Users/curi/me/rubylib /usr/local/lib/ruby/site_ruby/myrubylib
<snip>
require "curi" # can't find the file
Others have already mentioned RUBYLIB, but let me note that the very myrubylib under site_ruby is *not* in $:. Thus, you'd need to specify the parent directoy as well:
require 'myrubylib/curi'
You load the core library smtp.rb as 'net/smtp' because of the same reason, smtp.rb lives in
/usr/local/lib/ruby/1.8/net/smtp.rb
and the directory in the load path there is /usr/local/lib/ruby/1.8.
RUBYLIB is the canonical solution to that, but at least you know why your test is not working.
-- fxn
···
On Jun 4, 2006, at 20:35, Elliot Temple wrote: