Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
#19 add misaki.util.notify
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidz committed Sep 5, 2012
1 parent c4f95c9 commit 2f5fe5a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
4 changes: 1 addition & 3 deletions doc/.template/index.html.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

(header
(:title site)
(p "misaki is [Jekyll](https://github.com/mojombo/jekyll) inspired static site generator in [Clojure](http://clojure.org).")
)

(p "misaki is [Jekyll](https://github.com/mojombo/jekyll) inspired static site generator in [Clojure](http://clojure.org)."))

(two-column
(list
Expand Down
3 changes: 3 additions & 0 deletions doc/_config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
;; highlight setting
:code-highlight {:CLJ "lang-clj", :CLOJURE "lang-clj"}

:notify? true
:notify-setting {:fixed "fixed! {{filename}}"
:failed "FAILED: {{filename}}"}

:detailed-log true
}
Expand Down
7 changes: 5 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject misaki "0.2.1-beta"
(defproject misaki "0.2.2-beta"
:description "Jekyll inspired static site generator in Clojure"
:dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/core.incubator "0.1.0"]
Expand All @@ -10,7 +10,10 @@
[clj-text-decoration "0.0.1"]
[clj-pretty-error "0.0.5"]
[uochan/watchtower "0.1.2"]
[de.ubercode.clostache/clostache "1.3.0"]]
[de.ubercode.clostache/clostache "1.3.0"]
[clj-gntp "0.0.1"]
[clj-growl "0.2.1"]
]

:dev-dependencies [[lein-multi "1.1.0"]
[lein-marginalia "0.7.1"]
Expand Down
7 changes: 1 addition & 6 deletions src/misaki/compiler/default/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
[cljs.closure :only [build]]
[hiccup.core :only [html]]
[hiccup.page :only [html5 xhtml html4]]
[clojure.core.incubator :only [-?>>]]
[pretty-error.core :only [print-pretty-stack-trace]])
[clojure.core.incubator :only [-?>>]])
(:require
[misaki.core :as msk]
[misaki.config :as cnf]
Expand All @@ -23,10 +22,6 @@
(declare compile-tag)
(declare get-tags)

(defn- print-misaki-stack-trace [e]
(print-pretty-stack-trace
e :filter #(str-contains? (:str %) "misaki")))

; =log
(defmacro log
"Print compile result log with `:detailed-log` option."
Expand Down
8 changes: 7 additions & 1 deletion src/misaki/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
(def POST_OUTPUT_NAME_FORMAT
"Default format to generage post output filename."
"{{year}}/{{month}}/{{filename}}")
(def NOTIFY_SETTING
{:fixed "fixed!!! {{filename}}"
:failed "failed!!! {{filename}}"})

;; ## Declarations

Expand Down Expand Up @@ -86,7 +89,10 @@
:compiler (load-compiler-publics (:compiler config COMPILER))
:compile-with-post (:compile-with-post config ())
:post-filename-regexp (:post-filename-regexp config POST_FILENAME_REGEXP)
:post-filename-format (:post-filename-format config POST_OUTPUT_NAME_FORMAT))))
:post-filename-format (:post-filename-format config POST_OUTPUT_NAME_FORMAT)
:notify? (:notify? config false)
:notify-setting (merge NOTIFY_SETTING (:notify-setting config))
)))

; =with-config
(defmacro with-config
Expand Down
7 changes: 6 additions & 1 deletion src/misaki/core.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns misaki.core
"Misaki Controll Core"
(:use misaki.config
[misaki.util file string sequence]
[misaki.util file string sequence notify]
[text-decoration.core :only [green]]
[pretty-error.core :only [print-pretty-stack-trace]])
(:import [java.io File]))
Expand Down Expand Up @@ -123,10 +123,15 @@
compile-result (call-compiler-fn :-compile config file)
process-result (process-compile-result
compile-result default-filename)]

(if (:notify? config) (notify-result file process-result))

[process-result compile-result])
(catch Exception e
(print-pretty-stack-trace
e :filter #(str-contains? (:str %) "misaki"))
; notify error
(if (:notify? config) (notify-result file false (.getMessage e)))
[false {:stop-compile? true}])))

; =call-all-compile
Expand Down

0 comments on commit 2f5fe5a

Please sign in to comment.