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
source "https://hopper.pkg.polypack.io/rubygems/" do
gem "hopper-widgets"
end
bundle config set --global https://hopper.pkg.polypack.io/rubygems/ <your Token>
bundle install
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
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
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 yankworks 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 whoseGemfile.lockpins it stop installing.- Every pushed gem is checked for likely secrets (an
.envfile, 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
- 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.