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.
- Create a directory in the public files area of your web server (we will call that directory BASEDIR in the following instructions).
- Create the subdirectory BASEDIR/
- Copy any gems you wish to serve into the BASEDIR/
- Run the
generate_indexgem command in order to generate the
yaml.Zfiles 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.