@@ -42,6 +42,10 @@ module Sentry
4242 watch: {
4343 type: Array (String ),
4444 default: [" ./src/**/*.cr" , " ./src/**/*.ecr" ],
45+ },
46+ ignore: {
47+ type: Array (String ),
48+ default: [] of String ,
4549 }
4650 )
4751
@@ -59,6 +63,7 @@ module Sentry
5963 @run = nil
6064 @run_args = " "
6165 @watch = [] of String
66+ @ignore = [] of String
6267 end
6368
6469 def display_name
@@ -120,6 +125,7 @@ module Sentry
120125 self .run = other.run if other.sets_run_command?
121126 self .run_args = other.run_args.join(" " ) unless other.run_args.empty?
122127 self .watch = other.watch unless other.watch.empty?
128+ self .ignore = other.ignore unless other.ignore.empty?
123129 end
124130
125131 def to_s (io : IO )
@@ -133,6 +139,7 @@ module Sentry
133139 run: #{ run }
134140 run_args: #{ run_args }
135141 watch: #{ watch }
142+ ignore: #{ ignore }
136143 CONFIG
137144 end
138145 end
@@ -142,6 +149,7 @@ module Sentry
142149 property display_name : String
143150 property should_build = true
144151 property files = [] of String
152+ property ignore_regexes = [] of Regex
145153
146154 def initialize (
147155 @display_name : String ,
@@ -150,9 +158,11 @@ module Sentry
150158 @build_args : Array (String ) = [] of String ,
151159 @run_args : Array (String ) = [] of String ,
152160 files = [] of String ,
161+ ignore_regexes = [] of String ,
153162 should_build = true
154163 )
155164 @files = files
165+ @ignore_regexes = ignore_regexes.map { |regex | Regex .new(regex.strip(" /" )) }
156166 @should_build = should_build
157167 @should_kill = false
158168 @app_built = false
@@ -204,13 +214,14 @@ module Sentry
204214 end
205215 end
206216
207- # Scans all of the `@files`
217+ # Scans all of the `@files`, expect where matched with `@ignore_regexes`
208218 #
209219 def scan_files
210220 file_changed = false
211221 app_process = @app_process
212222 files = @files
213223 Dir .glob(files) do |file |
224+ next if @ignore_regexes .any? { |r | r === file || r === file.split(" /" ).last }
214225 timestamp = get_timestamp(file)
215226 if FILE_TIMESTAMPS [file]? && FILE_TIMESTAMPS [file] != timestamp
216227 FILE_TIMESTAMPS [file] = timestamp
0 commit comments