11require " yaml"
22require " colorize"
3+ require " ./sound_file_storage"
34
45module Sentry
56 FILE_TIMESTAMPS = {} of String => String # {file => timestamp}
@@ -146,8 +147,8 @@ module Sentry
146147 property should_build = true
147148 property files = [] of String
148149 @sound_player : String = " "
149- @success_wav = " #{ __DIR__ } /sounds/ success.wav"
150- @error_wav = " #{ __DIR__ } /sounds/ error.wav"
150+ @success_wav : BakedFileSystem :: BakedFile = SoundFileStorage .get( " success.wav" )
151+ @error_wav : BakedFileSystem :: BakedFile = SoundFileStorage .get( " error.wav" )
151152
152153 def initialize (
153154 @display_name : String ,
@@ -167,13 +168,11 @@ module Sentry
167168 @should_install_shards = install_shards
168169 @colorize = colorize
169170
170- if File .exists?(@success_wav ) && File .exists?(@error_wav )
171- {% if flag?(:linux ) % }
172- @sound_player = ` which aplay 2>/dev/null` .chomp
173- {% elsif flag(:darwin ) % }
174- @sound_player = ` which afplay 2>/dev/null` .chomp
175- {% end % }
176- end
171+ {% if flag?(:linux ) % }
172+ @sound_player = ` which aplay 2>/dev/null` .chomp
173+ {% elsif flag(:darwin ) % }
174+ @sound_player = ` which afplay 2>/dev/null` .chomp
175+ {% end % }
177176 end
178177
179178 private def stdout (str : String )
@@ -225,13 +224,22 @@ module Sentry
225224 if build_result && build_result.success?
226225 @app_built = true
227226 create_app_process()
228- ` #{ @sound_player } #{ @success_wav } 2>/dev/null` unless @sound_player .blank?
227+ unless @sound_player .blank?
228+ Process .new(command: @sound_player , input: @success_wav )
229+ @success_wav .rewind
230+ end
229231 elsif ! @app_built # if build fails on first time compiling, then exit
230232 stdout " 🤖 Compile time errors detected. SentryBot shutting down..."
231- ` #{ @sound_player } #{ @error_wav } 2>/dev/null` unless @sound_player .blank?
233+ unless @sound_player .blank?
234+ Process .new(command: @sound_player , input: @error_wav )
235+ @error_wav .rewind
236+ end
232237 exit 1
233238 else
234- ` #{ @sound_player } #{ @error_wav } 2>/dev/null` unless @sound_player .blank?
239+ unless @sound_player .blank?
240+ Process .new(command: @sound_player , input: @error_wav )
241+ @error_wav .rewind
242+ end
235243 end
236244 end
237245
0 commit comments