mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[ruby/erb] Drop deprecated -S option from erb command
We attempted to remove things like this and reverted all of them, but I
think nobody relies on this unlike the positional arguments of
`ERB#initialize`.
92fde7e403
This commit is contained in:
parent
e5a0abc5de
commit
1c0c1c8098
2 changed files with 1 additions and 24 deletions
12
libexec/erb
12
libexec/erb
|
@ -74,11 +74,6 @@ class ERB
|
||||||
$DEBUG = true
|
$DEBUG = true
|
||||||
when '-r' # require
|
when '-r' # require
|
||||||
require ARGV.req_arg
|
require ARGV.req_arg
|
||||||
when '-S' # security level
|
|
||||||
warn 'warning: -S option of erb command is deprecated. Please do not use this.'
|
|
||||||
arg = ARGV.req_arg
|
|
||||||
raise "invalid safe_level #{arg.dump}" unless arg =~ /\A[0-1]\z/
|
|
||||||
safe_level = arg.to_i
|
|
||||||
when '-T' # trim mode
|
when '-T' # trim mode
|
||||||
arg = ARGV.req_arg
|
arg = ARGV.req_arg
|
||||||
if arg == '-'
|
if arg == '-'
|
||||||
|
@ -127,12 +122,7 @@ EOU
|
||||||
filename = $FILENAME
|
filename = $FILENAME
|
||||||
exit 2 unless src
|
exit 2 unless src
|
||||||
trim = trim_mode_opt(trim_mode, disable_percent)
|
trim = trim_mode_opt(trim_mode, disable_percent)
|
||||||
if safe_level.nil?
|
erb = factory.new(src, trim_mode: trim)
|
||||||
erb = factory.new(src, trim_mode: trim)
|
|
||||||
else
|
|
||||||
# [deprecated] This will be removed at Ruby 2.7.
|
|
||||||
erb = factory.new(src, safe_level, trim_mode: trim)
|
|
||||||
end
|
|
||||||
erb.filename = filename
|
erb.filename = filename
|
||||||
if output
|
if output
|
||||||
if number
|
if number
|
||||||
|
|
|
@ -17,17 +17,4 @@ class TestErbCommand < Test::Unit::TestCase
|
||||||
File.expand_path("../../libexec/erb", __dir__)],
|
File.expand_path("../../libexec/erb", __dir__)],
|
||||||
"<%=''.encoding.to_s%>", ["UTF-8"])
|
"<%=''.encoding.to_s%>", ["UTF-8"])
|
||||||
end
|
end
|
||||||
|
|
||||||
# These interfaces will be removed at Ruby 2.7.
|
|
||||||
def test_deprecated_option
|
|
||||||
pend if RUBY_ENGINE == 'truffleruby'
|
|
||||||
warnings = [
|
|
||||||
"warning: -S option of erb command is deprecated. Please do not use this.",
|
|
||||||
/\n.+\/libexec\/erb:\d+: warning: Passing safe_level with the 2nd argument of ERB\.new is deprecated\. Do not use it, and specify other arguments as keyword arguments\.\n/,
|
|
||||||
]
|
|
||||||
assert_in_out_err(["-I#{File.expand_path('../../lib', __dir__)}",
|
|
||||||
File.expand_path("../../libexec/erb", __dir__),
|
|
||||||
"-S", "0"],
|
|
||||||
"hoge", ["hoge"], warnings)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue