Skip to content

Commit

Permalink
extract config docs from docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
duck1123 committed Aug 8, 2012
1 parent 5e7f4d9 commit fc7a501
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/ciste/core.clj
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ enabled, then the action will be logged.
Actions are simply functions. An Action can take any number of Actions are simply functions. An Action can take any number of
parameters and should return any logically true value if the action parameters and should return any logically true value if the action
succeeded." succeeded."
(:use [ciste.config :only [config]]) (:use [ciste.config :only [config describe-config]])
(:require [ciste.triggers :as triggers] (:require [ciste.triggers :as triggers]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[lamina.core :as l])) [lamina.core :as l]))


(describe-config [:print :actions]
:boolean
"If true, this Action will log itself on every execution")

(describe-config [:use-pipeline]
:boolean
"If true, the result of executing this action will be enqueued to the action channel.")

(describe-config [:run-triggers]
:boolean
"If true, associated triggers will be run after this action executes.")

(defonce ^:dynamic (defonce ^:dynamic
^{:dynamic true ^{:dynamic true
:doc "The current format in use. Rebind this var to set the format for the :doc "The current format in use. Rebind this var to set the format for the
current request."} current request."}
*format* nil) *format* nil)
(defonce ^:dynamic *serialization* nil) (defonce ^:dynamic *serialization* nil)
(defonce ^:dynamic *actions* (l/permanent-channel)) (defonce ^:dynamic *actions* (l/permanent-channel))
Expand Down Expand Up @@ -46,17 +58,9 @@ succeeded."
(defmacro defaction (defmacro defaction
"Define an Action. "Define an Action.
An Action is similar to a ordinary function except that it announces itself An Action is similar to a ordinary function except that it announces itself to
to the action channel, it logs it's execution and it executes any associated the action channel, it logs it's execution and it executes any associated
triggers. triggers."
Config options used:
* [:print :actions] - If true, this Action will log itself on every execution
* [:use-pipeline] - If true, the result of executing this action will be
enqueued to the action channel.
* [:run-triggers] - If true, associated triggers will be run after this
action executes."
[name & forms] [name & forms]
(let [[docs forms] (if (string? (first forms)) (let [[docs forms] (if (string? (first forms))
[(first forms) (rest forms)] [(first forms) (rest forms)]
Expand Down Expand Up @@ -85,7 +89,7 @@ succeeded."


(defmulti apply-template (defmulti apply-template
"Attach a template based on the current format of the request." "Attach a template based on the current format of the request."
(fn [request response] (:format request))) (fn [request response] *format*))


;; By default, no template is defined. Override this method to include ;; By default, no template is defined. Override this method to include
;; a custom template ;; a custom template
Expand Down

0 comments on commit fc7a501

Please sign in to comment.