Add local gems repositories (#153)

In-house gems have nowhere to publish: gems locals only take raw file uploads, which `gem push`, `gem install` and bundler cannot use.

- accept `gem push` (`POST <repo>/api/v1/gems`, 256MiB cap, 8MiB metadata cap) and `gem yank` (`DELETE <repo>/api/v1/gems/yank`); any API key works
- parse the gemspec from the `.gem`; reject an existing name-version-platform with 409
- serve the compact index (`versions`, `info/<gem>`, `names`), `.gem` files and generated `quick/Marshal.4.8` specs; no legacy `specs.4.8.gz`
- route HEAD on locals (gem probes `versions` with HEAD)
- add `docs/gems/local.md`, a UI snippet and a stock `ruby:3.3` e2e-docker case

Reviewed-on: #153
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #153.
This commit is contained in:
2026-10-18 01:12:37 +11:00
committed by BenVincent
parent 2c671a1be7
commit 7dd7fc70d1
10 changed files with 1206 additions and 3 deletions
+20 -1
View File
@@ -2,7 +2,26 @@ import type { PackageTypeUI } from '../types';
const def: PackageTypeUI = {
color: 'red',
snippets: ({ proxy }) => {
snippets: ({ name, url, proxy, isLocal }) => {
if (isLocal) {
const src = `${url}/api/v1/local/${name}`;
return [
{
title: 'Push and yank',
language: 'bash',
code: `GEM_HOST_API_KEY=unused gem push --host ${src} <gem>-<version>.gem
GEM_HOST_API_KEY=unused gem yank <gem> -v <version> --host ${src}`,
note: 'gem push needs an API key; any value works. Pushing an existing version is rejected.',
},
{
title: 'Install',
language: 'bash',
code: `gem install <gem> --source ${src}/
# Gemfile
source "${src}/"`,
},
];
}
return [
{
title: 'Use this remote as the RubyGems source',