浏览代码

Keep plugin-conf-error condition with near the plugin handling code.

Brit Butler 11 年之前
父节点
当前提交
57f9aeb696
共有 3 个文件被更改,包括 8 次插入11 次删除
  1. 1 2
      plugins/twitter.lisp
  2. 0 9
      src/conditions.lisp
  3. 7 0
      src/config.lisp

+ 1 - 2
plugins/twitter.lisp

75
 
75
 
76
   ;; fallback to chirp for credential erros
76
   ;; fallback to chirp for credential erros
77
   (chirp:account/verify-credentials)
77
   (chirp:account/verify-credentials)
78
-  
79
   (when tweet-format
78
   (when tweet-format
80
     (setf *tweet-format* tweet-format)))
79
     (setf *tweet-format* tweet-format)))
81
 
80
 
87
      :do (tweet-new-post file)))
86
      :do (tweet-new-post file)))
88
 
87
 
89
 (defun tweet-new-post (file)
88
 (defun tweet-new-post (file)
90
-  "Retrieve most recent post from in memory DB and publish it."
89
+  "Retrieve content matching FILE from in memory DB and publish it."
91
   (let ((post (coleslaw::find-content-by-path file)))
90
   (let ((post (coleslaw::find-content-by-path file)))
92
     (chirp:statuses/update (%format-post 0 post))))
91
     (chirp:statuses/update (%format-post 0 post))))
93
 
92
 

+ 0 - 9
src/conditions.lisp

1
-(in-package :coleslaw)
2
-
3
-(define-condition plugin-conf-error ()
4
-  ((plugin :initform "Plugin":initarg :plugin :reader plugin)
5
-   (message :initform "" :initarg :message :reader message))
6
-  (:report (lambda (condition stream)
7
-             (format stream "~A: ~A" (plugin condition) (message condition))))
8
-  (:documentation "Condition to signal when the plugin is misconfigured."))
9
-

+ 7 - 0
src/config.lisp

19
 (defparameter *config* nil
19
 (defparameter *config* nil
20
   "A variable to store the blog configuration and plugin settings.")
20
   "A variable to store the blog configuration and plugin settings.")
21
 
21
 
22
+(define-condition plugin-conf-error ()
23
+  ((plugin  :initarg :plugin :reader plugin)
24
+   (message :initarg :message :reader message))
25
+  (:report (lambda (condition stream)
26
+             (format stream "~A: ~A" (plugin condition) (message condition))))
27
+  (:documentation "Condition to signal when the plugin is misconfigured."))
28
+
22
 (defun enable-plugin (name args)
29
 (defun enable-plugin (name args)
23
   "Given a plugin, NAME, compile+load it and call its ENABLE function with ARGS."
30
   "Given a plugin, NAME, compile+load it and call its ENABLE function with ARGS."
24
   (flet ((plugin-path (sym)
31
   (flet ((plugin-path (sym)