Skip to content

Instantly share code, notes, and snippets.

@tonsky
Created March 2, 2015 20:14
Show Gist options
  • Save tonsky/910a9a23dacf1e38b8d7 to your computer and use it in GitHub Desktop.
Save tonsky/910a9a23dacf1e38b8d7 to your computer and use it in GitHub Desktop.
boot-clj plugin to report build status to AnyBar
(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