# Load "file-name" question

**URL:** <https://www.ruby-forum.com/t/load-file-name-question/106897>\
**Category:** Ruby\
**Created:** [June 15, 2007, 5:10am UTC](https://www.ruby-forum.com/t/load-file-name-question/106897 "2007-06-15T05:10:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [June 15, 2007, 5:10am UTC](https://www.ruby-forum.com/t/load-file-name-question/106897/1 "2007-06-15T05:10:33Z")

</div>

Hello all,

This is my first post to this forum and I am a ruby nood who usually  
does C# development.

I am working on a little app and have seperated my classes into  
different files. I put all of those file into a directory called lib.  
like this

trunk  
-----lib  
-------JobList.rb  
-----tests  
-------JobListTest.rb  
-----testfiles

In the test dir I have a file that does some unit testing. If I put

load ‘…/lib/JobList’

It works. But I am thinking that maybe this isn’t the best “Ruby way” to  
do it.  
Amy advise on how I should set up my project and use the load method?

Hmm. I just noticed that maybe I should put a single directory under  
trunk as the root dir of my project?  
BTW you can see all of this on Google code if it helps @  
[http://code.google.com/p/autosysjilreader/](http://code.google.com/p/autosysjilreader/)

Thanks in advance.  
MoeBious

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [June 15, 2007, 5:15am UTC](https://www.ruby-forum.com/t/load-file-name-question/106897/2 "2007-06-15T05:15:44Z")

</div>

David Moody wrote:

> Hello all,
> 
> This is my first post to this forum and I am a ruby nood who usually  
> does C# development.
> 
> I am working on a little app and have seperated my classes into  
> different files. I put all of those file into a directory called lib.  
> like this
> 
> trunk  
> -----lib  
> -------JobList.rb  
> -----tests  
> -------JobListTest.rb  
> -----testfiles
> 
> In the test dir I have a file that does some unit testing. If I put
> 
> load ‘…/lib/JobList’
> 
> It works. But I am thinking that maybe this isn’t the best “Ruby way” to  
> do it.  
> Amy advise on how I should set up my project and use the load method?
> 
> Hmm. I just noticed that maybe I should put a single directory under  
> trunk as the root dir of my project?  
> BTW you can see all of this on Google code if it helps @  
> [http://code.google.com/p/autosysjilreader/](http://code.google.com/p/autosysjilreader/)
> 
> Thanks in advance.  
> MoeBious

EDIT

I should have said require “…/lib/JobList”

I am using require not load. Sorry for any confusion.

thanks  
MoeBious

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [June 15, 2007, 5:58am UTC](https://www.ruby-forum.com/t/load-file-name-question/106897/3 "2007-06-15T05:58:34Z")

</div>

David Moody wrote:

> David Moody wrote:
> 
> > Hello all,
> > 
> > This is my first post to this forum and I am a ruby nood who usually  
> > does C# development.
> > 
> > I am working on a little app and have seperated my classes into  
> > different files. I put all of those file into a directory called lib.  
> > like this
> > 
> > trunk  
> > -----lib  
> > -------JobList.rb  
> > -----tests  
> > -------JobListTest.rb  
> > -----testfiles
> > 
> > In the test dir I have a file that does some unit testing. If I put
> > 
> > load ‘…/lib/JobList’
> 
> MoeBious

Its looks good. I cant really see the problem. As far as i know  
filesystems use ‘…’ notation no matter what the operating system. It’s  
not a long line and if it works it’s good. And its perfectly readable.

Dont worry about it.

Aatch

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [June 15, 2007, 9:21am UTC](https://www.ruby-forum.com/t/load-file-name-question/106897/4 "2007-06-15T09:21:46Z")

</div>

David Moody wrote:

> > trunk  
> > -----lib  
> > -------JobList.rb  
> > -----tests  
> > -------JobListTest.rb  
> > -----testfiles
> > 
> > In the test dir I have a file that does some unit testing. If I put
> > 
> > load ‘…/lib/JobList’

I usually handle this by having a file ‘test/boottest.rb’ that looks  
like this (along with whatever other project-specific bits and pieces I  
might need across all test files):

$app\_dir = File.expand\_path(File.join(File.dirname( **FILE** ), ‘…’))  
$:.unshift($app\_dir)

That means that I can handle all the requires as though from the project  
root, so the top of a test file might look like this:

require ‘boottest’  
require ‘test/TestModules’  
require ‘lib/JobList’

It simplifies things a little, because then there’s less confusion as to  
which files are being required.
