4. Advanced Questions

The simpliest way is to run the command:

gem server

This will serve all your installed gems from your local machine. The URL for the server will be http://YOURHOSTNAME:8808. Use the --help option on gem_server for a complete list of options.

Don’t forget to check out the easy answer for running a simple gem server.

But is is also fairly easy to serve gems from static files on an existing web server. Here’s what you need to do.

  1. Create a directory in the public files area of your web server (we will call that directory BASEDIR in the following instructions).
  2. Create the subdirectory BASEDIR/gems.
  3. Copy any gems you wish to serve into the BASEDIR/gems subdirectory.
  4. Run the generate_index gem command in order to generate the yaml and yaml.Z files needed by the RubyGems client. The command will look something like this:
gem generate_index -d BASEDIR

That’s it. The URL for the server will be whatever URL references BASEDIR_. Just rerun the @generateindex@ gem command whenever you add (or remove) gems from the server.