1
1
require " yaml"
2
2
require " colorize"
3
+ require " ./sound_file_storage"
3
4
4
5
module Sentry
5
6
FILE_TIMESTAMPS = {} of String => String # {file => timestamp}
@@ -146,8 +147,8 @@ module Sentry
146
147
property should_build = true
147
148
property files = [] of String
148
149
@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" )
151
152
152
153
def initialize (
153
154
@display_name : String ,
@@ -167,13 +168,11 @@ module Sentry
167
168
@should_install_shards = install_shards
168
169
@colorize = colorize
169
170
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 % }
177
176
end
178
177
179
178
private def stdout (str : String )
@@ -225,13 +224,22 @@ module Sentry
225
224
if build_result && build_result.success?
226
225
@app_built = true
227
226
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
229
231
elsif ! @app_built # if build fails on first time compiling, then exit
230
232
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
232
237
exit 1
233
238
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
235
243
end
236
244
end
237
245
0 commit comments