tags:

views:

53

answers:

2

i discovered a problem when cron tries to run a ruby script which uses some library.

require "library"

#do some stuff

it complains about not being able to find library.rb

so i was wondering if i could do something like require "/var/dir/library.rb"

+1  A: 

Yes, you can do that. You could also simply add the directory where your files are to the list of paths in $:, either with the -I argument, the RUBYLIB environment variable or just by doing $: << 'some_directory'.

Chuck
sorry...how can i add the directory ?
ggggggggg
for example - $: << '/var/dir/' or $LOAD_PATH << '/var/dir/'. "library" is a gem or independent file?
aaz
A: 

if you're using 1.9 require_relative is your friend

rogerdpack