4. Advanced Questions
4.1 How do I run my own gem server?
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.
4.2 How do I run a gem server like rubyforge?
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/
gems. - Copy any gems you wish to serve into the BASEDIR/
gemssubdirectory. - Run the
generate_indexgem command in order to generate theyamlandyaml.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 generate_index gem command whenever you add (or remove) gems from the server.