How to structure ruby libraries?

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

[email protected] wrote:

ls -l mylib-1.0.0.0

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs