Permalink
Browse files

Syncing with website

  • Loading branch information...
1 parent da95eda commit 727bbd286a5d53860b9bfb5972ad4ef9a2d6f98c @alsonkemp committed Jun 10, 2009
Showing with 1,475 additions and 997 deletions.
  1. +1 −0 .gitignore
  2. +7 −0 App/Controllers/HelloWorld.hs
  3. +9 −0 App/Layouts/Default.hs
  4. +33 −0 App/Views/HelloWorld/Index.hs
  5. +47 −0 Config/App.hs
  6. +0 −2 Config/App.hs.sample
  7. +23 −0 Config/Database.hs
  8. +4 −4 Config/Database.hs.sample
  9. +2 −1 Config/Master.hs
  10. +38 −0 Config/Routes.hs
  11. +12 −10 Config/Routes.hs.sample
  12. +2 −0 Turbinado/Controller.hs
  13. +0 −5 Turbinado/Controller/Monad.hs
  14. +59 −121 Turbinado/Database/ORM/{Output.hs → Adapters/Common.hs}
  15. +31 −0 Turbinado/Database/ORM/Adapters/MySQL.hs
  16. +152 −141 Turbinado/Database/ORM/{ → Adapters}/PostgreSQL.hs
  17. +29 −0 Turbinado/Database/ORM/Adapters/Types.hs
  18. +67 −0 Turbinado/Database/ORM/Common.hs
  19. +39 −17 Turbinado/Database/ORM/Generator.hs
  20. +5 −0 Turbinado/Database/ORM/Types.hs
  21. +3 −2 Turbinado/Environment/CodeStore.hs
  22. +2 −3 Turbinado/Environment/Database.hs
  23. +45 −0 Turbinado/Environment/Files.hs
  24. +1 −1 Turbinado/Environment/Header.hs
  25. +103 −30 Turbinado/Environment/Params.hs
  26. +1 −1 Turbinado/Environment/Request.hs
  27. +1 −1 Turbinado/Environment/Response.hs
  28. +1 −1 Turbinado/Environment/Routes.hs
  29. +1 −0 Turbinado/Environment/Settings.hs
  30. +26 −7 Turbinado/Environment/Types.hs
  31. +1 −1 Turbinado/Layout/Helpers/Misc.hs
  32. +3 −2 Turbinado/Layout/Helpers/Tags.hs
  33. +5 −0 Turbinado/Main.hs
  34. +10 −0 Turbinado/PreProcessor/LICENSE
  35. +29 −0 Turbinado/PreProcessor/Parser/Common.hs
  36. +149 −0 Turbinado/PreProcessor/Parser/HAML.hs
  37. +15 −0 Turbinado/PreProcessor/Parser/Id.hs
  38. +160 −0 Turbinado/PreProcessor/Parser/XHTML.hs
  39. +5 −0 Turbinado/PreProcessor/README
  40. +4 −0 Turbinado/PreProcessor/Setup.lhs
  41. +34 −0 Turbinado/PreProcessor/trturbinado.cabal
  42. +34 −0 Turbinado/PreProcessor/trturbinado.hs
  43. +1 −1 Turbinado/Server.hs
  44. +10 −6 Turbinado/Server/Network.hs
  45. +2 −2 Turbinado/Server/RequestProcess.hs
  46. +2 −1 Turbinado/Server/StandardResponse.hs
  47. +1 −1 Turbinado/Server/StaticContent.hs
  48. +1 −1 Turbinado/Stubs/ComponentView.hs
  49. +1 −1 Turbinado/Stubs/Layout.hs
  50. +1 −1 Turbinado/Stubs/View.hs
  51. +27 −25 Turbinado/View.hs
  52. +86 −130 Turbinado/View/HTML.hs
  53. +3 −4 Turbinado/View/Helpers/Misc.hs
  54. +7 −8 Turbinado/View/Helpers/Tags.hs
  55. +10 −33 Turbinado/View/Monad.hs
  56. +0 −129 Turbinado/View/XML.hs
  57. +0 −77 Turbinado/View/XML/PCDATA.hs
  58. +0 −215 Turbinado/View/XMLGenerator.hs
  59. +25 −0 build-turbinado
  60. +4 −4 scripts/GenerateModels.hs
  61. +6 −0 static/css/hscolour.css
  62. +95 −8 turbinado.cabal
