[Rubygems-developers] where to stash non-library files

Chad Fowler chad at chadfowler.com
Wed Mar 17 16:53:26 EST 2004

On Wed, 17 Mar 2004, Jamis Buck wrote:

# Leon Torres wrote:
# > Hi folks, 
# > 
# > At the request of one of the Log4r contributors (Hi Jamis!), we'll be
# > distributing log4r as a gem. For the bare bones install (just the library),
# > rubygems does a fine job. However, log4r has a lot of HTML documentation
# > and a directory full of example scripts. Where do these go in the rubygem
# > context?  I see that Rdoc has its own special home, but what of the
# > other lonely non-rdoc files? It seems silly to clog the lib directory with
# > all the miscellaneous stuff. The HTML can be left out, but the example
# > scripts ought to go somewhere. There are also things like the unit tests
# > included for troubleshooting purposes, the readme files, etc.
# I may be stating stuff you already know, Leon, so please forgive me.  I 
# just want to make sure that what I'm saying is understood. :)
# 1. RubyGems (for me) installs all gems (everything in the gem package) 
# under /usr/lib/ruby/gems/1.8/<gem-name> .  This makes it extremely easy 
# to uninstall gems, since you just have to delete the <gem-name> 
# directory.  I much prefer this approach to spreading everything all over 
# the file system.  It also makes it extremely simple to find all the 
# files associated with a given gem.
# 2. When a gem is required, RubyGems modifies the require path to point 
# to the the 'require_path' that was specified in the gemspec file.  Thus, 
# even if you put all your docs, samples, and so forth under the gem 
# directory, they don't pollute the require path at all.
# For my Copland gem, I included documentation, examples, and test cases, 
# all under the gem directory.  It seems to work pretty well.  The cgikit 
# gem (for example) also puts its fairly extensive documentation there. 
# And if you use the --gen-rdoc option to gem, it will put all the rdoc 
# files under the gem directory, too.

I pretty much agree with Jamis here.  One of the different things to think 
about with RubyGems, is that installing something "into a gem" is not the 
same as the traditional Ruby "installing into /lib".  Each gem has its own 
lib directory, and it makes sense to me that all things related to a given 
gem should stay together.  Another item that's on the TODO list is to 
integrate unit testing in basically the same simple way we did rdoc.  You 
would ideally put all tests in a "test" directory of some sort 
(configurable via the gemspec), and you would specify which file contains 
your suite.  That would allow you to do stuff like:

gem --run-tests --version 1.4.3 --name log4r 

(I don't really like the --name thing here, but I'm typing this on my way 
out the door.)

We could also allow gem developers to specify that tests should be run 
during installation, with a message such as:

1/50 tests failed...proceed with installation? [y/N]

What are your opinions, everyone?  I'm going to put the testing thing on 
the top of my TODO list.


More information about the Rubygems-developers mailing list