packages feed

bamboo 2009.5.19 → 2009.5.22

raw patch · 4 files changed

+51/−105 lines, 4 filesdep ~rss

Dependency ranges changed: rss

Files

bamboo.cabal view
@@ -1,5 +1,5 @@ Name:                 bamboo-Version:              2009.5.19+Version:              2009.5.22 Build-type:           Simple Synopsis:             A simple blog middleware on hack Description:          A simple blog middleware on hack@@ -15,7 +15,7 @@  library   ghc-options: -Wall -fno-warn-missing-signatures -fno-warn-name-shadowing -fno-warn-orphans -fno-warn-type-defaults-  build-depends: base, cgi, network, haskell98, old-locale, old-time, time, unix, bytestring, base64-string, zlib, directory, filepath, containers, process,parsedate >= 3000.0.0, rss >= 3000.0.1, xhtml, utf8-string >= 0.3.3, pandoc, parsec >= 2, gravatar >= 0.3, data-default >= 0.2,  mps >= 2009.5.13, hcheat >= 2009.5.13, hack >= 2009.5.19, hack-contrib >= 2009.5.19, tokyocabinet-haskell >= 0.0.5+  build-depends: base, cgi, network, haskell98, old-locale, old-time, time, unix, bytestring, base64-string, zlib, directory, filepath, containers, process,parsedate >= 3000.0.0, rss == 3000.0.1, xhtml, utf8-string >= 0.3.3, pandoc, parsec >= 2, gravatar >= 0.3, data-default >= 0.2,  mps >= 2009.5.13, hcheat >= 2009.5.13, hack >= 2009.5.19, hack-contrib >= 2009.5.19, tokyocabinet-haskell >= 0.0.5   hs-source-dirs: src/   exposed-modules:                       Bamboo@@ -38,6 +38,7 @@                     Bamboo.Model.Comment                     Bamboo.Model.Album                     Bamboo.Model.Static+                    Bamboo.Model.Counter                                                               Bamboo.Type.Theme
changelog.md view
@@ -1,3 +1,11 @@+2009.5.22+---------++### Fix++* add missing model counter+* note, I changed rss to strict == 3000.0.1, since happstack depends on HaXml 1.13 or something, which is not compatible with the latest rss package.+ 2009.5.19 --------- 
readme.md view
@@ -40,7 +40,7 @@  ### blog -[My blog](http://jinjing.easymic.com) source is available as a git repo:+[Jinjing's blog](http://jinjing.easymic.com) source is available as a git repo:      git clone git://github.com/nfjinjing/jinjing-blog.git @@ -52,7 +52,7 @@  [jinjing's blog config file](http://github.com/nfjinjing/jinjing-blog/blob/401a541443d88bbf8d844874c1473d4b3bc81784/config/site.txt) -## Install in 3 steps+## Easy install in 3 steps  ### 1. tokyo-cabinet (used for caching) @@ -68,7 +68,7 @@      Just find this tokyo-cabinet package and install it :) -### 2. Bamboo Middleware+### 2. Bamboo Launcher  #### update cabal @@ -77,109 +77,12 @@ #### install bamboo      cabal install happy-    cabal install rss --reinstall-    cabal install bamboo--### 3. Pick any hack handler--#### Happstack--    cabal install hack-handler-happstack+    cabal install bamboo-launcher -##### get a starter kit ( template )+### 3. Run      mkdir myblog-    cd myblog-    -    # get a template to start-    git clone git://github.com/nfjinjing/bamboo-template.git db-    -##### create an entry point-    -put this into Main.hs-    -    module Main where--    import Bamboo-    import Hack.Handler.Happstack--    import Hack.Contrib.Utils-    import Hack.Contrib.Middleware.ContentType-    import Hack.Contrib.Middleware.ContentLength-    import Hack.Contrib.Middleware.ShowExceptions-    import Hack.Contrib.Middleware.Static---    import qualified Hack.Contrib.Middleware.Head as H--    default_content_type = "text/plain; charset=UTF-8"--    middleware_stack = -      [  dummy_middleware--      -- completeness-      ,  content_length-      ,  content_type default_content_type--      -- debuging-      ,  show_exceptions Nothing--      -- optimization-      ,  H.head--      -- static serve-      ,  static (Just "db/public") ["/theme", "/images", "/plugin", "/favicon.ico"]--      -- real app-      ,  bamboo-      ]--    app = use middleware_stack dummy_app--    main = run app-    -    --##### run--    ghc --make -O2 Main.hs-    ./Main--It should be running on [http://127.0.0.1:3000](http://127.0.0.1:3000) now.--#### Kibro--##### Install Kibro--    cabal install kibro-    cabal install hack-handler-kibro--##### Install lighttpd 1.4.19 (used by kibro)--    wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz-    tar zxfv lighttpd-1.4.19.tar.gz-    cd lighttpd-1.4.19-    ./configure --prefix=$HOME-    make-    make install--make sure `~/sbin` is in your `$PATH`.--You also need [spawn-fcgi](http://redmine.lighttpd.net/projects/spawn-fcgi) in your path. I don't remember how I got mine, but it should come with lighttpd somewhere ...--##### bootstrap--    # bamboo is a kibro project-    kibro new myblog-    cd myblog-    -    # get a template to start-    git clone git://github.com/nfjinjing/bamboo-template.git db-    sh db/extra/scripts/bootstrap.sh-    -##### run--    kibro start+    bamboo-launcher  It should be running on [http://127.0.0.1:3000](http://127.0.0.1:3000) now. 
+ src/Bamboo/Model/Counter.hs view
@@ -0,0 +1,34 @@+{-# LANGUAGE NoImplicitPrelude #-}++module Bamboo.Model.Counter where++-- env+import Bamboo.Helper.Env +import qualified Bamboo.Config.Global as G+import qualified System.IO as IO++hit x = create_stat_if_none x >> x.inc_stat++count_name = (/ G.count_meta)+count_path = (G.stat_uri / ) > count_name++default_count = 1+create_stat x = mkdir_p (x.take_directory) >> default_count.show.write_file x++create_stat_if_none x = do+  let i = x.count_path+  has_stat <- i.file_exist+  if has_stat+    then return ()+    else i.create_stat++safe_read_line x = with_file x IO.ReadMode IO.hGetLine ++inc_stat x = do+  let i = x.count_path+  c <- i.safe_read_line+  c.read.(+1).show.write_file i++read_stat x = do+  create_stat_if_none x+  safe_read_line (x.count_path) ^ read