Ruby, gem and Bundler
Set up Bundler
Send every gem through ForgeRepo™ with a Bundler mirror, and keep your Gemfile as it is.
The ForgeRepo™ gem source is at https://packages.example.com/rubygems/. Tell Bundler to use it in place of rubygems.org, with your token as the password:
$ bundle config set --global mirror.https://rubygems.org https://packages.example.com/rubygems/ $ bundle config set --global packages.example.com your-user-name:"$REPO_TOKEN" $ cat Gemfile source "https://rubygems.org" gem "sinatra", "~> 4.0"
Captured by running these commands against a real ForgeRepo™.
- The Gemfile keeps
source "https://rubygems.org". Bundler sends every request to the mirror instead. - The second command stores your token for the mirror. In a pipeline, run the same two commands with the token from a secret variable.
Then install as usual:
$ bundle install ... Installing rack-session 2.1.2 Installing rack-protection 4.2.1 Fetching sinatra 4.2.1 Installing sinatra 4.2.1 Bundle complete! 1 Gemfile dependency, 9 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed.
Captured by running these commands against a real ForgeRepo™.