mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refined spec/mspec/tool/remove_old_guards.rb
* Allow spaces around `...` * Matches quotes more precisely * Matches 0 teeny
This commit is contained in:
parent
da05c1552e
commit
f49a24201c
Notes:
git
2020-04-03 10:37:05 +09:00
1 changed files with 5 additions and 4 deletions
|
@ -57,9 +57,10 @@ def search(regexp)
|
|||
end
|
||||
|
||||
version = Regexp.escape(ARGV.fetch(0))
|
||||
remove_guards(/ruby_version_is ["']#{version}["'] do/, true)
|
||||
remove_guards(/ruby_version_is ["'][0-9.]*["']...["']#{version}["'] do/, false)
|
||||
remove_guards(/ruby_bug "#\d+", ["'][0-9.]*["']...["']#{version}["'] do/, true)
|
||||
version += "(?:\\.0)?" if version.count(".") < 2
|
||||
remove_guards(/ruby_version_is (["'])#{version}\1 do/, true)
|
||||
remove_guards(/ruby_version_is (["'])[0-9.]*\1 *... *(["'])#{version}\2 do/, false)
|
||||
remove_guards(/ruby_bug "#\d+", (["'])[0-9.]*\1 *... *(["'])#{version}\2 do/, true)
|
||||
|
||||
search(/["']#{version}["']/)
|
||||
search(/(["'])#{version}\1/)
|
||||
search(/^\s*#.+#{version}/)
|
||||
|
|
Loading…
Reference in a new issue