require problem

S

Simone D.

Hi all,
I'm trying to create a gem, I have this directory structure:

mygem
|-lib
|-mygem.rb
|-mygem
|-file1.rb
|-file2.rb

In mygem.rb I want to require file1.rb and file2.rb, if I try simply
with
require 'file1.rb'
it doesn't work, so I added
$:.unshift File.join(File.dirname(__FILE__), 'mygem')
so in $: I have mygem/lib/mygem/ directory but the require doesn't work
and I'm getting
LoadError: no such file to load -- file1.rb

I'm trying to work it on ruby 1.8.7

Any idea?

Thanks a lot!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top