[Rubygems-developers] Preliminary testing and executable support

Chad Fowler chad at chadfowler.com
Sat Mar 20 12:04:52 EST 2004


I have very skeletal versions of the testing and executable support 
we've talked about now checked in.  There are things about them that I 
don't like at all, so feel free to suggest changes and/or patch.

Testing is only implemented for during-installation at this point.  Gem 
developers specify spec.test_suite_file in their gemspec.  This file 
will be loaded and any tests that it references will be run when users 
execute:

   gem --remote-install rake --run-tests

...or

   gem -i rake-0.0.3.gem --run-tests

If any tests fail, you will be prompted to keep or remove the installed 
gem.

Executable installations are the uglier part.  I'm not yet happy with 
the gemspec stuff.   The following gemspec snippet will setup an 
executable to be installed:

     s.executables = ["myapp"]
     s.default_executable = "myapp"
     s.bindir = "bin"

This will result in a generated "myapp" being installed from "bin" in 
the gem distribution  into the same location as the ruby executable 
(not yet over-ridable).    The generated script looks like this:

   #!/usr/local/bin/ruby
   require 'rubygems'
   require_gem 'an-app', "0.0.1"
   load 'myapp'

...assuming that the gem is caled "an-app" and is at version 0.0.1.  To 
make the "load" work properly, I had to stuff "bin" into the 
require_path.  I'm not sure I like that yet.  The examples in our email 
exchanges would have required us to put the root gem directory into the 
require_path, which I think would have been worse.

Give these a try and let me know what you think.

Chad



More information about the Rubygems-developers mailing list