View
@@ -3,3 +3,4 @@ tmp/cache
tmp/compiled
*.hi
*.o
+log
@@ -0,0 +1,7 @@
+module App.Controllers.HelloWorld where
+
+import Turbinado.Controller
+
+index :: Controller ()
+index = do setViewDataValue "sample_value" "smarfle!"
+
View
@@ -0,0 +1,9 @@
+module App.Layouts.Default where
+
+import Turbinado.Layout
+
+markup = tag "html" $
+ tag "body" $
+ insertDefaultView
+
+
@@ -0,0 +1,33 @@
+module App.Views.HelloWorld.Index where
+import Turbinado.View
+
+markup :: VHtml
+markup=
+ <div>
+ <% someTextXHtml %>
+ <% someHtml %>
+ <% someHAML %>
+ </div>
+
+-- | These are the raw Turbinado.View.Html style tags
+someTextXHtml :: VHtml
+someTextXHtml = do s <- getViewDataValue_u "sample_value" :: View String
+ ((tag "div") (
+ ((tag "i") (stringToVHtml s)) +++
+ ((tag "b") (stringToVHtml "some text in Turbinado.View.Html style"))
+ ))
+
+someHtml :: VHtml
+someHtml = do s <- getViewDataValue_u "sample_value" :: View String
+ <div>
+ <i><%= s %></i>
+ <b>some text in XHtml style</b>
+ </div>
+
+someHAML :: VHtml
+someHAML = do s <- getViewDataValue_u "sample_value" :: View String
+ %div
+ %i= s
+ %b some text in HAML style
+
+
View
@@ -0,0 +1,47 @@
+module Config.App (
+ useLowerCasePaths,
+ customSetupFilters,
+ customPreFilters,
+ customPostFilters,
+ logLevel
+ ) where
+
+import System.Log.Logger
+
+
+import Turbinado.Controller.Monad
+import Turbinado.Environment.Types
+import Turbinado.Environment.Session.CookieSession
+
+----------------------------------------------------------------
+-- Environment settings
+----------------------------------------------------------------
+
+-- | 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
+
+----------------------------------------------------------------
+-- Session settings
+----------------------------------------------------------------
+sessionOpts = [ ("cookie-name", "turb-sess")
+ , ("cipher-key", "super secret phrase")
+ ]
+
+----------------------------------------------------------------
+-- RequestHandler Filter List additions
+----------------------------------------------------------------
+customSetupFilters :: [Controller ()]
+customSetupFilters = []
+customPreFilters :: [Controller ()]
+customPreFilters = [retrieveSession sessionOpts]
+customPostFilters :: [Controller ()]
+customPostFilters = [persistSession sessionOpts]
+
+
+----------------------------------------------------------------
+-- Logging
+----------------------------------------------------------------
+logLevel = DEBUG -- DEBUG < INFO < NOTICE < WARNING < ERROR < CRITICAL < ALERT < EMERGENCY
+
+
View
@@ -9,8 +9,6 @@ module Config.App (
import System.Log.Logger
--- Your favorite HDBC driver
-import Database.HDBC.PostgreSQL
import Turbinado.Controller.Monad
import Turbinado.Environment.Types
View
@@ -0,0 +1,23 @@
+module Config.Database (
+ databaseConnection,
+ ormAdapter
+ ) where
+
+import System.Log.Logger
+import Database.HDBC
+
+-- Your favorite HDBC driver
+import Database.HDBC.ODBC
+
+import qualified Turbinado.Database.ORM.Adapters.MySQL as M
+import Turbinado.Environment.Types
+----------------------------------------------------------------
+-- Database connection
+----------------------------------------------------------------
+databaseConnection :: Maybe (IO ConnWrapper)
+databaseConnection = Nothing
+--databaseConnection = Just $ connectPostgreSQL "host=localhost dbname=turbinado user=turbinado password=turbinado"
+--databaseConnection = Just $ connectODBC "DSN=krugi_development;USER=root;password=passw0rd"
+
+ormAdapter = M.ormAdapter
+
@@ -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
@@ -14,11 +14,12 @@ compileArgs =
[ "-fglasgow-exts"
, "-XOverlappingInstances"
, "-XUndecidableInstances"
- , "-F", "-pgmFtrhsx"
+ , "-F", "-pgmFtrturbinado"
, "-fno-warn-overlapping-patterns"
, "-odir " ++ compiledDir
, "-hidir " ++ compiledDir
, "-package HDBC"
+ -- , "-keep-tmp-files"
, "-O"
]
View
@@ -0,0 +1,38 @@
+module Config.Routes where
+
+import App.Controllers.HelloWorld
+import App.Layouts.Default
+
+--
+-- Import modules for which you'll be creating static routes.
+--
+
+--
+-- 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", "index", App.Layouts.Default.markup)
+ ]
+
+staticControllers =
+ [
+ ("App/Controller/HelloWorld.hs", "index", App.Controllers.HelloWorld.index)
+ ]
+
+staticViews =
+ [
+ -- example: ("App/Views/HelloWorld/Index.hs", "index", App.Views.HelloWorld.index)
+ ]
View
@@ -3,11 +3,12 @@ module Config.Routes where
--
-- Import modules for which you'll be creating static routes.
--
-import App.Layouts.Default
-import App.Controllers.Home
-import App.Controllers.Develop
-import App.Views.Home.Index
-import App.Views.Develop.Index
+-- 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
@@ -25,15 +26,16 @@ routes = [ "/:controller/:action/:id.:format"
-- Statically compile and load these Layouts, Controllers and Views
--
staticLayouts =
- [ ("App/Layouts/Default.hs", "markup", App.Layouts.Default.markup)
+ [
+ -- ("App/Layouts/Default.hs", "markup", App.Layouts.Default.markup)
]
staticControllers =
- [ ("App/Controllers/Home.hs", "index", App.Controllers.Home.index)
- , ("App/Controllers/Develop.hs", "index", App.Controllers.Develop.index)
+ [
+ --("App/Controllers/Home.hs", "index", App.Controllers.Home.index)
]
staticViews =
- [ ("App/Views/Home/Index.hs", "markup", App.Views.Home.Index.markup)
- , ("App/Views/Develop/Index.hs", "markup", App.Views.Develop.Index.markup)
+ [
+ -- ("App/Views/Develop/Index.hs", "markup", App.Views.Develop.Index.markup)
]
View
@@ -24,6 +24,7 @@ module Turbinado.Controller (
module Turbinado.Controller.Routes,
module Turbinado.Environment.CodeStore,
module Turbinado.Environment.Cookie,
+ module Turbinado.Environment.Files,
module Turbinado.Environment.Header,
module Turbinado.Environment.Logger,
module Turbinado.Environment.Params,
@@ -47,6 +48,7 @@ import Config.Master
import Turbinado.Environment.CodeStore
import Turbinado.Environment.Cookie
import Turbinado.Environment.Database
+import Turbinado.Environment.Files
import Turbinado.Environment.Header
import Turbinado.Environment.Logger
import Turbinado.Environment.Params
@@ -3,7 +3,6 @@ module Turbinado.Controller.Monad (
Controller,
runController,
withController,
-
get,
put,
-- * Functions
@@ -27,12 +26,8 @@ import Turbinado.Utility.General
-- | The Controller monad is a state wrapper around
-- the IO monad.
-
type Controller = StateT Environment IO
-instance HasEnvironment Controller where
- getEnvironment = get
- setEnvironment = put
-- | Runs a Controller computation in a particular environment. Since Controller wraps the IO monad,
-- the result of running it will be an IO computation.
Oops, something went wrong.

0 comments on commit 727bbd2

Please sign in to comment.