Permalink
Browse files

Misc commits

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

0 comments on commit 310f38d

Please sign in to comment.