jp.tomorrowkey.gradle.notifier.VoiceNotifier.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of notifier-plugin Show documentation
Show all versions of notifier-plugin Show documentation
Ring sound when last task is finished
package jp.tomorrowkey.gradle.notifier
public class VoiceNotifier implements Notifier {
Commander commander;
String voice
public VoiceNotifier(voice) {
if(voice == null || voice.isEmpty()) {
this.voice = "Alex"
} else {
this.voice = voice
}
}
public void performNotify(task, state) {
commander = new Commander(task.logger)
def command
if (state.failure) {
commander.execute("say", "-v", "$voice", "'$task.name task is failed'")
} else {
commander.execute("say", "-v", "$voice", "'$task.name task is finished'")
}
}
}