CategoLJBlog System Written in Clojurehttps://github.com/making/categolj@making
contentsCategoLJ開発までの経緯あーきてくちゃ拡張性
CategoLJ開発までの経緯
CategoLJCategorizer written in Clojure簡易ブログシステム。自分のメモようにWikiっぽいカテゴリ分けができる軽量なシステムがほしかった
CategolCommonLisp版つくってみたもののcl-buildが依存ライブラリをアップデートして動かん導入の敷居が高すぎた。誰にもつかってもらえん拡張性を高めるのが難しかった各種DB対応HTMLのテーマ変更 (cl-whoェ。。。)マルチスレッド系のバグ?でちょいちょいhunchentootがストプしてblogが落ちていた
逆引きClojurehttp://rd.clojure-users.orgつくってみたもののHtml変更めんどい(hiccupェ。。。)
CategoLJと逆引きClojureから学んだことおれにはS式でHTMLを書くのは合わん
CategoLJへCategoLとURL互換なものをClojureで書き直したClojureだとライブラリ管理が簡単APサーバ安定導入が簡単逆引きClojureでの知見も取り入れるMarkdownいい拡張性を高めるRDBだけでなく今流行りのNoSQLにも対応HTMLテーマ変更可能(後々はHTML5対応へ)http://blog.ik.amで運用開始
アーキテクチャ
CompojureRingEnliveDataAccessrequestRingresponse
CompojureRingEnliveDataAccessrequestRingresponse
themeCompojureRingEnliveDataAccessrequestRingresponse
ちなみにClojure1.3ですNamespace戦争終結?clojure.stringclojure.java.iocontribがマイクロカーネルに必要なモジュールだけ指定clojure.contrib.loggingは1.3からslf4j対応
拡張性
対応している拡張性DB変更テーマ変更
DataAccess層を抽象化して拡張性を実現(defprotocolDataAccess  ;; entry  (get-entry-by-id [this id])  (get-entries-by-page [this page count])  (get-entries-only-id-title [this count])  (get-total-entry-count [this])  (get-categorized-entries-by-page [this category page count])  (get-categorized-entry-count [this category])  (insert-entry [this entry])  (update-entry [this entry])  (delete-entry [this entry])  (get-all-category-list [this])  ;; user  (auth-user [this user]))このAPIを実装すれば誰でも好きなDBへの対応ができる
設定ファイル(config.clj){:theme "default", :title "CategoLJ", :port 8944,;; MirageDataAccess:daccess {:ns am.ik.categolj.daccess.mirage.daccess,:params {;; MySQL;; :db {:classname "com.mysql.jdbc.Driver";;      :subprotocol "mysql";;      :subname "//localhost/categolj";;      :user "root";;      :password ""};; HSQLDB:db {:classname "org.hsqldb.jdbcDriver":subprotocol "hsqldb":subname "mem:categolj":user "sa":password ""}}},}ここ見て動的に作成
MongoDB用設定;; Mongodb:daccess {:ns am.ik.categolj.daccess.mongodb.daccess          :params {                   :db "categolj"                   :host "localhost“                   :port 27017}}
Cassandra用の設定;; Cassandra:daccess {:ns am.ik.categolj.daccess.cassandra.daccess          :params {                   :keyspace "categolj"                   :host "localhost"                   :port 9160}}鋭意対応中
テーマ変更resource/theme/<テーマ名>/以下のall-categories.htmldelete.htmledit.htmlfooter.htmlform.htmlheader.htmllayout.htmllogged-in-menu.htmllogged-out-menu.htmllogin.htmlmain.htmlsidebar.htmlを作る。。ルールがあるので要ドキュメント化!
おわりまだ動けばいいやレベル開発者絶賛募集中試していじってプルリクエスト!$ git clone git://github.com/making/categolj.git$ leindeps$ leinjavac$ lein run serverAccsess http://localhost:8944

CategoLJについて