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

Use the newer ERB.new usage for Ruby v2.6 or higher #621

Merged
merged 1 commit into from
Sep 2, 2023

Conversation

gemmaro
Copy link
Contributor

@gemmaro gemmaro commented Sep 1, 2023

Hello,

This patch suppresses the ERB.new warning when calling serverspec-init with newer versions of Ruby:

$ serverspec-init
...
Vagrant instance y/n: n
Input target host name: pi
 + spec/
 + spec/pi/
 + spec/pi/sample_spec.rb
.../lib/serverspec/setup.rb:155: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
.../lib/serverspec/setup.rb:155: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
 + spec/spec_helper.rb
 + Rakefile
 + .rspec

Reference:

  • Ruby 2.6.0 Released - Other notable changes since 2.5 1

    Passing safe_level to ERB.new is deprecated. ...

  • Ruby Issue Tracking System - Deprecate $SAFE support in ERB and let ERB.new take keyword arguments for it 2

Thanks,

Footnotes

  1. https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/

  2. https://bugs.ruby-lang.org/issues/14256

Reference:
* Ruby 2.6.0 Released - Other notable changes since 2.5 [1]
  > Passing safe_level to ERB.new is deprecated. ...
* Ruby Issue Tracking System - Deprecate $SAFE support in ERB and let
  ERB.new take keyword arguments for it [2]

[1] https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/
[2] https://bugs.ruby-lang.org/issues/14256
@mizzy
Copy link
Owner

mizzy commented Sep 2, 2023

Thanks!

@mizzy mizzy merged commit 0356747 into mizzy:master Sep 2, 2023
@mizzy
Copy link
Owner

mizzy commented Sep 2, 2023

Released as v2.42.3.

@gemmaro gemmaro deleted the newer-erb branch September 2, 2023 02:15
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.

2 participants