Merge remote-tracking branch 'parcs/purge-cpp'
This commit is contained in:
commit
9c7b8db916
@ -155,6 +155,7 @@ scaffold = do
|
|||||||
writeFile' "Model.hs" $(codegen "Model.hs")
|
writeFile' "Model.hs" $(codegen "Model.hs")
|
||||||
writeFile' "Settings.hs" $(codegen "Settings.hs")
|
writeFile' "Settings.hs" $(codegen "Settings.hs")
|
||||||
writeFile' "Settings/StaticFiles.hs" $(codegen "Settings/StaticFiles.hs")
|
writeFile' "Settings/StaticFiles.hs" $(codegen "Settings/StaticFiles.hs")
|
||||||
|
writeFile' "Settings/Development.hs" $(codegen "Settings/Development.hs")
|
||||||
writeFile' "static/css/bootstrap.css"
|
writeFile' "static/css/bootstrap.css"
|
||||||
$(codegen "static/css/bootstrap.css")
|
$(codegen "static/css/bootstrap.css")
|
||||||
writeFile' "templates/default-layout.hamlet"
|
writeFile' "templates/default-layout.hamlet"
|
||||||
|
|||||||
@ -11,13 +11,8 @@ import Yesod.Auth
|
|||||||
import Yesod.Default.Config
|
import Yesod.Default.Config
|
||||||
import Yesod.Default.Main
|
import Yesod.Default.Main
|
||||||
import Yesod.Default.Handlers
|
import Yesod.Default.Handlers
|
||||||
#if DEVELOPMENT
|
|
||||||
import Yesod.Logger (Logger, logBS)
|
|
||||||
import Network.Wai.Middleware.RequestLogger (logCallbackDev)
|
|
||||||
#else
|
|
||||||
import Yesod.Logger (Logger, logBS, toProduction)
|
import Yesod.Logger (Logger, logBS, toProduction)
|
||||||
import Network.Wai.Middleware.RequestLogger (logCallback)
|
import Network.Wai.Middleware.RequestLogger (logCallback, logCallbackDev)
|
||||||
#endif
|
|
||||||
import qualified Database.Persist.Store~importMigration~
|
import qualified Database.Persist.Store~importMigration~
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
import Network.HTTP.Conduit (newManager, def)
|
||||||
|
|
||||||
@ -40,13 +35,9 @@ makeApplication conf logger = do
|
|||||||
app <- toWaiAppPlain foundation
|
app <- toWaiAppPlain foundation
|
||||||
return $ logWare app
|
return $ logWare app
|
||||||
where
|
where
|
||||||
#ifdef DEVELOPMENT
|
setLogger = if development then logger else toProduction logger
|
||||||
logWare = logCallbackDev (logBS setLogger)
|
logWare = if development then logCallbackDev (logBS setLogger)
|
||||||
setLogger = logger
|
else logCallback (logBS setLogger)
|
||||||
#else
|
|
||||||
setLogger = toProduction logger -- by default the logger is set for development
|
|
||||||
logWare = logCallback (logBS setLogger)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
makeFoundation :: AppConfig DefaultEnv Extra -> Logger -> IO ~sitearg~
|
makeFoundation :: AppConfig DefaultEnv Extra -> Logger -> IO ~sitearg~
|
||||||
makeFoundation conf setLogger = do
|
makeFoundation conf setLogger = do
|
||||||
|
|||||||
@ -3,6 +3,7 @@ module Import
|
|||||||
, module Yesod
|
, module Yesod
|
||||||
, module Foundation
|
, module Foundation
|
||||||
, module Settings.StaticFiles
|
, module Settings.StaticFiles
|
||||||
|
, module Settings.Development
|
||||||
, module Data.Monoid
|
, module Data.Monoid
|
||||||
, module Control.Applicative
|
, module Control.Applicative
|
||||||
, Text
|
, Text
|
||||||
@ -18,6 +19,7 @@ import Data.Monoid (Monoid (mappend, mempty, mconcat))
|
|||||||
import Control.Applicative ((<$>), (<*>), pure)
|
import Control.Applicative ((<$>), (<*>), pure)
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Settings.StaticFiles
|
import Settings.StaticFiles
|
||||||
|
import Settings.Development
|
||||||
|
|
||||||
#if __GLASGOW_HASKELL__ < 704
|
#if __GLASGOW_HASKELL__ < 704
|
||||||
infixr 5 <>
|
infixr 5 <>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import qualified Yesod.Default.Util
|
|||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Data.Yaml
|
import Data.Yaml
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
import Settings.Development
|
||||||
|
|
||||||
-- | Which Persistent backend this site is using.
|
-- | Which Persistent backend this site is using.
|
||||||
type PersistConfig = ~configPersist~
|
type PersistConfig = ~configPersist~
|
||||||
@ -53,11 +54,8 @@ staticRoot conf = [st|#{appRoot conf}/static|]
|
|||||||
-- user.
|
-- user.
|
||||||
|
|
||||||
widgetFile :: String -> Q Exp
|
widgetFile :: String -> Q Exp
|
||||||
#if DEVELOPMENT
|
widgetFile = if development then Yesod.Default.Util.widgetFileReload
|
||||||
widgetFile = Yesod.Default.Util.widgetFileReload
|
else Yesod.Default.Util.widgetFileNoReload
|
||||||
#else
|
|
||||||
widgetFile = Yesod.Default.Util.widgetFileNoReload
|
|
||||||
#endif
|
|
||||||
|
|
||||||
data Extra = Extra
|
data Extra = Extra
|
||||||
{ extraCopyright :: Text
|
{ extraCopyright :: Text
|
||||||
|
|||||||
14
yesod/scaffold/Settings/Development.hs.cg
Normal file
14
yesod/scaffold/Settings/Development.hs.cg
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module Settings.Development where
|
||||||
|
|
||||||
|
import Prelude
|
||||||
|
|
||||||
|
development :: Bool
|
||||||
|
development =
|
||||||
|
#if DEVELOPMENT
|
||||||
|
True
|
||||||
|
#else
|
||||||
|
False
|
||||||
|
#endif
|
||||||
|
|
||||||
|
production :: Bool
|
||||||
|
production = not development
|
||||||
@ -4,15 +4,12 @@ import Prelude (IO)
|
|||||||
import Yesod.Static
|
import Yesod.Static
|
||||||
import qualified Yesod.Static as Static
|
import qualified Yesod.Static as Static
|
||||||
import Settings (staticDir)
|
import Settings (staticDir)
|
||||||
|
import Settings.Development
|
||||||
|
|
||||||
-- | use this to create your static file serving site
|
-- | use this to create your static file serving site
|
||||||
staticSite :: IO Static.Static
|
staticSite :: IO Static.Static
|
||||||
staticSite =
|
staticSite = if development then Static.staticDevel staticDir
|
||||||
#ifdef DEVELOPMENT
|
else Static.static staticDir
|
||||||
Static.staticDevel staticDir
|
|
||||||
#else
|
|
||||||
Static.static staticDir
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-- | This generates easy references to files in the static directory at compile time,
|
-- | This generates easy references to files in the static directory at compile time,
|
||||||
-- giving you compile-time verification that referenced files exist.
|
-- giving you compile-time verification that referenced files exist.
|
||||||
|
|||||||
@ -27,6 +27,7 @@ library
|
|||||||
Model
|
Model
|
||||||
Settings
|
Settings
|
||||||
Settings.StaticFiles
|
Settings.StaticFiles
|
||||||
|
Settings.Development
|
||||||
Handler.Home
|
Handler.Home
|
||||||
|
|
||||||
if flag(dev) || flag(library-only)
|
if flag(dev) || flag(library-only)
|
||||||
|
|||||||
@ -32,6 +32,7 @@ extra-source-files:
|
|||||||
scaffold/tests/main.hs.cg
|
scaffold/tests/main.hs.cg
|
||||||
scaffold/tests/HomeTest.hs.cg
|
scaffold/tests/HomeTest.hs.cg
|
||||||
scaffold/Settings.hs.cg
|
scaffold/Settings.hs.cg
|
||||||
|
scaffold/Settings/Development.hs.cg
|
||||||
scaffold/Settings/StaticFiles.hs.cg
|
scaffold/Settings/StaticFiles.hs.cg
|
||||||
scaffold/Application.hs.cg
|
scaffold/Application.hs.cg
|
||||||
scaffold/deploy/Procfile.cg
|
scaffold/deploy/Procfile.cg
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user