how to structure ruby libraries ?

M

markusjais

hello

we are building a new ruby library which will probably consist of several
dozens of source files.
we want to package it in a gem.

are there any conventions on how to structure the directories of the
library ?
in some libs I found something like this

ls -l mylib-1.0.0.0
doc
examples
lib
pkg
Rakefile
README
test

Rakefile and README would be files, the rest directories.
Rakefile would be use for building the gem.

the lib directory would look like this:
ls -l lib
mylib.rb
mylib

and within mylib there would be all the source code

are there any conventions on how to do this ?

Markus
 
T

transfire

hello

we are building a new ruby library which will probably consist of several
dozens of source files.
we want to package it in a gem.

are there any conventions on how to structure the directories of the
library ?
in some libs I found something like this

ls -l mylib-1.0.0.0
doc
examples
lib
pkg
Rakefile
README
test

Rakefile and README would be files, the rest directories.
Rakefile would be use for building the gem.

the lib directory would look like this:
ls -l lib
mylib.rb
mylib

and within mylib there would be all the source code

are there any conventions on how to do this ?

http://i.loveruby.net/en/projects/setup/doc/devel.html

T.
 
G

Gerald Murray

Hi Markus,

Most of the installed libraries have used (for example)
/usr/local/lib/ruby/site_ruby/1.8/:
mylib.rb
mylib/

as you have shown.

Some of the more recent additions install just the single directory
/usr/local/lib/ruby/site_ruby/1.8/svg/:
svg.rb
{other files}

This last is from rubysvg-1.0.3 package.
An application that uses that library has this require:

require "svg/svg"

I prefer the latter, as this tends to keep all installed files under
one
directory, (the difference over the former is a small preference)

Best Regards,
Gerald
 

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,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top