@@ -15,11 +15,13 @@ class Cleaner
15
15
include Context
16
16
17
17
# Create a cleaner for the given formula.
18
+ sig { params ( formula : Formula ) . void }
18
19
def initialize ( formula )
19
20
@formula = formula
20
21
end
21
22
22
23
# Clean the keg of the formula.
24
+ sig { void }
23
25
def clean
24
26
ObserverPathnameExtension . reset_counts!
25
27
@@ -48,8 +50,7 @@ def clean
48
50
# [1]: https://github.com/Homebrew/brew/pull/11597
49
51
# [2]: https://github.com/Homebrew/homebrew-core/issues/100190
50
52
# [3]: https://github.com/Homebrew/brew/pull/13215
51
- Dir . glob ( @formula . info /"**/dir" ) . each do |file |
52
- info_dir_file = Pathname ( file )
53
+ @formula . info . glob ( "**/dir" ) . each do |info_dir_file |
53
54
next unless info_dir_file . file?
54
55
next if info_dir_file == @formula . info /@formula . name /"dir"
55
56
next if @formula . skip_clean? ( info_dir_file )
@@ -65,13 +66,15 @@ def clean
65
66
66
67
private
67
68
69
+ sig { params ( path : Pathname ) . void }
68
70
def observe_file_removal ( path )
69
71
path . extend ( ObserverPathnameExtension ) . unlink if path . exist?
70
72
end
71
73
72
74
# Removes any empty directories in the formula's prefix subtree
73
75
# Keeps any empty directories protected by skip_clean
74
76
# Removes any unresolved symlinks
77
+ sig { void }
75
78
def prune
76
79
dirs = [ ]
77
80
symlinks = [ ]
@@ -100,6 +103,7 @@ def prune
100
103
end
101
104
end
102
105
106
+ sig { params ( path : Pathname ) . returns ( T ::Boolean ) }
103
107
def executable_path? ( path )
104
108
path . text_executable? || path . executable?
105
109
end
@@ -119,6 +123,7 @@ def executable_path?(path)
119
123
#
120
124
# lib may have a large directory tree (see Erlang for instance), and
121
125
# clean_dir applies cleaning rules to the entire tree
126
+ sig { params ( directory : Pathname ) . void }
122
127
def clean_dir ( directory )
123
128
directory . find do |path |
124
129
path . extend ( ObserverPathnameExtension )
@@ -147,6 +152,7 @@ def clean_dir(directory)
147
152
end
148
153
end
149
154
155
+ sig { void }
150
156
def rewrite_shebangs
151
157
require "language/perl"
152
158
require "utils/shebang"
0 commit comments