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

Jamis Buck jgb3 at email.byu.edu
Wed Mar 17 12:41:42 EST 2004

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 think I remember this whole topic being debated on ruby-talk, but I 
could be wrong.  I don't remember what the consensus was, but I presume 
that because RubyGems is taking this approach it was the one the 
majority liked.  Or at least, the RubyGems developers like it. ;)

Jamis Buck
jgb3 at email.byu.edu

ruby -h | ruby -e 
'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << 
r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'

More information about the Rubygems-developers mailing list