8. Distributing Gems

Building and distributing gems with rubygems.org is easy. As of RubyGems 1.3.6, rubygems.org is now fully integrated into the main rubygems suite, and gems can be built and published with ease:

gem build foo.gemspec
gem push foo-1.0.0.gem

The gem push command will instantly deploy your gem to the rubygems.org servers, and other users will be able to install it using gem install.

Make your gem available on a web site for FTP site for downloading. Users can get the gem with conventional internet tools (e.g. browsers and FTP clients) and do a local install.

By running gem server on your box, you can serve your entire set of installed gems to anyone.

The documentation for gem server is available through the built in help system, and the following commands provide further useful information for gem server and gem index hosting:

gem help server
gem help generate_index

By default the gem server will start a server on localhost:8808

Users can install gems from this server using the --source option to gem install, for example:

gem install --source http://mygemserver:8808/ rake

RubyForge (http://rubyforge.org) will automatically deploy any .gem file you upload to a project download area to rubygems.org.