@ledsun blog

無味の味は佳境に入らざればすなわち知れず

RubyZip 3.0 is coming!

Rails 6.1の、特にテストのあるアプリケーションをbundleすると次のような警告がでます。

Post-install message from rubyzip:
RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
  * `Zip::File`
  * `Zip::Entry`
  * `Zip::InputStream`
  * `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

「RubyZip 3.0でブレイキングチェンジが入るからバージョン指定に気をつけてね」という趣旨だと思います。 Gemfile.lockをみるとselenium-webdriverかwebdrivers由来に思えます。 実際ソースコードをみるとそのようです。

https://github.com/SeleniumHQ/selenium/blob/a584b8ce86f4795aea206b9512f9d0fd01df762f/rb/selenium-webdriver.gemspec#L49

  s.add_runtime_dependency 'rubyzip', ['>= 1.2.2']

https://github.com/titusfortner/webdrivers/blob/972103fe1f48f752f6601823f2057caa3860e92a/webdrivers.gemspec#L40

  s.add_runtime_dependency 'rubyzip', '>= 1.3.0'

と言うことは単純にbundle add selenium-driverとかすれば同じ警告が出そうです。 より小さい再現コードが手に入りそうです。 ところが単独でbundle addしても、この警告はでません。

~ bundle add selenium-webdriver
Fetching gem metadata from https://rubygems.org/......
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/......
Resolving dependencies...
Using childprocess 4.1.0
Using racc 1.6.0
Using rexml 3.2.5
Using rubyzip 2.3.2
Using webdriver 0.19.0
Using bundler 2.3.3
Using nokogiri 1.13.1 (x86_64-linux)
Using selenium-webdriver 4.1.0
Using webdrivers 5.0.0
~ bundle add webdrivers
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/......
Resolving dependencies...
Using racc 1.6.0
Using rexml 3.2.5
Using webdriver 0.19.0
Using bundler 2.3.3
Fetching childprocess 4.1.0
Fetching rubyzip 2.3.2
Fetching nokogiri 1.13.1 (x86_64-linux)
Installing rubyzip 2.3.2
Installing childprocess 4.1.0
Fetching selenium-webdriver 4.1.0
Installing selenium-webdriver 4.1.0
Installing nokogiri 1.13.1 (x86_64-linux)
Fetching webdrivers 5.0.0
Installing webdrivers 5.0.0

不思議です。

参考

[Rails6] RubyZip 3.0 is coming! が出た | My Brain