Working with RubyGems
CodeScoring.Save supports Bundler and the gem CLI through the RubyGems compact index:
- Proxy — installs gems from
rubygems.orgor another compact-index source and caches.gemfiles on first download. - Hosted — stores your own gems and updates the index when you publish or yank a version.
Creating a Repository
Open a project, click Create repository, and select Format: RubyGems and Type: Proxy or Hosted. For a proxy, set Proxy URL to the upstream root (for example, https://rubygems.org) and Cache TTL, seconds for index metadata. A hosted repository needs no upstream.
Example: create a proxy through the API with an admin token:
Client Configuration
Copy the repository URL from Useful snippets. In your Gemfile, use it as the source:
For a private repository, configure Basic authentication for that source. Here SAVE_API_KEY is the API key of a robot account with artifacts.download permission:
To install without Bundler, pass credentials in the source URL. --clear-sources makes gem use only the specified repository for this install:
For internal gems, use the hosted repository URL instead.
Publishing to a Hosted Repository
Build the package from its .gemspec, then push it with artifacts.upload permission. Include Bearer in GEM_HOST_API_KEY: gem push and gem yank send its value unchanged as the Authorization header.
To withdraw a version, use gem yank with artifacts.delete permission:
Without --platform, yank selects the ruby build. For a native build, add its platform, e.g. --platform x86_64-linux. Only the selected build disappears from the index and downloads. A published name/version/platform cannot be pushed again, even after a yank or deletion (409); publish a new version instead.
Troubleshooting
Check the versions and dependencies known to Save for a specific gem:
- Install works, but push is rejected. Use the hosted URL for
--host. Bundler's read credentials do not configuregem push; checkGEM_HOST_API_KEYand upload permission. - The client requests
specs.4.8.gz. Use a compact-index client. Save does not serve the legacy full index or remote search. - The hosted index is out of sync. With
repo.updatepermission, runcurl -fsS -X POST -H "Authorization: Bearer $SAVE_API_KEY" "$GEM_HOST/rebuild-index". Normal pushes and yanks update the index automatically.
