remove old TODO

This commit is contained in:
Greg Weber 2011-12-25 22:27:57 -03:00
parent 630124149a
commit 00cf9f2953
8 changed files with 23 additions and 23 deletions

View File

@ -60,9 +60,6 @@ defaultMain load withSite = do
-- > Settings.withConnectionPool conf $ \p -> do -- > Settings.withConnectionPool conf $ \p -> do
-- > runConnectionPool (runMigration yourMigration) p -- > runConnectionPool (runMigration yourMigration) p
-- > defaultRunner f $ YourSite conf logger p -- > defaultRunner f $ YourSite conf logger p
--
-- TODO: ifdef WINDOWS
--
defaultRunner :: (YesodDispatch y y, Yesod y) defaultRunner :: (YesodDispatch y y, Yesod y)
=> (Application -> IO a) => (Application -> IO a)
-> y -- ^ your foundation type -> y -- ^ your foundation type

View File

@ -6,7 +6,7 @@ module Application
import Import import Import
import Settings import Settings
import Yesod.Static import Settings.StaticFiles (staticSite)
import Yesod.Auth import Yesod.Auth
import Yesod.Default.Config import Yesod.Default.Config
import Yesod.Default.Main import Yesod.Default.Main
@ -29,11 +29,7 @@ mkYesodDispatch "~sitearg~" resources~sitearg~
-- migrations handled by Yesod. -- migrations handled by Yesod.
with~sitearg~ :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO () with~sitearg~ :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO ()
with~sitearg~ conf logger f = do with~sitearg~ conf logger f = do
#ifdef DEVELOPMENT s <- staticSite
s <- staticDevel Settings.staticDir
#else
s <- static Settings.staticDir
#endif
dbconf <- withYamlEnvironment "config/~dbConfigFile~.yml" (appEnv conf) dbconf <- withYamlEnvironment "config/~dbConfigFile~.yml" (appEnv conf)
$ either error return . Database.Persist.Base.loadConfig $ either error return . Database.Persist.Base.loadConfig
Database.Persist.Base.withPool (dbconf :: Settings.PersistConfig) $ \p -> do~runMigration~ Database.Persist.Base.withPool (dbconf :: Settings.PersistConfig) $ \p -> do~runMigration~

View File

@ -1,10 +1,21 @@
module Settings.StaticFiles where module Settings.StaticFiles where
import Yesod.Static (staticFiles, StaticRoute (StaticRoute)) import Yesod.Static (staticFiles, StaticRoute (StaticRoute))
import qualified Yesod.Static as Static
import Settings (staticDir)
-- | This generates easy references to files in the static directory at compile time. -- | use this to create your static file serving site
-- The upside to this is that you have compile-time verification that referenced files staticSite :: IO Static
-- exist. However, any files added to your static directory during run-time can't be staticSite =
#ifdef DEVELOPMENT
Static.staticDevel staticDir
#else
Static.static staticDir
#endif
-- | This generates easy references to files in the static directory at compile time,
-- giving you compile-time verification that referenced files exist.
-- Warning: any files added to your static directory during run-time can't be
-- accessed this way. You'll have to use their FilePath or URL to access them. -- accessed this way. You'll have to use their FilePath or URL to access them.
$(staticFiles "static") $(staticFiles Settings.staticDir)

View File

@ -9,7 +9,7 @@ Default: &defaults
Development: Development:
<<: *defaults <<: *defaults
Testing: Test:
database: ~project~_test database: ~project~_test
<<: *defaults <<: *defaults

View File

@ -9,7 +9,7 @@ Default: &defaults
Development: Development:
<<: *defaults <<: *defaults
Testing: Test:
database: ~project~_test database: ~project~_test
<<: *defaults <<: *defaults

View File

@ -5,7 +5,7 @@ Default: &defaults
Development: Development:
<<: *defaults <<: *defaults
Testing: Test:
<<: *defaults <<: *defaults
Staging: Staging:

View File

@ -5,7 +5,7 @@ Default: &defaults
Development: Development:
<<: *defaults <<: *defaults
Testing: Test:
database: ~project~_test.sqlite3 database: ~project~_test.sqlite3
<<: *defaults <<: *defaults

View File

@ -6,7 +6,7 @@ module Application
import Import import Import
import Settings import Settings
import Yesod.Static import Settings.StaticFiles (staticSite)
import Yesod.Default.Config import Yesod.Default.Config
import Yesod.Default.Main (defaultDevelApp, defaultRunner) import Yesod.Default.Main (defaultDevelApp, defaultRunner)
import Yesod.Default.Handlers (getFaviconR, getRobotsR) import Yesod.Default.Handlers (getFaviconR, getRobotsR)
@ -28,11 +28,7 @@ mkYesodDispatch "~sitearg~" resources~sitearg~
-- migrations handled by Yesod. -- migrations handled by Yesod.
with~sitearg~ :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO () with~sitearg~ :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO ()
with~sitearg~ conf logger f = do with~sitearg~ conf logger f = do
#ifdef DEVELOPMENT s <- staticSite
s <- staticDevel Settings.staticDir
#else
s <- static Settings.staticDir
#endif
let h = ~sitearg~ conf logger s let h = ~sitearg~ conf logger s
defaultRunner f h defaultRunner f h