Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 3
groups:
bundler-dependencies:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 3
groups:
github-actions-dependencies:
patterns:
- "*"
162 changes: 162 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Ruby

on:
push:
branches:
- main

pull_request:

permissions:
contents: read

jobs:
# Installs each gemfile's bundle once per Ruby, so the jobs below restore it from the cache.
# setup-ruby reads BUNDLE_GEMFILE, so each appraisal gets its own lockfile's gems and Bundler version.
install:
runs-on: ubuntu-latest
name: Install (Ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }})
strategy:
fail-fast: false
matrix:
ruby: &test_rubies
- '3.3'
- '3.4'
- '4.0.9'
gemfile: &gemfiles
- Gemfile
- gemfiles/bundler_2.6.9.gemfile
- gemfiles/bundler_2.7.2.gemfile
- gemfiles/bundler_4.0.24.gemfile
- gemfiles/bundler_4.1.0.beta3.gemfile
- gemfiles/gem_coop.gemfile
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

rubocop:
needs: install
runs-on: ubuntu-latest
name: RuboCop (Ruby ${{ matrix.ruby }})
strategy:
matrix:
ruby: &rubies
- '4.0.9'
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rubocop

types:
needs: install
runs-on: ubuntu-latest
name: RBS and Steep (Ruby ${{ matrix.ruby }})
strategy:
matrix:
ruby: *rubies
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake rbs steep

rspec:
needs: install
runs-on: ubuntu-latest
name: RSpec (Ruby ${{ matrix.ruby }})
strategy:
matrix:
ruby: *test_rubies
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the unit specs with coverage
env:
COVERAGE: "true"
run: bundle exec rake spec

e2e:
needs: install
runs-on: ubuntu-latest
name: RSpec E2E (Ruby ${{ matrix.ruby }})
strategy:
matrix:
ruby: *test_rubies
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake e2e

# The appraisals leave out RuboCop, which the Rakefile loads, so this runs rspec directly
appraisal-rspec:
needs: install
runs-on: ubuntu-latest
name: RSpec (Ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }})
strategy:
fail-fast: false
matrix:
ruby: *test_rubies
gemfile: *gemfiles
exclude:
- gemfile: Gemfile
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rspec spec/bundle_matrix

appraisal-e2e:
needs: install
runs-on: ubuntu-latest
name: RSpec E2E (Ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }})
strategy:
fail-fast: false
matrix:
ruby: *test_rubies
gemfile: *gemfiles
exclude:
- gemfile: Gemfile
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rspec spec/e2e
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
inherit_gem:
sharp_style_rubocop: config/default.yml

# The E2E specs describe a bundle command, not a class
RSpec/DescribeClass:
Exclude:
- 'spec/e2e/**/*'
69 changes: 69 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# frozen_string_literal: true

# Appraisal2 rebuilds generated gemfiles from the parsed DSL, which drops
# comments, so keep the magic comment in the generated heading.
customize_gemfiles do
{
heading: "frozen_string_literal: true\n\nThis file was generated by Appraisal2"
}
end

plugin "appraisal2-rubocop", require: "appraisal2/rubocop"

# Appraisal2 copies the root Gemfile's rubygems.org source into every appraisal.
# The gem-coop appraisal sets its own global source, so drop the copied line
# to keep a single global source and avoid Bundler's warning.
#
# rubocop:disable-next Style/RedundantConstantBase
::Appraisal.transform_gemfile do |content, context|
next unless context.appraisal.name == "gem-coop"

content.sub(%r{^source ["']https://rubygems\.org/?["']\n}, "")
end

# Gems the Gemfile needs for development, not for running the specs against a Bundler version
DEV_GEMS = %w[
appraisal2
appraisal2-rubocop
guard
guard-rspec
guard-rubocop
guard-shell
guard-status
irb
ostruct
rbs
rubocop
simplecov
steep
].freeze

JOE_GEMS = %w[
boondoc
guard-boondoc
sharp_style_rubocop
].freeze

# rubocop:disable-next Style/MethodCallWithArgsParentheses
def bundler_appraisal(version)
appraise "bundler-#{version}" do
(DEV_GEMS + JOE_GEMS).each { |name| remove_gem name }

gem "bundler", version
end
end

bundler_appraisal "2.6.9"
bundler_appraisal "2.7.2"
bundler_appraisal "4.0.24"
bundler_appraisal "4.1.0.beta3"

appraise "gem-coop" do
source "https://gem.coop/"

(DEV_GEMS + JOE_GEMS).each { |name| remove_gem name }

source "https://gem.coop/@joe-sharp" do
JOE_GEMS.each { |name| gem name }
end
end
Binary file added BundleMatrix.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## [Unreleased]

## [0.1.0] - 2026-11-08

Initial release. bundle_matrix is a Bundler plugin that repeats `bundle install`, `bundle update` and `bundle add` against every secondary gemfile in your project, so each lockfile stays in step with the main gemfile.

- Finds secondary gemfiles (`*.gemfile` in the project root and `gemfiles/`), plus `gems.rb` or `Gemfile` in any directories listed in `matrix.paths`
- Forwards the same flags to each gemfile, handling gems, groups, `--path` and `--lockfile` per gemfile
- Runs each secondary gemfile with its own lockfile's Bundler version
- Shares the project's `.bundle/config` and `BUNDLE_*` environment variables with every gemfile
- Recognizes command aliases and prefixes (`i`, `a`, `u`) and plain `bundle`, as Bundler does
- Reports a gemfile that fails as an error and keeps going with the rest
10 changes: 10 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Code of Conduct

"bundle_matrix" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):

* Participants will be tolerant of opposing views.
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
* When interpreting the words and actions of others, participants should always assume good intentions.
* Behaviour which can be reasonably considered harassment will not be tolerated.

If you have any concerns about behaviour within this project, please contact us at [joesharp13@gmail.com](mailto:joesharp13@gmail.com).
26 changes: 26 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

source "https://rubygems.org/"

# Specify your gem's dependencies in bundle_matrix.gemspec
gemspec

gem "appraisal2"
gem "appraisal2-rubocop", require: false
gem "boondoc"
gem "guard"
gem "guard-boondoc"
gem "guard-rspec"
gem "guard-rubocop"
gem "guard-shell"
gem "guard-status"
gem "irb"
gem "ostruct" # guard-rspec's DSL requires it; no longer a default gem in Ruby 4.0
gem "rake", "~> 13.0"
gem "rbs", require: false
gem "rspec", "~> 3.0"
gem "rubocop"
gem "rubygems-generate_index", require: false
gem "sharp_style_rubocop"
gem "simplecov", require: false
gem "steep", require: false
Loading
Loading