Ruby

SlowShield serves rubygems.org at https://slowshield.example.com/rubygems. Bundler uses it as a mirror of rubygems.org, so Gemfiles and Gemfile.lock keep naming rubygems.org; gem uses it as its only source.

Set it up

Both settings live in your home directory and cover every project on the machine:

Bundler

Release age: Bundler 4.0.13 or later (older versions ignore it). It reads the created_at that SlowShield passes on

command (writes ~/.bundle/config; also for CI and Dockerfiles)

bundle config set --global mirror.https://rubygems.org https://slowshield.example.com/rubygems

release age

bundle config set --global cooldown 3

gem

~/.gemrc: SlowShield as the only source

---
:sources:
- https://slowshield.example.com/rubygems/

CI and Dockerfiles (replaces ~/.gemrc)

printf -- '---\n:sources:\n- %s\n' https://slowshield.example.com/rubygems/ > ~/.gemrc

What changes

The second layer

Bundler 4.0.13 and later have a release age of their own, cooldown, in days. It reads the same created_at, which SlowShield passes on unchanged. gem has none: there, SlowShield is the only layer.

In Docker and CI

Run the commands in the build stage, before bundle install. With a build argument, the same Dockerfile still builds without SlowShield when the argument is empty:

FROM ruby:3.4
ARG RUBYGEMS_MIRROR=https://slowshield.example.com/rubygems
RUN if [ -n "$RUBYGEMS_MIRROR" ]; then \
      bundle config set --global mirror.https://rubygems.org "$RUBYGEMS_MIRROR" && \
      printf -- '---\n:sources:\n- %s/\n' "$RUBYGEMS_MIRROR" > ~/.gemrc; fi
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY . .

In CI, run the Setup page's commands before bundle install. ruby/setup-ruby with bundler-cache: true installs the gems within its own step, before any command of yours can run: leave it off and run bundle install after the commands. Building images covers the base image too, and how to check that nothing in a build goes around SlowShield.

Limits

For agents: this page as Markdown · llms.txt · the SlowShield skill