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
+
1
3
# Removes old version guards in ruby/spec.
2
4
# Run it from the ruby/spec repository root.
3
5
# 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.
4
20
5
21
def dedent ( line )
6
22
if line . start_with? ( " " )
@@ -105,6 +121,11 @@ def search(regexp)
105
121
end
106
122
end
107
123
124
+ if ARGV . empty?
125
+ puts "usage: #{ $0} <ruby-version>"
126
+ abort
127
+ end
128
+
108
129
version = Regexp . escape ( ARGV . fetch ( 0 ) )
109
130
version += "(?:\\ .0)?" if version . count ( "." ) < 2
110
131
remove_guards ( /ruby_version_is (["'])#{ version } \1 do/ , true )
You can’t perform that action at this time.
0 commit comments