PDA

View Full Version : Ruby no such file to load


map7
May 26th, 2009, 03:15
I'm trying to use the mailfactory gem under FreeBSD and have a feeling that this is more a Permissions problem under FreeBSD than it is a ruby problem.

Here is the test code I'm using
#!/usr/bin/env ruby

require 'net/smtp'
require 'rubygems'
require 'mailfactory'

mail = MailFactory.new()
mail.to = "<my email>"
mail.from = "<my email>"
mail.subject = "Test subject"
mail.text = "Test body"
mail.attach("/etc/fstab")

Net::SMTP.start('mail.lan', 25) { |smtp|
mail.to = toaddress
smtp.send_message(mail.to_s(), mail.from, mail.to)
}


If I run my test code as a normal user (ie: not in the wheel group) I get:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- mailfactory (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./testmailfactory.rb:5

If I run it as a wheel user then there is no problem and the email goes through to my email account fine.

map7
May 26th, 2009, 03:40
SOLVED.

Had to change permissions from 774 to 775 on the following directories
/usr/local/lib/ruby/gems
/usr/local/lib/ruby/gems/1.8
/usr/local/lib/ruby/gems/1.8/*

DutchDaemon
May 26th, 2009, 11:11
755 should be quite enough.