All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jp.tomorrowkey.gradle.notifier.VoiceNotifier.groovy Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
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'")
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy