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

Fix problem with missing gem specs #213

Merged
merged 9 commits into from
Jan 26, 2021
Merged

Fix problem with missing gem specs #213

merged 9 commits into from
Jan 26, 2021

Conversation

paracycle
Copy link
Member

Motivation

Fix #208.

Implementation

Bundler::SpecSet#materialize has an optional extra parameter that can be supplied an array, which will be used to collect the names of the missing gem specs when materializing. This prevents missing gem specs from raising errors, so by passing an empty array for this parameter, we can prevent Tapioca from crashing when it runs into missing specs for dependencies that don't make sense for the current platform.

Tests

Added a nokogiri dependency on the test repo and added a test to ensure that its optional dependency does not get processed.

@paracycle paracycle requested a review from a team January 25, 2021 23:15
lib/tapioca/gemfile.rb Outdated Show resolved Hide resolved
spec/support/repo/Gemfile Outdated Show resolved Hide resolved
@paracycle paracycle changed the title Add nokogiri dependency to test repo Fix problem with missing gem specs Jan 25, 2021
Also run `bundle lock --add-platform=ruby` before running tests so
that we end up installing the native executable of Nokogiri when we
do `bundle install` which would exhibit the difference in behaviour.
Some specs could be missing when trying to materialized the spec set,
for example, a gem could depend on another gem for one platform but not
depend on it for the current platform, which would make that dependency
exist in the lockfile but result in a missing spec for the current
platform.

The fix is to pass an empty array to `materialize` which would collect
the names of the gems that have missing specs.
Since the minimum supported Ruby version of Nokogiri is 2.5
@paracycle paracycle force-pushed the uk-fix-materialize branch 5 times, most recently from 68c7a34 to 5d6cd8f Compare January 26, 2021 18:52
Gemfile Outdated
@@ -10,7 +10,7 @@ group(:deployment, :development) do
gem("rake")
end

gem("bundler", "~> 1.17")
gem("bundler", ">= 2")
Copy link
Member

Choose a reason for hiding this comment

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

Should not bundler be in the gemspec since it is a runtime dependency? Can tapioca run without bundler being installed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooops, that's correct. Fixing it now.

lib/tapioca/gemfile.rb Show resolved Hide resolved
spec/template_helper.rb Outdated Show resolved Hide resolved
@paracycle paracycle merged commit 9baa610 into master Jan 26, 2021
@paracycle paracycle deleted the uk-fix-materialize branch January 26, 2021 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tapioca sync fails because of nokogiri native gem having different dependencies than compiled gem
3 participants