Add gems remote type for RubyGems
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful

- add gems package type proxying the compact index and .gem/quick gemspec downloads
- route HEAD on /api/v1/remote/* so gem detects the compact index
This commit is contained in:
2026-10-16 23:20:00 +11:00
parent 9161558334
commit 95d81c1af0
14 changed files with 155 additions and 1 deletions
+1
View File
@@ -40,6 +40,7 @@ func NewProxyHandler(engine *proxy.Engine, virtualEngine *virtual.Engine, db *da
func (h *ProxyHandler) Routes() chi.Router {
r := chi.NewRouter()
r.Get("/remote/{remoteName}/*", h.handleProxy)
r.Head("/remote/{remoteName}/*", h.handleProxyHead)
r.Get("/local/{localName}/*", h.handleLocal)
r.Get("/virtual/{virtualName}/*", h.handleVirtual)
return r
+17
View File
@@ -0,0 +1,17 @@
package v1
import (
"net/http"
"testing"
"github.com/go-chi/chi/v5"
)
func TestRoutesRemoteHead(t *testing.T) {
r := (&ProxyHandler{}).Routes()
for _, m := range []string{http.MethodGet, http.MethodHead} {
if !r.Match(chi.NewRouteContext(), m, "/remote/rubygems/versions") {
t.Errorf("%s /remote/rubygems/versions not routed", m)
}
}
}