Skip to content
PolyPack
Docs: RubyGems

RubyGems

Push private Ruby gems to PolyPack and install them with Bundler or gem, with Tokens and your Clients' Grants.

A RubyGems Pack is a Ruby gem and its versions, served from your Team's host under https://hopper.pkg.polypack.io/rubygems/ to Bundler and gem, with the same Tokens, Clients, Grants and download statistics as any Pack. RubyGems is part of Plans that include it. PolyPack works with the RubyGems and Bundler that ship with Ruby 3.3, 3.4 and 4.0.

Install

Add to the Gemfile · safe to commit. List every one of this Team's gems inside the block, those you need only as another's dependency too, so Bundler never takes a public gem of the same name
source "https://hopper.pkg.polypack.io/rubygems/" do
  gem "hopper-widgets"
end
Store your Token · once per machine; it goes in your own Bundler config, never the Gemfile
bundle config set --global https://hopper.pkg.polypack.io/rubygems/ <your Token>
Install
bundle install
Or with gem install · only PolyPack is asked, so a public gem of the same name is never installed instead; for gems with public dependencies, use Bundler. The Token is in POLYPACK_TOKEN; without it, gem says only "Could not find a valid gem"
gem install hopper-widgets --clear-sources --source "https://$POLYPACK_TOKEN@hopper.pkg.polypack.io/rubygems/"

Gem names have no namespace, so a public gem on rubygems.org can have the same name as yours. Inside the source block, Bundler takes those gems only from PolyPack. List every one of your Team's gems in the block, including those you only need as another gem's dependency. PolyPack also checks rubygems.org for a public gem with your private gem's name, when the Pack is made and every night, and tells your Admins if it finds one.

Each person stores their Token once, with bundle config: it goes in their own Bundler config, never in the Gemfile. A Client sees only the versions its Grant covers, everywhere Bundler and gem look.

Publish

Push a gem · with a Token that can publish; or keep it in ~/.gem/credentials under that host. Push each platform gem of a version within 72 hours of the first
gem build hopper-widgets.gemspec
GEM_HOST_API_KEY=<your Token> gem push --host https://hopper.pkg.polypack.io/rubygems hopper-widgets-1.0.0.gem
Yank a version · within 72 hours of pushing it; after that, a Team Admin removes it here. Its number can never be pushed again
GEM_HOST_API_KEY=<your Token> gem yank hopper-widgets -v 1.0.0 --host https://hopper.pkg.polypack.io/rubygems
  • The first push makes the Pack, private, if your Plan has room. Its name is the gem's, case and all. Names that differ only in case, or in - and _, cannot both be in one Team.
  • A version is pushed once. A gem built for several platforms (x86_64-linux, arm64-darwin, …) is one version: push each platform's gem within 72 hours of the first.
  • gem yank works for 72 hours after a version is pushed. After that, a Team Admin yanks it on the Pack's page. A yanked version's number is never used again, and projects whose Gemfile.lock pins it stop installing.
  • Every pushed gem is checked for likely secrets (an .env file, a private key, a cloud token) and refused if it has one, unless an Admin set the Pack to warn only.

From GitHub Actions

A release workflow can push gems with no PolyPack Token stored in GitHub: an Admin adds a trusted publisher to the Pack, and PolyPack's GitHub Action pushes the gems you built, with rubygems: '*.gem'. Each gem pushed this way carries signed provenance, which polypack verify gem hopper-widgets@1.4.0 checks (see Signatures and provenance).

Update bots

Renovate and Dependabot can update your Team's gems too: the Pack's Update bots tab gives Renovate's host rule and Dependabot's rubygems-server registry, with a Token kept as the bot's secret.

In CI

GitHub Actions · a workflow job's step; store a Team Token as the secret POLYPACK_TOKEN (Settings → Secrets → Actions). Bundler reads credentials for this host from BUNDLE_HOPPER__PKG__POLYPACK__IO
- run: bundle install
  env:
    BUNDLE_HOPPER__PKG__POLYPACK__IO: ${{ secrets.POLYPACK_TOKEN }}

Bundler reads a host's credentials from an environment variable named after it, so nothing about the Token goes in your repository.