Skip to content

Commit 23a43d5

Browse files
bensustoyle
authored andcommitted
doo - call notifier from plugin
1 parent 19b4339 commit 23a43d5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

library/src/doo/notifier.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
(str/replace message "[" "\\["))
99

1010
(defn- notify [title-postfix message]
11+
{:pre [(string? title-postfix) (string? message)]}
1112
(try
1213
(shell/sh "terminal-notifier" "-message" (escape message) "-title" (str "doo - " (escape title-postfix)))
1314
(catch Exception ex
@@ -28,7 +29,7 @@
2829
(defn handle-notifications [out opts]
2930
(when (:notify opts)
3031
(let [old-status (notify-title @last-run)
31-
new (reset! last-run (get-assertion-string @out))
32+
new (reset! last-run (get-assertion-string out))
3233
new-status (notify-title new)
3334
changed (not= new-status old-status)]
3435
(when (or changed (= :always (:notify opts)))

library/src/doo/shell.clj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
(ns doo.shell
22
"Rewrite of clojure.java.shell to have access to the output stream."
33
(:require [clojure.java.io :as io]
4-
[doo.notifier :as notifier]
54
[doo.utils :as utils])
65
(:import (java.io StringWriter BufferedReader InputStreamReader File)
76
(java.nio.charset Charset)))
@@ -77,5 +76,4 @@
7776
(let [proc (exec! cmd (:exec-dir opts))
7877
{:keys [out err]} (capture-process! proc opts)
7978
exit-code (.waitFor proc)]
80-
(notifier/handle-notifications out opts)
8179
{:exit exit-code :out @out :err @err})))

plugin/src/leiningen/doo.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ in project.clj.\n")
217217
;; FIX: there is probably a bug regarding the incorrect use of builds
218218
;; Important to add sources to the classpath
219219
(run-local-project (add-sources project' source-paths)
220-
'(require 'cljs.build.api 'doo.core 'doo.karma)
220+
'(require 'cljs.build.api 'doo.core 'doo.karma 'doo.notifier)
221221
`(let [compiler# (cljs.build.api/add-implicit-options ~compiler)]
222222
(doseq [js-env# ~js-envs]
223223
(doo.core/assert-compiler-opts js-env# compiler#))
@@ -239,7 +239,8 @@ in project.clj.\n")
239239
(Thread/sleep 1000))
240240
(doseq [js-env# non-karma-envs#]
241241
(doo.core/print-envs js-env#)
242-
(doo.core/run-script js-env# compiler# ~opts))
242+
(let [r# (doo.core/run-script js-env# compiler# ~opts)]
243+
(doo.notifier/handle-notifications (:out r#) ~opts)))
243244
(when @karma-on?#
244245
(apply doo.core/print-envs karma-envs#)
245246
(doo.core/karma-run! ~opts))))))

0 commit comments

Comments
 (0)