Created
March 2, 2015 20:14
-
-
Save tonsky/910a9a23dacf1e38b8d7 to your computer and use it in GitHub Desktop.
boot-clj plugin to report build status to AnyBar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- send-udp [s port] | |
(with-open [socket (java.net.DatagramSocket.)] | |
(let [group (java.net.InetAddress/getByName "localhost") | |
bytes (.getBytes s) | |
packet (java.net.DatagramPacket. bytes (count bytes) group port)] | |
(.send socket packet) | |
(.close socket)))) | |
(deftask anybar [p port VAL int "AnyBar port"] | |
(let [port (or port 1738)] | |
(fn [next-task] | |
(fn [fileset] | |
(try | |
(send-udp "white" port) | |
(boot.util/with-let [_ (next-task fileset)] | |
(if (zero? @boot.core/*warnings*) | |
(send-udp "black" port) | |
(send-udp "orange" port))) | |
(catch Throwable t | |
(send-udp "red" port) | |
(throw t))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment