Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Misc commits

  • Loading branch information...
commit 310f38dd7d13cdb838e2ea6181c61521021c32b5 1 parent 2219fb3
Alson Kemp authored June 09, 2009
34  Config/App.hs.sample
... ...
@@ -1,9 +1,5 @@
1 1
 module Config.App (
2  
-  applicationPath,
3  
-  applicationHost,
4  
-  AppEnvironment (..),
5  
-  newAppEnvironment,
6  
-  databaseConnection,
  2
+  useLowerCasePaths,
7 3
   Connection,
8 4
   customSetupFilters,
9 5
   customPreFilters,
@@ -13,31 +9,35 @@ module Config.App (
13 9
 
14 10
 import System.Log.Logger
15 11
 
16  
--- Your favorite HDBC driver
17  
-import Database.HDBC.PostgreSQL
  12
+
  13
+import Turbinado.Controller.Monad
  14
+import Turbinado.Environment.Types
  15
+import Turbinado.Environment.Session.CookieSession
18 16
 
19 17
 ----------------------------------------------------------------
20 18
 -- Environment settings
21 19
 ----------------------------------------------------------------
22  
-applicationPath = ""
23  
-applicationHost = "localhost:8080"
24 20
 
25  
-data AppEnvironment = AppEnvironment
26  
-newAppEnvironment = AppEnvironment
  21
+-- | Determines whether the server uses URLs of the form FooBar/BimBam or foo_bar/bim_bam.
  22
+-- The Controllers and Views must still be named FooBar.hs and BimBam.hs.
  23
+useLowerCasePaths = True
27 24
 
28 25
 ----------------------------------------------------------------
29  
--- Database connection
  26
+-- Session settings
30 27
 ----------------------------------------------------------------
31  
-databaseConnection :: Maybe (IO Connection)
32  
--- databaseConnection = Nothing
33  
-databaseConnection = Just $ connectPostgreSQL "host=localhost dbname=turbinado user=turbinado password=turbinado"
  28
+sessionOpts = [ ("cookie-name", "turb-sess")
  29
+              , ("cipher-key",  "super secret phrase")
  30
+              ]
34 31
 
35 32
 ----------------------------------------------------------------
36 33
 -- RequestHandler Filter List additions
37 34
 ----------------------------------------------------------------
  35
+customSetupFilters :: [Controller ()]
38 36
 customSetupFilters  = []
39  
-customPreFilters  = []
40  
-customPostFilters = []
  37
+customPreFilters   :: [Controller ()]
  38
+customPreFilters    = [retrieveSession sessionOpts]
  39
+customPostFilters  :: [Controller ()]
  40
+customPostFilters   = [persistSession  sessionOpts]
41 41
 
42 42
 
43 43
 ----------------------------------------------------------------
8  Config/Database.hs.sample
... ...
@@ -1,18 +1,18 @@
1 1
 module Config.Database (
2 2
   databaseConnection,
  3
+  ormAdapter
3 4
   ) where
4 5
 
5 6
 import System.Log.Logger
6 7
 
7 8
 -- Your favorite HDBC driver
8  
-import Database.HDBC.PostgreSQL
  9
+import Database.HDBC.ODBC
  10
+import qualified Turbinado.Database.ORM.Adapters.MySQL as M
9 11
 
10 12
 import Turbinado.Environment.Types
11 13
 ----------------------------------------------------------------
12 14
 -- Database connection
13 15
 ----------------------------------------------------------------
14  
--- databaseConnection :: Maybe (IO Connection)
15  
--- databaseConnection = Nothing
16 16
 databaseConnection = Just $ connectPostgreSQL "host=localhost dbname=turbinado user=turbinado password=turbinado"
17 17
 
18  
-
  18
+ormAdapter = M.ormAdapter
15  Config/Routes.hs
... ...
@@ -1,7 +1,6 @@
1 1
 module Config.Routes where
2 2
 
3  
-import App.Controllers.Home
4  
-import App.Controllers.Develop
  3
+import App.Controllers.HelloWorld
5 4
 
6 5
 --
7 6
 -- Import modules for which you'll be creating static routes.
@@ -23,12 +22,16 @@ routes = [ "/:controller/:action/:id.:format"
23 22
 -- Statically compile and load these Layouts, Controllers and Views
24 23
 --
25 24
 staticLayouts =
26  
-    []
  25
+    [
  26
+      ("App/Layouts/Default.hs",    "index", App.Layout.Default.markup)
  27
+    ]
27 28
 
28 29
 staticControllers = 
29  
-    [ ("App/Controllers/Home.hs",    "index", App.Controllers.Home.index)
30  
-    , ("App/Controllers/Develop.hs", "index", App.Controllers.Develop.index)
  30
+    [ 
  31
+      ("App/Controller/HelloWorld.hs",    "index", App.Controllers.HelloWorld.index)
31 32
     ]
32 33
 
33 34
 staticViews =
34  
-    []
  35
+    [
  36
+      ("App/Views/HelloWorld/Index.hs",    "index", App.Views.HelloWorld.index)
  37
+    ]
36  Config/Routes.hs.sample
... ...
@@ -1,7 +1,41 @@
1 1
 module Config.Routes where
2 2
 
3  
-routes = [ "/:controller/:action/:id"
  3
+--
  4
+-- Import modules for which you'll be creating static routes.
  5
+--
  6
+-- e.g.
  7
+-- import App.Layouts.Default
  8
+-- import App.Controllers.Home
  9
+-- import App.Controllers.Develop
  10
+-- import App.Views.Home.Index
  11
+-- import App.Views.Develop.Index
  12
+
  13
+--
  14
+-- Configure dynamic routes for on-the-fly compiled-and-loaded
  15
+-- modules (ala Rails)
  16
+--
  17
+routes = [ "/:controller/:action/:id.:format"
  18
+         , "/:controller/:action/:id"
4 19
          , "/:controller/:action.:format"
5 20
          , "/:controller/:action"
6 21
          , "/:controller"
  22
+         , "/home"
7 23
          ]
  24
+
  25
+--
  26
+-- Statically compile and load these Layouts, Controllers and Views
  27
+--
  28
+staticLayouts =
  29
+    [
  30
+    -- ("App/Layouts/Default.hs",     "markup", App.Layouts.Default.markup)
  31
+    ]
  32
+
  33
+staticControllers = 
  34
+    [ 
  35
+    --("App/Controllers/Home.hs",    "index", App.Controllers.Home.index)
  36
+    ]
  37
+
  38
+staticViews =
  39
+    [
  40
+    --  ("App/Views/Develop/Index.hs", "markup", App.Views.Develop.Index.markup)
  41
+    ]
1  turbinado.cabal
@@ -141,4 +141,3 @@ Library
141 141
                  Turbinado.View.Helpers.Tags
142 142
                  Turbinado.View.Monad
143 143
 
144  
-

0 notes on commit 310f38d

Please sign in to comment.
Something went wrong with that request. Please try again.