diff --git a/spec/mspec/tool/remove_old_guards.rb b/spec/mspec/tool/remove_old_guards.rb old mode 100644 new mode 100755 index 3fd95e6b31..75c48e0584 --- a/spec/mspec/tool/remove_old_guards.rb +++ b/spec/mspec/tool/remove_old_guards.rb @@ -1,6 +1,23 @@ +#!/usr/bin/env ruby + # Removes old version guards in ruby/spec. # Run it from the ruby/spec repository root. # The argument is the new minimum supported version. +# +# cd spec +# ../mspec/tool/remove_old_guards.rb +# +# where is a version guard with which should be removed +# +# Example: +# tool/remove_old_guards.rb 3.1 +# +# As a result guards like +# ruby_version_is "3.1" do +# # ... +# end +# +# will be removed. def dedent(line) if line.start_with?(" ") @@ -105,6 +122,8 @@ def search(regexp) end end +abort "usage: #{$0} " if ARGV.empty? + version = Regexp.escape(ARGV.fetch(0)) version += "(?:\\.0)?" if version.count(".") < 2 remove_guards(/ruby_version_is (["'])#{version}\1 do/, true)