Depot Packages

RubyGems and Bundler

Use the built-in rubygems cache for RubyGems.org dependencies, or a Virtual repository for private and upstream gems.

Configure with the Depot CLI

Run depot packages configure with bundler or gem:

depot packages configure bundler --org <org-id> --repository rubygems

For Bundler, the command saves the credential in your Bundler user configuration. For the built-in rubygems cache, it also adds a mirror so Bundler downloads RubyGems.org gems through Depot. For other repositories, the output shows the source line to add to your Gemfile.

For gem, the command adds the repository to your gem sources and saves a push key named depot-<org-id>_<repository>. For the built-in rubygems cache, it also removes https://rubygems.org/ from your gem sources. Publish with gem push --key depot-<org-id>_<repository> --host <repository-url> <gem-file>.

Add --replace-upstream to route RubyGems.org through a Virtual repository that includes it.

Install gems

Use a Virtual repository as the source in your Gemfile:

source "https://packages.depot.dev/<org-id>/rubygems/team/"

gem "rake"

With a DEPOT_TOKEN in your environment, supply Bundler's host credential:

export BUNDLE_PACKAGES__DEPOT__DEV="depot:${DEPOT_TOKEN}"
bundle install

Bundler replaces dots with double underscores when mapping host configuration to environment variables. A credential for packages.depot.dev applies at the host level, so use an identity with access to the organizations you need. See Bundler configuration.

Don't put authenticated source URLs in your Gemfile or lock file. For a manual standalone gem install, pass the authenticated source for that command:

gem install rake --clear-sources \
  --source "https://depot:${DEPOT_TOKEN}@packages.depot.dev/<org-id>/rubygems/rubygems/"

For publishing to a Private or writable Virtual repository, build the gem with gem build widget.gemspec, then set GEM_HOST_API_KEY="$DEPOT_TOKEN" and run gem push --host <repository-url> <package.gem>.

Publish from CI with trusted publishing

rubygems/configure-rubygems-credentials can get a short-lived Depot token for gem push without a stored token. Add a trust policy to the Private repository first. See trusted publishing for RubyGems.