This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap".
The branch, master has been updated
via 06d60c6e76309e5aa940e6209e4e2ee53ad9a6e2 (commit)
from a2938d4448e91a822270a256b8d1cabbc99e19f8 (commit)
Summary of changes:
project_template/default/src/Glue.hs | 46 --------
project_template/default/src/Main.hs | 30 ------
project_template/default/src/Server.hs | 111 --------------------
project_template/{default => extensions}/foo.cabal | 32 +++---
project_template/extensions/log/access.log | 76 +++++++++++++
project_template/extensions/log/error.log | 11 ++
.../resources/static/screen.css | 0
.../resources/templates/echo.tpl | 0
.../resources/templates/index.tpl | 4 +-
project_template/extensions/src/App.hs | 58 ++++++++++
project_template/extensions/src/Main.hs | 55 ++++++++++
project_template/extensions/src/Site.hs | 56 ++++++++++
src/Snap/Starter.hs | 33 +++---
13 files changed, 290 insertions(+), 222 deletions(-)
delete mode 100644 project_template/default/src/Glue.hs
delete mode 100644 project_template/default/src/Main.hs
delete mode 100644 project_template/default/src/Server.hs
rename project_template/{default => extensions}/foo.cabal (57%)
create mode 100644 project_template/extensions/log/access.log
create mode 100644 project_template/extensions/log/error.log
copy project_template/{hint => extensions}/resources/static/screen.css (100%)
copy project_template/{hint => extensions}/resources/templates/echo.tpl (100%)
copy project_template/{hint => extensions}/resources/templates/index.tpl (93%)
create mode 100644 project_template/extensions/src/App.hs
create mode 100644 project_template/extensions/src/Main.hs
create mode 100644 project_template/extensions/src/Site.hs
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 06d60c6e76309e5aa940e6209e4e2ee53ad9a6e2
Author: Shane <[email protected]>
Date: Thu Jul 15 19:51:53 2010 +0100
Added "extensions" project template, removed old "default" one. The new
default is "hint".
diff --git a/project_template/default/src/Glue.hs
b/project_template/default/src/Glue.hs
deleted file mode 100644
index e6a789c..0000000
--- a/project_template/default/src/Glue.hs
+++ /dev/null
@@ -1,46 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-module Glue
- ( templateHandler
- , defaultReloadHandler
- , templateServe
- , render
- ) where
-
-import Control.Applicative
-import Control.Monad
-import Data.ByteString.Char8 (ByteString)
-import qualified Data.ByteString.Char8 as B
-import Prelude hiding (catch)
-import Snap.Types hiding (dir)
-import Snap.Util.FileServe
-import Text.Templating.Heist
-import Text.Templating.Heist.TemplateDirectory
-
-
-templateHandler :: TemplateDirectory Snap
- -> (TemplateDirectory Snap -> Snap ())
- -> (TemplateState Snap -> Snap ())
- -> Snap ()
-templateHandler td reload f = reload td <|> (f =<< getDirectoryTS td)
-
-
-defaultReloadHandler :: TemplateDirectory Snap -> Snap ()
-defaultReloadHandler td = path "admin/reload" $ do
- e <- reloadTemplateDirectory td
- modifyResponse $ setContentType "text/plain; charset=utf-8"
- writeBS . B.pack $ either id (const "Templates loaded successfully.") e
-
-
-render :: TemplateState Snap -> ByteString -> Snap ()
-render ts template = do
- bytes <- renderTemplate ts template
- flip (maybe pass) bytes $ \x -> do
- modifyResponse $ setContentType "text/html; charset=utf-8"
- writeBS x
-
-
-templateServe :: TemplateState Snap -> Snap ()
-templateServe ts = ifTop (render ts "index") <|> do
- path' <- getSafePath
- when (head path' == '_') pass
- render ts $ B.pack path'
diff --git a/project_template/default/src/Main.hs
b/project_template/default/src/Main.hs
deleted file mode 100644
index 3254b3b..0000000
--- a/project_template/default/src/Main.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-module Main where
-
-import Control.Applicative
-import Snap.Types
-import Snap.Util.FileServe
-import Text.Templating.Heist
-import Text.Templating.Heist.TemplateDirectory
-
-import Glue
-import Server
-
-
-main :: IO ()
-main = do
- td <- newTemplateDirectory' "templates" emptyTemplateState
- quickServer $ templateHandler td defaultReloadHandler $ \ts ->
- ifTop (writeBS "hello world") <|>
- route [ ("foo", writeBS "bar")
- , ("echo/:echoparam", echoHandler)
- ] <|>
- templateServe ts <|>
- dir "static" (fileServe ".")
-
-
-echoHandler :: Snap ()
-echoHandler = do
- param <- getParam "echoparam"
- maybe (writeBS "must specify echo/param in URL")
- writeBS param
diff --git a/project_template/default/src/Server.hs
b/project_template/default/src/Server.hs
deleted file mode 100644
index 2dd625b..0000000
--- a/project_template/default/src/Server.hs
+++ /dev/null
@@ -1,111 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-module Server
- ( ServerConfig(..)
- , emptyServerConfig
- , commandLineConfig
- , server
- , quickServer
- ) where
-import qualified Data.ByteString.Char8 as B
-import Data.ByteString.Char8 (ByteString)
-import Data.Char
-import Control.Concurrent
-import Control.Exception (SomeException)
-import Control.Monad.CatchIO
-import qualified Data.Text as T
-import Prelude hiding (catch)
-import Snap.Http.Server
-import Snap.Types
-import Snap.Util.GZip
-import System hiding (getEnv)
-import System.Posix.Env
-import qualified Text.XHtmlCombinators.Escape as XH
-
-
-data ServerConfig = ServerConfig
- { locale :: String
- , interface :: ByteString
- , port :: Int
- , hostname :: ByteString
- , accessLog :: Maybe FilePath
- , errorLog :: Maybe FilePath
- , compression :: Bool
- , error500Handler :: SomeException -> Snap ()
- }
-
-
-emptyServerConfig :: ServerConfig
-emptyServerConfig = ServerConfig
- { locale = "en_US"
- , interface = "0.0.0.0"
- , port = 8000
- , hostname = "myserver"
- , accessLog = Just "access.log"
- , errorLog = Just "error.log"
- , compression = True
- , error500Handler = \e -> do
- let t = T.pack $ show e
- r = setContentType "text/html; charset=utf-8" $
- setResponseStatus 500 "Internal Server Error" emptyResponse
- putResponse r
- writeBS "<html><head><title>Internal Server Error</title></head>"
- writeBS "<body><h1>Internal Server Error</h1>"
- writeBS "<p>A web handler threw an exception. Details:</p>"
- writeBS "<pre>\n"
- writeText $ XH.escape t
- writeBS "\n</pre></body></html>"
- }
-
-
-commandLineConfig :: IO ServerConfig
-commandLineConfig = do
- args <- getArgs
- let conf = case args of
- [] -> emptyServerConfig
- (port':_) -> emptyServerConfig { port = read port' }
- locale' <- getEnv "LANG"
- return $ case locale' of
- Nothing -> conf
- Just l -> conf {locale = takeWhile (\c -> isAlpha c || c == '_') l}
-
-server :: ServerConfig -> Snap () -> IO ()
-server config handler = do
- putStrLn $ "Listening on " ++ (B.unpack $ interface config)
- ++ ":" ++ show (port config)
- setUTF8Locale (locale config)
- try $ httpServe
- (interface config)
- (port config)
- (hostname config)
- (accessLog config)
- (errorLog config)
- (catch500 $ compress $ handler)
- :: IO (Either SomeException ())
- threadDelay 1000000
- putStrLn "Shutting down"
- where
- catch500 = (`catch` (error500Handler config))
- compress = if compression config then withCompression else id
-
-
-quickServer :: Snap () -> IO ()
-quickServer = (commandLineConfig >>=) . flip server
-
-
-setUTF8Locale :: String -> IO ()
-setUTF8Locale locale' = do
- mapM_ (\k -> setEnv k (locale' ++ ".UTF-8") True)
- [ "LANG"
- , "LC_CTYPE"
- , "LC_NUMERIC"
- , "LC_TIME"
- , "LC_COLLATE"
- , "LC_MONETARY"
- , "LC_MESSAGES"
- , "LC_PAPER"
- , "LC_NAME"
- , "LC_ADDRESS"
- , "LC_TELEPHONE"
- , "LC_MEASUREMENT"
- , "LC_IDENTIFICATION"
- , "LC_ALL" ]
diff --git a/project_template/default/foo.cabal
b/project_template/extensions/foo.cabal
similarity index 57%
rename from project_template/default/foo.cabal
rename to project_template/extensions/foo.cabal
index d3e3b7b..2b31517 100644
--- a/project_template/default/foo.cabal
+++ b/project_template/extensions/foo.cabal
@@ -10,25 +10,27 @@ Category: Web
Build-type: Simple
Cabal-version: >=1.2
-Executable projname
+Flag production
+ Description: Whether to build the server in production (static loading) mode
+ Default: False
+
+Executable foo
hs-source-dirs: src
main-is: Main.hs
+ if flag(production)
+ cpp-options: -DPRODUCTION
+
Build-depends:
- base >= 4,
- haskell98,
- monads-fd >= 0.1 && <0.2,
- bytestring >= 0.9.1 && <0.10,
- snap-core >= 0.2 && <0.3,
- snap-server >= 0.2 && <0.3,
- heist >= 0.2.2 && <0.3,
- hexpat == 0.16,
- xhtml-combinators,
- unix,
- text,
- containers,
- MonadCatchIO-transformers,
- filepath >= 1.1 && <1.2
+ base >= 4 && < 5,
+ bytestring >= 0.9.1 && < 0.10,
+ MonadCatchIO-transformers >= 0.2.1 && < 0.3,
+ monads-fd >= 0.1 && < 0.2,
+ snap >= 0.3 && < 0.4,
+ snap-core >= 0.3 && < 0.4,
+ snap-extensions >= 0.1 && < 0.2,
+ heist >= 0.2.3 && < 0.3,
+ hint >= 0.3.2 && < 0.4
if impl(ghc >= 6.12.0)
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2
diff --git a/project_template/extensions/log/access.log
b/project_template/extensions/log/access.log
new file mode 100644
index 0000000..7d8b18c
--- /dev/null
+++ b/project_template/extensions/log/access.log
@@ -0,0 +1,76 @@
+127.0.0.1 - - [13/Jul/2010:21:11:00 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [13/Jul/2010:21:11:00 +0100] "GET /screen.css HTTP/1.1" 200 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [13/Jul/2010:21:11:00 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:12:44:05 +0100] "GET / HTTP/1.1" 500 80 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:12:44:05 +0100] "GET /favicon.ico HTTP/1.1" 500 80
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:13:04 +0100] "GET / HTTP/1.1" 500 80 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:13:04 +0100] "GET /favicon.ico HTTP/1.1" 500 80
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:01 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:01 +0100] "GET /screen.css HTTP/1.1" 200 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:04 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:04 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:04 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:04 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:04 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:04 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:06 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:06 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:06 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:06 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:06 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:06 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:06 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:10 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:10 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:10 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:10 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:13 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:13 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:13 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:13 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:16 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:16 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:18 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:18 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:18 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:18 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:21 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:21 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:23 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:23 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:23 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:23 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:26 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:26 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:28 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:28 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:28 +0100] "GET / HTTP/1.1" 200 1014 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:14:14:28 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:03 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:03 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:03 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:06 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:08 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:08 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:15:22:08 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:16:02:52 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:16:02:52 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:16:02:52 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:31 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:31 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:31 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:31 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:33 +0100] "GET / HTTP/1.1" 200 1015 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:33 +0100] "GET /screen.css HTTP/1.1" 304 -
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:33 +0100] "GET /favicon.ico HTTP/1.1" 404 3
"http://127.0.0.1:8000/" "Mozilla/5.0 (X11; U; Linux x86_64; en-ie)
AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid ()
Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:36 +0100] "GET /admin/reload HTTP/1.1" 200 58
- "Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:41 +0100] "GET /admin/reload HTTP/1.1" 200 58
- "Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
+127.0.0.1 - - [15/Jul/2010:19:49:43 +0100] "GET / HTTP/1.1" 200 1013 -
"Mozilla/5.0 (X11; U; Linux x86_64; en-ie) AppleWebKit/531.2+ (KHTML, like
Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2"
diff --git a/project_template/extensions/log/error.log
b/project_template/extensions/log/error.log
new file mode 100644
index 0000000..9de2907
--- /dev/null
+++ b/project_template/extensions/log/error.log
@@ -0,0 +1,11 @@
+[15/Jul/2010:18:51:28 +0100] Server.httpServe: START (simple)
+[15/Jul/2010:18:51:50 +0100] [127.0.0.1]: error: GHC error:
+
+<no location info>: malformed integer argument in -O Snap.Extension
Snap.Extension.Heist Snap.Extension.Timer Snap.Extension.Server
+Usage: For basic information, try the `--help' option.
+[15/Jul/2010:19:48:01 +0100] Server.httpServe: START (simple)
+[15/Jul/2010:19:48:28 +0100] Server.httpServe: START (simple)
+[15/Jul/2010:19:49:18 +0100] Server.httpServe: START (simple)
+[15/Jul/2010:19:49:20 +0100] Server.httpServe: START (simple)
+[15/Jul/2010:19:50:06 +0100] Server.httpServe: START (simple)
+[15/Jul/2010:19:50:18 +0100] Server.httpServe: SHUTDOWN
diff --git a/project_template/extensions/resources/static/screen.css
b/project_template/extensions/resources/static/screen.css
new file mode 100644
index 0000000..b052609
--- /dev/null
+++ b/project_template/extensions/resources/static/screen.css
@@ -0,0 +1,26 @@
+html {
+ padding: 0;
+ margin: 0;
+ background-color: #ffffff;
+ font-family: Verdana, Helvetica, sans-serif;
+}
+body {
+ padding: 0;
+ margin: 0;
+}
+a {
+ text-decoration: underline;
+}
+a :hover {
+ cursor: pointer;
+ text-decoration: underline;
+}
+img {
+ border: none;
+}
+#content {
+ padding-left: 1em;
+}
+#info {
+ font-size: 60%;
+}
diff --git a/project_template/extensions/resources/templates/echo.tpl
b/project_template/extensions/resources/templates/echo.tpl
new file mode 100644
index 0000000..a9a3181
--- /dev/null
+++ b/project_template/extensions/resources/templates/echo.tpl
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Echo Page</title>
+ </head>
+ <body>
+ <div id="content">
+ <h1>Is there an echo in here?</h1>
+ </div>
+ <p>You wanted me to say this?</p>
+ <p>"<message/>"</p>
+ <p><a href="/">Return</a></p>
+ </body>
+</html>
diff --git a/project_template/extensions/resources/templates/index.tpl
b/project_template/extensions/resources/templates/index.tpl
new file mode 100644
index 0000000..0296db3
--- /dev/null
+++ b/project_template/extensions/resources/templates/index.tpl
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Snap web server</title>
+ <link rel="stylesheet" type="text/css" href="screen.css"/>
+ </head>
+ <body>
+ <div id="content">
+ <h1>It works!</h1>
+ <p>
+ This is a simple demo page served using
+ <a href="http://snapframework.com/docs/tutorials/heist">Heist</a>
+ and the <a href="http://snapframework.com/">Snap</a> web framework.
+ </p>
+ <p>
+ Echo test:
+ <a href="/echo/cats">cats</a>
+ <a href="/echo/dogs">dogs</a>
+ <a href="/echo/fish">fish</a>
+ </p>
+ <table id="info">
+ <tr>
+ <td>Config generated at:</td>
+ <td><start-time/></td>
+ </tr>
+ <tr>
+ <td>Page generated at:</td>
+ <td><current-time/></td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/project_template/extensions/src/App.hs
b/project_template/extensions/src/App.hs
new file mode 100644
index 0000000..7818fe1
--- /dev/null
+++ b/project_template/extensions/src/App.hs
@@ -0,0 +1,58 @@
+{-
+
+This module defines our application's monad and any application-specific
+information it requires.
+
+-}
+
+module App
+ ( App
+ , appRunner
+ ) where
+
+import Snap.Extension
+import Snap.Extension.Heist
+import Snap.Extension.Timer
+import Text.Templating.Heist
+
+
+------------------------------------------------------------------------------
+-- | 'App' is our application's monad. It uses 'SnapExtend' from
+-- 'Snap.Extension' to provide us with an extended 'MonadSnap' making use of
+-- the Heist and Timer Snap extensions.
+type App = SnapExtend AppState
+
+
+------------------------------------------------------------------------------
+-- | 'AppState' is a record which contains the state needed by the Snap
+-- extensions we're using. We're using Heist so we can easily render Heist
+-- templates, and Timer simply to illustrate the config loading differences
+-- between development and production modes.
+data AppState = AppState
+ { heistState :: HeistState App
+ , timerState :: TimerState
+ }
+
+
+------------------------------------------------------------------------------
+instance HasHeistState AppState where
+ getHeistState = heistState
+ setHeistState s a = a { heistState = s }
+
+
+------------------------------------------------------------------------------
+instance HasTimerState AppState where
+ getTimerState = timerState
+ setTimerState s a = a { timerState = s }
+
+
+------------------------------------------------------------------------------
+-- | The 'Runner' for AppState. For more on 'Runner's, see the README from
+-- the snap-extensions package. Briefly, this is used to generate the
+-- 'AppState' needed for our application and will automatically generate
+-- reload\/cleanup actions for us which we don't need to worry about.
+appRunner :: Runner AppState
+appRunner = do
+ heist <- heistRunner "resources/templates" emptyTemplateState
+ timer <- timerRunner
+ return $ AppState heist timer
diff --git a/project_template/extensions/src/Main.hs
b/project_template/extensions/src/Main.hs
new file mode 100644
index 0000000..82d8172
--- /dev/null
+++ b/project_template/extensions/src/Main.hs
@@ -0,0 +1,55 @@
+{-# LANGUAGE CPP #-}
+
+{-|
+
+This is the entry point for this web server application. It supports easily
+switching between interpreting source and running statically compiled code.
+
+In either mode, the generated program should be run from the root of the
+project tree. It locates its templates, static content, and source files in
+development mode, relative to the current working directory when it is run.
+
+When compiled without the production flag, only changes to the libraries, your
+cabal file, or this file should require a recompile to be picked up.
+Everything else is interpreted at runtime. There are a few consequences of
+this.
+
+First, this is much slower. Running the interpreter seems to take about
+300ms, regardless of the simplicity of the loaded code. The results of the
+interpreter process are cached for a few seconds, to hopefully ensure that
+the the interpreter is only invoked once for each load of a page and the
+resources it depends on.
+
+Second, the generated server binary is MUCH larger, since it links in the GHC
+API (via the hint library).
+
+Third, it results in initialization\/cleanup code defined by the @Runner@
+being called for each request. This is to ensure that the current state is
+compatible with the running action. If your application state takes a long
+time to load or clean up, the penalty will be visible.
+
+Fourth, and the reason you would ever want to actually compile without
+production mode, is that it enables a *much* faster development cycle. You can
+simply edit a file, save your changes, and hit reload to see your changes
+reflected immediately.
+
+When this is compiled with the production flag, all the actions are statically
+compiled in. This results in much faster execution, a smaller binary size,
+only running initialization and cleanup once per application run, and having
+to recompile the server for any code change.
+
+-}
+
+module Main where
+
+#ifdef PRODUCTION
+import Snap.Extension.Server
+#else
+import Snap.Extension.Server.Hint
+#endif
+
+import App
+import Site
+
+main :: IO ()
+main = quickHttpServe appRunner site
diff --git a/project_template/extensions/src/Site.hs
b/project_template/extensions/src/Site.hs
new file mode 100644
index 0000000..1fc5871
--- /dev/null
+++ b/project_template/extensions/src/Site.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+{-|
+
+This is where all the routes and handlers are defined for your site. The
+'site' function combines everything together and is exported by this module.
+
+-}
+
+module Site
+ ( site
+ ) where
+
+import Control.Applicative
+import Data.Maybe
+import Snap.Extension.Heist
+import Snap.Extension.Timer
+import Snap.Util.FileServe
+import Snap.Types
+import Text.Templating.Heist
+
+import App
+
+
+------------------------------------------------------------------------------
+-- | Renders the front page of the sample site.
+--
+-- The 'ifTop' is required to limit this to the top of a route.
+-- Otherwise, the way the route table is currently set up, this action
+-- would be given every request.
+index :: App ()
+index = ifTop $ heistLocal (bindSplices indexSplices) $ render "index"
+ where
+ indexSplices =
+ [ ("start-time", startTimeSplice)
+ , ("current-time", currentTimeSplice)
+ ]
+
+
+------------------------------------------------------------------------------
+-- | Renders the echo page.
+echo :: App ()
+echo = do
+ message <- decodedParam "stuff"
+ heistLocal (bindString "message" message) $ render "echo"
+ where
+ decodedParam p = fromMaybe <*> urlDecode <$> fromMaybe "" <$> getParam p
+
+
+------------------------------------------------------------------------------
+-- | The main entry point handler.
+site :: App ()
+site = route [ ("/", index)
+ , ("/echo/:stuff", echo)
+ ]
+ <|> fileServe "resources/static"
diff --git a/src/Snap/Starter.hs b/src/Snap/Starter.hs
index 348df39..c6312a2 100644
--- a/src/Snap/Starter.hs
+++ b/src/Snap/Starter.hs
@@ -15,9 +15,9 @@ import Snap.StarterTH
------------------------------------------------------------------------------
-- Creates a value tDir :: ([String], [(String, String)])
-$(buildData "tDirDefault" "default")
-$(buildData "tDirBareBones" "barebones")
-$(buildData "tDirHint" "hint")
+$(buildData "tDirBareBones" "barebones")
+$(buildData "tDirHint" "hint")
+$(buildData "tDirExtensions" "extensions")
------------------------------------------------------------------------------
usage :: String
@@ -35,6 +35,7 @@ usage = unlines
data InitFlag = InitBareBones
| InitHelp
| InitHint
+ | InitExtensions
deriving (Show, Eq)
@@ -64,22 +65,17 @@ initProject args = do
putStrLn initUsage
exitFailure
where
- initUsage = unlines
- ["Usage:"
- ,""
- ," snap init"
- ,""
- ," -b --barebones Depend only on -core and -server"
- ," -h --help Print this message"
- ]
+ initUsage = usageInfo "Usage\n snap init\n\nOptions:" options
options =
- [ Option ['b'] ["barebones"] (NoArg InitBareBones)
+ [ Option ['b'] ["barebones"] (NoArg InitBareBones)
"Depend only on -core and -server"
- , Option ['h'] ["help"] (NoArg InitHelp)
+ , Option ['h'] ["help"] (NoArg InitHelp)
"Print this message"
- , Option ['i'] ["hint"] (NoArg InitHint)
- "Depend on hint"
+ , Option ['i'] ["hint"] (NoArg InitHint)
+ "Depend on hint (default)"
+ , Option ['e'] ["extensions"] (NoArg InitExtensions)
+ "Depend on hint and snap-extensions"
]
init' flags = do
@@ -88,9 +84,10 @@ initProject args = do
projName = last dirs
setup' = setup projName
case flags of
- (_:_) | InitHint `elem` flags -> setup' tDirHint
- | InitBareBones `elem` flags -> setup' tDirBareBones
- _ -> setup' tDirDefault
+ (_:_) | InitHint `elem` flags -> setup' tDirHint
+ | InitBareBones `elem` flags -> setup' tDirBareBones
+ | InitExtensions `elem` flags -> setup' tDirExtensions
+ _ -> setup' tDirHint
------------------------------------------------------------------------------
-----------------------------------------------------------------------
hooks/post-receive
--
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap