File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+
13# Removes old version guards in ruby/spec.
24# Run it from the ruby/spec repository root.
35# The argument is the new minimum supported version.
6+ #
7+ # tool/remove_old_guards.rb <ruby-version>
8+ #
9+ # where <ruby-version> is a version guard with which should be removed
10+ #
11+ # Example:
12+ # tool/remove_old_guards.rb 3.1
13+ #
14+ # As a result guards like
15+ # ruby_version_is "3.1" do
16+ # # ...
17+ # end
18+ #
19+ # will be removed.
420
521def dedent ( line )
622 if line . start_with? ( " " )
@@ -105,6 +121,11 @@ def search(regexp)
105121 end
106122end
107123
124+ if ARGV . empty?
125+ puts "usage: #{ $0} <ruby-version>"
126+ abort
127+ end
128+
108129version = Regexp . escape ( ARGV . fetch ( 0 ) )
109130version += "(?:\\ .0)?" if version . count ( "." ) < 2
110131remove_guards ( /ruby_version_is (["'])#{ version } \1 do/ , true )
You can’t perform that action at this time.
0 commit comments