Created
November 21, 2011 19:04
-
-
Save devth/1383568 to your computer and use it in GitHub Desktop.
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 chat-status [job-name] | |
"Sends job status info to chat. Sample output: | |
SUCCESS at Wed Nov 16. Started by trevor. | |
Currently building? false | |
Show 6 rumors before truncating" | |
(let [json (status job-name)] | |
(println json) | |
(if-let [building (str (:building json))] ; convert to string so a `false` doesn't give a false-negative | |
(let [result (str (:result json)) | |
changeset (s/join | |
\newline | |
(map (fn [i] | |
(let [msg (:msg i) | |
author (if (seq (:author i)) | |
(:fullName (:author i)) ; git | |
(:user i))]; svn | |
(str author ": " msg))) | |
(:items (:changeSet json))))] | |
(cf/send-paste (s/join \newline | |
[(:url json) | |
(str result " at " (c/to-date (c/from-long (:timestamp json))) ". " (:shortDescription (first (:causes (first (:actions json))))) ".") | |
(str "Currently building: " building) | |
"" | |
changeset | |
])))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment