Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Bundler 2.6.1 #2129

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: 3.5.11
bundler: 2.5.11
rubygems: 3.6.1
- name: Run type check
run: bin/typecheck
- name: Lint Ruby files
Expand All @@ -37,6 +36,7 @@ jobs:
matrix:
ruby: ["3.1", "3.2", "3.3", "head"]
rails: ["7.0", "current", "main"]
rubygems: ["3.6.1"]
exclude:
- ruby: "3.1"
rails: "main"
Expand All @@ -45,6 +45,9 @@ jobs:
experimental: true
- ruby: "head"
experimental: true
- rails: "current"
ruby: "3.3"
rubygems: "3.5.23"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, any particular reason you picked Ruby 3.3 for this?

Copy link
Author

@deivid-rodriguez deivid-rodriguez Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not really. I wanted to keep at least one job running with older Bundler, and I chose the latest released Ruby but there was no particular reason, we could also choose the oldest supported Ruby, for example.

name: Ruby ${{ matrix.ruby }} - Rails ${{ matrix.rails }}
env:
RAILS_VERSION: ${{ matrix.rails }}
Expand All @@ -64,8 +67,7 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
rubygems: 3.5.11
bundler: 2.5.11
rubygems: ${{ matrix.rubygems }}
- name: Run tests
run: bin/test
continue-on-error: ${{ !!matrix.experimental }}
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,4 @@ DEPENDENCIES
xpath

BUNDLED WITH
2.5.0
2.6.1
23 changes: 16 additions & 7 deletions lib/tapioca/gemfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,23 @@ def load_dependencies
sig { returns([T::Enumerable[Spec], T::Array[String]]) }
def materialize_deps
deps = definition.locked_gems.dependencies.except(*@excluded_gems).values
materialized_dependencies = definition.resolve.materialize(deps)
missing_spec_names = materialized_dependencies.missing_specs.map(&:name).to_set
missing_specs = materialized_dependencies.missing_specs.map do |spec|
"#{spec.name} (#{spec.version})"
end
materialized_dependencies = materialized_dependencies.to_a.reject do |spec|
missing_spec_names.include?(spec.name)
resolve = definition.resolve
materialized_dependencies = resolve.materialize(deps)

if Bundler::VERSION >= "2.6.0"
missing_specs = resolve.missing_specs.map do |spec|
"#{spec.name} (#{spec.version})"
end
else
missing_spec_names = materialized_dependencies.missing_specs.map(&:name).to_set
missing_specs = materialized_dependencies.missing_specs.map do |spec|
"#{spec.name} (#{spec.version})"
end
materialized_dependencies = materialized_dependencies.to_a.reject do |spec|
missing_spec_names.include?(spec.name)
end
end

[materialized_dependencies, missing_specs]
end

Expand Down
4 changes: 2 additions & 2 deletions spec/tapioca/gem/pipeline_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def compile(gem_name = DEFAULT_GEM_NAME, include_doc: false, include_loc: false,
end

# add spec to the list of gem specification stubs
Gem::Specification.stubs[gem_name] = spec
Gem::Specification.add_spec(spec)
end

# wrap it in our gemspec wrapper
gem = Tapioca::Gemfile::GemSpec.new(Gem::Specification.stubs[gem_name].first)
gem = Tapioca::Gemfile::GemSpec.new(Gem::Specification.find_by_name(gem_name))

# clear out previously reported errors
reported_errors.clear
Expand Down
Loading