Skip to content

Instantly share code, notes, and snippets.

@devth
Created November 21, 2011 19:04
Show Gist options
  • Save devth/1383568 to your computer and use it in GitHub Desktop.
Save devth/1383568 to your computer and use it in GitHub Desktop.
(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