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

Remove runtime dependency on base64 #1046

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

Earlopain
Copy link
Contributor

Ruby 3.3 shows a warning when using base64 without declaring it in the gemspec. Ruby 3.4 will remove base64 as a default gem.

Since this gem is only using a single method in one place there is no need to pull in the full dependency. It is only a wrapper over Array#pack.

Alternative to #1041

Other gems have taken the same/similar approach:

Ruby 3.3 shows a warning when using base64 without declaring it in the gemspec.
Ruby 3.4 will remove base64 as a default gem.
@mattbrictson
Copy link
Contributor

As of 2 weeks ago, it looks like Ruby head has now removed the default base64 gem entirely. So projects that use webmock fail with this exception:

/home/runner/.rubies/ruby-head/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `require': cannot load such file -- base64 (LoadError)

A workaround exists: any project using webmock also has to add base64 to their Gemfile. Still, it would be nice to see this PR merged. Thanks! 🙏

@bblimke
Copy link
Owner

bblimke commented Feb 4, 2024

@Earlopain thank you for providing this solution. I appreciate the simplicity! 👍 It's great to have a solution that doesn't require adding another dependency to the gemspec.

@bblimke bblimke merged commit 3c1799b into bblimke:master Feb 4, 2024
@Earlopain Earlopain deleted the remove-base64-dep branch February 5, 2024 05:02
JuanVqz added a commit to fastruby/next_rails that referenced this pull request Feb 4, 2025
Ruby 3.4 is removing the `base64` default gem to [became bundled](https://rubyreferences.github.io/rubychanges/3.4.html#default-gems-that-became-bundled)

Making the current webmock (v3.16.2) gem incompatible because it has a dependency on the `base64` gem,
to fix it we are bumping webmock to v3.20.0 which [removed the
`base64`](bblimke/webmock#1046) dependency.

As an alternative solution, we can leave the current `webmock` version untoched
and add the `base64` gem as a dependency.

Given this message: `limited on purpose, new versions don't work with old rubies`
we might lost support of some old rubies.
JuanVqz added a commit to fastruby/next_rails that referenced this pull request Feb 4, 2025
Ruby 3.4 is removing the `base64` default gem to [became bundled](https://rubyreferences.github.io/rubychanges/3.4.html#default-gems-that-became-bundled)

Making the current webmock (v3.16.2) gem incompatible because it has a dependency on the `base64` gem,
to fix it we are bumping webmock to v3.20.0 which [removed the
`base64`](bblimke/webmock#1046) dependency.

> [!NOTE]
> As an alternative solution, we can leave the current `webmock` version untoched
and add the `base64` gem as a dependency.
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.

3 participants