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

Add base64 to gemfiles #566

Closed

Conversation

M-Yamashita01
Copy link

@M-Yamashita01 M-Yamashita01 commented May 17, 2024

This commit adds base64 gem to rails_6_0.gemfiles, rails_6_1.gemfiles and rails_7_0.gemfiles in gemfiles directory for the following reasons.

  • Starting from Ruby 3.3, using base64 raises the following warning.

warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of activesupport-6.0.6.1 to add base64 into its gemspec.

  • The reason for not adding gems to rails7_1.gemfiles and rails_head.gemfiles is that the base64 gem has been added to activesupport.gemspec since ActiveSupport 7.1 with add_dependency.

However, we do not add base64 gem to jbuilder.gemspec for the following reason.

  • jbuilder supports Ruby 2.2, but initial version (v0.1.0) of base64 gem supports Ruby 2.3 and above. Therefore if we add base64 to jbuilder.gemspec, it fails while running the bundle install command.

Refer to
https://bugs.ruby-lang.org/issues/20187
ruby/ruby#9550
https://github.com/rails/rails/blob/v7.1.0/activesupport/activesupport.gemspec
https://github.com/ruby/base64/blob/v0.1.0/base64.gemspec

@M-Yamashita01 M-Yamashita01 changed the title Add base64 to jbuilder.gemspec and gemfiles Add base64 to gemfiles May 23, 2024
This commit adds base64 gem to rails_6_0.gemfiles, rails_6_1.gemfiles and rails_7_0.gemfiles in gemfiles directory for  the following reasons.

- Starting from Ruby 3.3, using base64 raises the following warning.

> warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of activesupport-6.0.6.1 to add base64 into its gemspec.

- The reason for not adding gems to rails7_1.gemfiles and rails_head.gemfiles is that the base64 gem has been added to activesupport.gemspec since ActiveSupport 7.1 with add_dependency.

However, we do not add base64 gem to jbuilder.gemspec for the following reason.

- jbuilder supports Ruby 2.2, but initial version (v0.1.0) of base64 gem supports Ruby 2.3 and above. Therefore if we add base64 to jbuilder.gemspec, it fails while running the `bundle install` command.

Refer to
https://bugs.ruby-lang.org/issues/20187
ruby/ruby#9550
https://github.com/rails/rails/blob/v7.1.0/activesupport/activesupport.gemspec
https://github.com/ruby/base64/blob/v0.1.0/base64.gemspec
@yahonda
Copy link
Member

yahonda commented May 24, 2024

Hi, As far as I understand Jbuilder does not depend on the base64 gem directly. Would you explain the reason why the base64 needs added here?

@M-Yamashita01
Copy link
Author

Jbuilder does not depend on the base64 gem directly.

Yes, that’s true.
However, jbuilder depends on activesupport which depends on base64 gem.
In the 7.0.8.3 version of activesupport and below, base64 gem does not be added to the activesupport.gemspec, but MessageVerifier class in activesupport calls require base64.
Refer: https://github.com/rails/rails/blob/v7.0.8.3/activesupport/lib/active_support/message_verifier.rb

Therefore, when jbuilder load the MessageVerifier class, Ruby 3.3 raise the following warning.

/home/runner/work/jbuilder/jbuilder/vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.8.3/lib/active_support/message_verifier.rb:4: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of activesupport-7.0.8.3 to add base64 into its gemspec.

Refer:

The only activesupport that has base64 added to gemspec is the 7.1.0 version or higher.
Refer: rails/rails#48907

So if jbuilder is using an activesupport with less than 7.1.0 version, we think it is necessary to add the base64 gem to the gemfile.

@yahonda
Copy link
Member

yahonda commented May 27, 2024

Thanks for the update.

base64 has been added to Active Support dependency via
rails/rails#48907 and this commit has been released as Rails 7.1.

To address warning: base64 will be not part of the default gems since Ruby 3.4.0, upgrading Rails version to 7.1 would be a first choice.
If you want to run Rails 7.0 or older version of Rails, you can add it to your application's Gemfile.

Closing this pull request because this indirect dependency should not be added to Jbuilder.

@yahonda yahonda closed this May 27, 2024
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.

None yet

2 participants