[bknr-cvs] r2493 - branches/trunk-reorg/projects/hello-web/src

ksprotte at common-lisp.net ksprotte at common-lisp.net
Thu Feb 14 12:23:15 UTC 2008


Author: ksprotte
Date: Thu Feb 14 07:23:14 2008
New Revision: 2493

Modified:
   branches/trunk-reorg/projects/hello-web/src/config.lisp
   branches/trunk-reorg/projects/hello-web/src/hello-web.asd
   branches/trunk-reorg/projects/hello-web/src/init.lisp
   branches/trunk-reorg/projects/hello-web/src/packages.lisp
   branches/trunk-reorg/projects/hello-web/src/webserver.lisp
Log:
ported hello-web for trunk-reorg


Modified: branches/trunk-reorg/projects/hello-web/src/config.lisp
==============================================================================
--- branches/trunk-reorg/projects/hello-web/src/config.lisp	(original)
+++ branches/trunk-reorg/projects/hello-web/src/config.lisp	Thu Feb 14 07:23:14 2008
@@ -3,10 +3,15 @@
 ;; URL für BASE HREFs
 (defparameter *website-url* "http://hello-web.bknr.net")
 
-(defparameter *root-directory* #p"home:bknr-svn/projects/hello-web/")
+(defparameter *root-directory*
+  (let ((system-path (asdf:component-pathname (asdf:find-system :hello-web))))
+    (truename
+     (merge-pathnames (make-pathname :directory '(:relative :up) :defaults system-path)
+                      system-path))))
 
 (defparameter *store-directory* (merge-pathnames #p"datastore/" *root-directory*))
 
 (defparameter *website-directory* (merge-pathnames #p"website/" *root-directory*))
 
-(defparameter *webserver-port* 8080)
\ No newline at end of file
+(defparameter *webserver-port* 8080)
+(defvar *webserver* nil)

Modified: branches/trunk-reorg/projects/hello-web/src/hello-web.asd
==============================================================================
--- branches/trunk-reorg/projects/hello-web/src/hello-web.asd	(original)
+++ branches/trunk-reorg/projects/hello-web/src/hello-web.asd	Thu Feb 14 07:23:14 2008
@@ -17,8 +17,7 @@
   :long-description ""
 
   :depends-on (:cl-interpol
-	       :cl-ppcre
-	       :aserve
+	       :cl-ppcre	       
 	       :cxml
 	       :bknr-modules)
 

Modified: branches/trunk-reorg/projects/hello-web/src/init.lisp
==============================================================================
--- branches/trunk-reorg/projects/hello-web/src/init.lisp	(original)
+++ branches/trunk-reorg/projects/hello-web/src/init.lisp	Thu Feb 14 07:23:14 2008
@@ -1,17 +1,29 @@
 (in-package :hello-web)
 
-(defun startup ()
+(defun startup (&key debug)
   (when *store*
     (close-store))
+  ;; XXX hack hack hack
+  (mapcar #'cl-gd::load-foreign-library
+	  '("/usr/lib/libcrypto.so"
+	    "/usr/lib/libssl.so"
+	    "/usr/local/lib/libgd.so"
+	    "/home/hans/bknr-svn/thirdparty/cl-gd-0.5.6/cl-gd-glue.so"))
+  (setf *hunchentoot-default-external-format* (flex:make-external-format :utf-8 :eol-style :lf))
   (make-instance 'store
 		 :directory *store-directory*
 		 :subsystems (list (make-instance 'store-object-subsystem)
 				   (make-instance 'blob-subsystem
 						  :n-blobs-per-directory 1000)))
   (unless (find-user "anonymous")
-    (make-user "anonymous")		; used for all anonymous sessions
+    (make-user "anonymous")          ; used for all anonymous sessions
     (make-user "admin" :password "admin" :full-name "Administrator" :flags '(:admin))
-    (import-image "bknr-logo.png" :keywords '(:banner :bknr))
+    (import-image (merge-pathnames #p"src/bknr-logo.png" hello-web.config:*root-directory*)
+                  :keywords '(:banner :bknr))
     (make-rss-channel "default" "BKNR Hello Web" "default RSS channel of the BKNR hello web site" *website-url*))
   
-  (publish-hello-web))
+  (publish-hello-web)
+  (setq hunchentoot:*catch-errors-p* (not debug))
+  (when *webserver*
+    (hunchentoot:stop-server *webserver*))
+  (setq *webserver* (hunchentoot:start-server :port *webserver-port*)))

Modified: branches/trunk-reorg/projects/hello-web/src/packages.lisp
==============================================================================
--- branches/trunk-reorg/projects/hello-web/src/packages.lisp	(original)
+++ branches/trunk-reorg/projects/hello-web/src/packages.lisp	Thu Feb 14 07:23:14 2008
@@ -6,17 +6,17 @@
   (:export #:*website-url*
 	   #:*website-directory*
 	   #:*webserver-port*
-	   #:*store-directory*))
+           #:*webserver*
+	   #:*store-directory*
+           #:*root-directory*))
 
 (defpackage :hello-web.tags
   (:use :cl
 	:cl-user
-	:ext
 	:bknr.web
 	:xhtml-generator
 	:hello-web.config)
-  (:shadowing-import-from :cl-interpol #:quote-meta-chars)
-  (:shadowing-import-from :acl-compat.mp #:process-kill #:process-wait)
+  (:shadowing-import-from :cl-interpol #:quote-meta-chars)  
   (:export #:hello))
 
 (defpackage :hello-web.imageproc
@@ -31,7 +31,6 @@
 (defpackage :hello-web
   (:use :cl
 	:cl-user
-	:ext
 	:cl-interpol
 	:cl-ppcre
 	:bknr.utils

Modified: branches/trunk-reorg/projects/hello-web/src/webserver.lisp
==============================================================================
--- branches/trunk-reorg/projects/hello-web/src/webserver.lisp	(original)
+++ branches/trunk-reorg/projects/hello-web/src/webserver.lisp	Thu Feb 14 07:23:14 2008
@@ -7,29 +7,27 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defun publish-hello-web (&key (port *webserver-port*) (listeners 20))
-
+(defun publish-hello-web ()
   (make-instance 'website
 		 :name "Hello Web CMS"
 		 :handler-definitions `(("/hello-object" hello-object-handler)
 					("/" redirect-handler
-					 :prefix "/" :to "/index")
+                                             :prefix "/" :to "/index")
 					("/rss" rss-handler)
 					("/" template-handler
-					 :prefix "/"
-					 :destination ,(namestring (merge-pathnames #p"templates/" *website-directory*))
-					 :command-packages ((:hello-web . :hello-web.tags)
-							    (:bknr . :bknr.web)
-							    (:menu . :bknr.site-menu)))
+                                             :prefix "/"
+                                             :destination ,(namestring (merge-pathnames #p"templates/" *website-directory*))
+                                             :command-packages (("http://hello-web.bknr.net" . :hello-web.tags)
+                                                                ("http://bknr.net" . :bknr.web)))
+                                        images
+                                        user
 					("/static" directory-handler
-					 :destination ,(unix-namestring (merge-pathnames #p"static/" *website-directory*))))
-		 :modules '(images user)
+                                                   :destination ,(namestring (merge-pathnames #p"static/" *website-directory*))))	       
 		 :admin-navigation '(("user" . "/user/")
 				     ("images" . "/edit-images")
 				     ("import" . "/import")
 				     ("logout" . "/logout"))
 		 :authorizer (make-instance 'bknr-authorizer)
 		 :style-sheet-urls '("/static/styles.css")
-		 :javascript-urls '("/static/javascript.js"))
+		 :javascript-urls '("/static/javascript.js")))
 
-  (start :port port :listeners listeners))



More information about the Bknr-cvs mailing list