Handler->Application, ~sitearg~.hs->Foundation.hs

This commit is contained in:
Greg Weber 2011-08-21 22:36:00 -07:00
parent d535720a0b
commit 678288db13
14 changed files with 27 additions and 27 deletions

View File

@ -83,7 +83,7 @@ devel cabalCmd = do
, concat , concat
[ "import \"" [ "import \""
, pi' , pi'
, "\" Handler (withDevelAppPort)" , "\" Application (withDevelAppPort)"
] ]
, "import Data.Dynamic (fromDynamic)" , "import Data.Dynamic (fromDynamic)"
, "import Network.Wai.Handler.Warp (run)" , "import Network.Wai.Handler.Warp (run)"

View File

@ -158,11 +158,11 @@ scaffold = do
writeFile' ("config/settings.yml") $(codegen "config/settings.yml") writeFile' ("config/settings.yml") $(codegen "config/settings.yml")
writeFile' ("main.hs") $(codegen "main.hs") writeFile' ("main.hs") $(codegen "main.hs")
writeFile' (project ++ ".cabal") $ ifTiny $(codegen "tiny/cabal") $(codegen "project.cabal") writeFile' (project ++ ".cabal") $ ifTiny $(codegen "tiny/project.cabal") $(codegen "project.cabal")
writeFile' ".ghci" $(codegen ".ghci") writeFile' ".ghci" $(codegen ".ghci")
writeFile' "LICENSE" $(codegen "LICENSE") writeFile' "LICENSE" $(codegen "LICENSE")
writeFile' (sitearg ++ ".hs") $ ifTiny $(codegen "tiny/sitearg.hs") $(codegen "sitearg.hs") writeFile' ("Foundation.hs") $ ifTiny $(codegen "tiny/Foundation.hs") $(codegen "Foundation.hs")
writeFile' "Handler.hs" $ ifTiny $(codegen "tiny/Handler.hs") $(codegen "Handler.hs") writeFile' "Application.hs" $ ifTiny $(codegen "tiny/Application.hs") $(codegen "Application.hs")
writeFile' "Handler/Root.hs" $ ifTiny $(codegen "tiny/Handler/Root.hs") $(codegen "Handler/Root.hs") writeFile' "Handler/Root.hs" $ ifTiny $(codegen "tiny/Handler/Root.hs") $(codegen "Handler/Root.hs")
unless isTiny $ writeFile' "Model.hs" $(codegen "Model.hs") unless isTiny $ writeFile' "Model.hs" $(codegen "Model.hs")
writeFile' "config/Settings.hs" $ ifTiny $(codegen "tiny/config/Settings.hs") $(codegen "config/Settings.hs") writeFile' "config/Settings.hs" $ ifTiny $(codegen "tiny/config/Settings.hs") $(codegen "config/Settings.hs")

View File

@ -3,12 +3,12 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-} {-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
module Handler module Application
( with~sitearg~ ( with~sitearg~
, withDevelAppPort , withDevelAppPort
) where ) where
import ~sitearg~ import Foundation
import Settings import Settings
import Yesod.Static import Yesod.Static
import Yesod.Auth import Yesod.Auth
@ -27,7 +27,7 @@ import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar)
import Handler.Root import Handler.Root
-- This line actually creates our YesodSite instance. It is the second half -- This line actually creates our YesodSite instance. It is the second half
-- of the call to mkYesodData which occurs in ~sitearg~.hs. Please see -- of the call to mkYesodData which occurs in Foundation.hs. Please see
-- the comments there for more details. -- the comments there for more details.
mkYesodDispatch "~sitearg~" resources~sitearg~ mkYesodDispatch "~sitearg~" resources~sitearg~

View File

