Skip to content

Commit

Permalink
Make sure future versions of ERB are invoked appropriately
Browse files Browse the repository at this point in the history
Fix introduced in rails#594 misidentifies versions with more numerics.
Version "2.11.0", for example, would be called using the deprecated API.

Long live ERB.
  • Loading branch information
utilum committed Apr 30, 2018
1 parent 006832e commit 1934d55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/thor/actions/file_manipulation.rb
Expand Up @@ -117,7 +117,7 @@ def template(source, *args, &block)
context = config.delete(:context) || instance_eval("binding")

create_file destination, nil, config do
match = ERB.version.match(/(\d\.\d\.\d)/)
match = ERB.version.match(/(\d+\.\d+\.\d+)/)
capturable_erb = if match && match[1] >= "2.2.0" # Ruby 2.6+
CapturableERB.new(::File.binread(source), :trim_mode => "-", :eoutvar => "@output_buffer")
else
Expand Down

0 comments on commit 1934d55

Please sign in to comment.