RubyGems repositories work with the gem and bundle clients. The examples use the conventional names rubygems-proxy and rubygems-hosted.

Connecting to the proxy

Point Bundler at the proxy repository with a mirror:

bundle config mirror.https://rubygems.org https://<GALLEON_HOST>/repository/rubygems-proxy

Installing a single gem — the flag order matters, --clear-sources must precede --source:

gem install colorize --clear-sources \
  --source https://<USERNAME>:<PASSWORD>@<GALLEON_HOST>/repository/rubygems-proxy

Installing from the hosted repository

Gems published to the hosted repository are wired as a source in the Gemfile:

source "https://<GALLEON_HOST>/repository/rubygems-hosted" do
  gem "foo"
end

Bundler credentials are set with a command (it works for the mirror from the previous section as well):

bundle config set --global <GALLEON_HOST> <USERNAME>:<PASSWORD>

Publishing

The gem client sends the authorization key value verbatim, so ~/.gem/credentials stores a ready Basic <BASE64> string (the file must have 0600 permissions):

---
:galleon: Basic <BASE64>
gem build foo.gemspec
gem push foo-1.0.0.gem --key galleon --host https://<GALLEON_HOST>/repository/rubygems-hosted

Specifics

Format specifics:

  • Published versions are immutable: re-publishing the same version is rejected.
  • The gem yank command is not supported — a version is deleted through the web interface with the “Delete component” button (the delete privilege is required).
  • Dependency resolution uses the Compact Index protocol; the classic commands (gem fetch, gem list --remote) work as well.