@ -1,6 +1,6 @@
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-} {-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}
{-# LANGUAGE OverloadedStrings, MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings, MultiParamTypeClasses #-}
module ~sitearg~ module Foundation
( ~sitearg~ (..) ( ~sitearg~ (..)
, ~sitearg~Route (..) , ~sitearg~Route (..)
, resources~sitearg~ , resources~sitearg~

View File

@ -1,7 +1,7 @@
{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings #-} {-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings #-}
module Handler.Root where module Handler.Root where
import ~sitearg~ import Foundation
-- This is a handler function for the GET request method on the RootR -- This is a handler function for the GET request method on the RootR
-- resource pattern. All of your resource patterns are defined in -- resource pattern. All of your resource patterns are defined in

View File

@ -5,7 +5,7 @@
-- includes database connection settings, static file locations, etc. -- includes database connection settings, static file locations, etc.
-- In addition, you can configure a number of different aspects of Yesod -- In addition, you can configure a number of different aspects of Yesod
-- by overriding methods in the Yesod typeclass. That instance is -- by overriding methods in the Yesod typeclass. That instance is
-- declared in the ~sitearg~.hs file. -- declared in the Foundation.hs file.
module Settings module Settings
( hamletFile ( hamletFile
, cassiusFile , cassiusFile
@ -49,7 +49,7 @@ data AppEnvironment = Test
-- Use dynamic settings to avoid the need to re-compile the application (between staging and production environments). -- Use dynamic settings to avoid the need to re-compile the application (between staging and production environments).
-- --
-- By convention these settings should be overwritten by any command line arguments. -- By convention these settings should be overwritten by any command line arguments.
-- See config/~sitearg~.hs for command line arguments -- See config/Foundation.hs for command line arguments
-- Command line arguments provide some convenience but are also required for hosting situations where a setting is read from the environment (appPort on Heroku). -- Command line arguments provide some convenience but are also required for hosting situations where a setting is read from the environment (appPort on Heroku).
-- --
data AppConfig = AppConfig { data AppConfig = AppConfig {
@ -111,10 +111,10 @@ staticDir = "static"
-- please see: -- please see:
-- http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain -- http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain
-- --
-- If you change the resource pattern for StaticR in ~sitearg~.hs, you will -- If you change the resource pattern for StaticR in Foundation.hs, you will
-- have to make a corresponding change here. -- have to make a corresponding change here.
-- --
-- To see how this value is used, see urlRenderOverride in ~sitearg~.hs -- To see how this value is used, see urlRenderOverride in Foundation.hs
staticRoot :: AppConfig -> Text staticRoot :: AppConfig -> Text
staticRoot conf = [st|#{appRoot conf}/static|] staticRoot conf = [st|#{appRoot conf}/static|]

View File

@ -1,7 +1,7 @@
{-# LANGUAGE CPP, DeriveDataTypeable #-} {-# LANGUAGE CPP, DeriveDataTypeable #-}
import qualified Settings as Settings import qualified Settings as Settings
import Settings (AppConfig(..)) import Settings (AppConfig(..))
import Handler (with~sitearg~) import Application (with~sitearg~)
import Network.Wai.Handler.Warp (run) import Network.Wai.Handler.Warp (run)
import System.Console.CmdArgs hiding (args) import System.Console.CmdArgs hiding (args)
import Data.Char (toUpper, toLower) import Data.Char (toUpper, toLower)

View File

@ -25,9 +25,9 @@ library
Buildable: True Buildable: True
else else
Buildable: False Buildable: False
exposed-modules: Handler exposed-modules: Application
hs-source-dirs: ., config hs-source-dirs: ., config
other-modules: ~sitearg~ other-modules: Foundation
Model Model
Settings Settings
StaticFiles StaticFiles

View File

@ -7,7 +7,7 @@ module Handler
, withDevelApp , withDevelApp
) where ) where
import ~sitearg~ import Foundation
import Settings import Settings
import Yesod.Static import Yesod.Static
import Yesod.Logger (makeLogger, flushLogger, Logger) import Yesod.Logger (makeLogger, flushLogger, Logger)
@ -19,7 +19,7 @@ import Data.Dynamic (Dynamic, toDyn)
import Handler.Root import Handler.Root
-- This line actually creates our YesodSite instance. It is the second half -- This line actually creates our YesodSite instance. It is the second half
-- of the call to mkYesodData which occurs in ~sitearg~.hs. Please see -- of the call to mkYesodData which occurs in Foundation.hs. Please see
-- the comments there for more details. -- the comments there for more details.
mkYesodDispatch "~sitearg~" resources~sitearg~ mkYesodDispatch "~sitearg~" resources~sitearg~

View File

@ -1,6 +1,6 @@
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-} {-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module ~sitearg~ module Foundation
( ~sitearg~ (..) ( ~sitearg~ (..)
, ~sitearg~Route (..) , ~sitearg~Route (..)
, resources~sitearg~ , resources~sitearg~

View File

@ -27,7 +27,7 @@ library
Buildable: False Buildable: False
exposed-modules: Handler exposed-modules: Handler
hs-source-dirs: ., config hs-source-dirs: ., config
other-modules: ~sitearg~ other-modules: Foundation
Settings Settings
StaticFiles StaticFiles
Handler.Root Handler.Root

View File

@ -11,7 +11,7 @@ cabal clean && cabal install && cabal sdist
for f in $(ls -1rt dist/*.tar.gz | tail -1) for f in $(ls -1rt dist/*.tar.gz | tail -1)
do do
tar -xzvf $f && cd `basename $f .tar.gz` tar -xzvf $f && cd `basename $f .tar.gz`
shelltest ../tests/scaffold.shelltest --color --diff $@ -- --hide-successes shelltest ../test/scaffold.shelltest --color --diff $@ -- --hide-successes
cd .. cd ..
rm -r `basename $f .tar.gz` rm -r `basename $f .tar.gz`
done done

View File

@ -1,4 +1,4 @@
# Important! run with tests/run.sh # Important! run with test/run.sh
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd .. rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
<<< <<<

View File

@ -20,12 +20,12 @@ extra-source-files:
scaffold/cassius/default-layout.cassius.cg scaffold/cassius/default-layout.cassius.cg
scaffold/cassius/homepage.cassius.cg scaffold/cassius/homepage.cassius.cg
scaffold/Model.hs.cg scaffold/Model.hs.cg
scaffold/sitearg.hs.cg scaffold/Foundation.hs.cg
scaffold/LICENSE.cg scaffold/LICENSE.cg
scaffold/mongoDBConnPool.cg scaffold/mongoDBConnPool.cg
scaffold/tiny/sitearg.hs.cg scaffold/tiny/Foundation.hs.cg
scaffold/tiny/cabal.cg scaffold/tiny/project.cabal.cg
scaffold/tiny/Handler.hs.cg scaffold/tiny/Application.hs.cg
scaffold/tiny/hamlet/homepage.hamlet.cg scaffold/tiny/hamlet/homepage.hamlet.cg
scaffold/tiny/Handler/Root.hs.cg scaffold/tiny/Handler/Root.hs.cg
scaffold/tiny/config/routes.cg scaffold/tiny/config/routes.cg
@ -35,7 +35,7 @@ extra-source-files:
scaffold/sqliteConnPool.cg scaffold/sqliteConnPool.cg
scaffold/.ghci.cg scaffold/.ghci.cg
scaffold/project.cabal.cg scaffold/project.cabal.cg
scaffold/Handler.hs.cg scaffold/Application.hs.cg
scaffold/julius/homepage.julius.cg scaffold/julius/homepage.julius.cg
scaffold/hamlet/homepage.hamlet.cg scaffold/hamlet/homepage.hamlet.cg
scaffold/hamlet/default-layout.hamlet.cg scaffold/hamlet/default-layout.hamlet.cg