Get building on nightly with ghc 8

This commit is contained in:
Michael Xavier 2017-02-08 18:34:51 -08:00
parent 6edd459223
commit 399463f8c5
11 changed files with 65 additions and 37 deletions

View File

@ -47,8 +47,7 @@ matrix:
- hvr-ghc
packages:
- ghc-head
allow_failures:
- env: GHCVER=head RESOLVER=nightly EXTRADEPS="" STACKARGS=""
- env: GHCVER=head RESOLVER=nightly EXTRADEPS="" STACKARGS="--stack-yaml=stack_nightly.yaml"
before_install:
# Download and unpack the stack executable

View File

@ -126,7 +126,7 @@ getApplicationDev = do
return (wsettings, app)
getAppSettings :: IO AppSettings
getAppSettings = loadAppSettings [configSettingsYml] [] useEnv
getAppSettings = loadYamlSettings [configSettingsYml] [] useEnv
-- | main function for use by yesod devel
develMain :: IO ()
@ -136,7 +136,7 @@ develMain = develMainHelper getApplicationDev
appMain :: IO ()
appMain = do
-- Get the settings from all relevant sources
settings <- loadAppSettingsArgs
settings <- loadYamlSettingsArgs
-- fall back to compile-time values, set to [] to require values at runtime
[configSettingsYmlValue]

View File

@ -6,7 +6,7 @@ import Text.Hamlet (hamletFile)
import Text.Jasmine (minifym)
import Web.ServerSession.Backend.Persistent
import Web.ServerSession.Frontend.Yesod
import Yesod.Auth.BrowserId (authBrowserId)
import Yesod.Auth.Dummy (authDummy)
import Yesod.Default.Util (addStaticContentExternal)
import Yesod.Core.Types (Logger)
import qualified Yesod.Core.Unsafe as Unsafe
@ -140,7 +140,7 @@ instance YesodAuth App where
}
-- You can add other plugins like BrowserID, email or OAuth here
authPlugins _ = [authBrowserId def]
authPlugins _ = [authDummy]
authHttpManager = getHttpManager

View File

@ -24,12 +24,12 @@ getHomeR = do
-- | Invalidate the session as requested via 'forceForm'.
postForceR :: Handler ()
postForceR =
processForm "Force form" forceForm $ \force -> do
processForm "Force form" forceForm $ \frce -> do
msid <- getSessionId
SS.forceInvalidate force
SS.forceInvalidate frce
return $ concat
[ "Forced session invalidation using "
, show force
, show frce
, " [old session ID was "
, show msid
, "]." ]

View File

@ -6,7 +6,7 @@
module Settings where
import ClassyPrelude.Yesod
import Control.Exception (throw)
import Control.Exception as E
import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
(.:?))
import Data.FileEmbed (embedFile)
@ -108,7 +108,7 @@ configSettingsYmlBS = $(embedFile configSettingsYml)
-- | @config/settings.yml@, parsed to a @Value@.
configSettingsYmlValue :: Value
configSettingsYmlValue = either throw id $ decodeEither' configSettingsYmlBS
configSettingsYmlValue = either E.throw id $ decodeEither' configSettingsYmlBS
-- | A version of @AppSettings@ parsed at compile time from @config/settings.yml@.
compileTimeAppSettings :: AppSettings

View File

@ -3,15 +3,15 @@ module Handler.CommonSpec (spec) where
import TestImport
spec :: Spec
spec = withApp $ do
describe "robots.txt" $ do
it "gives a 200" $ do
get RobotsR
statusIs 200
it "has correct User-agent" $ do
get RobotsR
bodyContains "User-agent: *"
describe "favicon.ico" $ do
it "gives a 200" $ do
get FaviconR
statusIs 200
spec = yesodSpecWithSiteGenerator mkApp $ do
ydescribe "robots.txt" $ do
yit "gives a 200" $ do
get RobotsR
statusIs 200
yit "has correct User-agent" $ do
get RobotsR
bodyContains "User-agent: *"
ydescribe "favicon.ico" $ do
yit "gives a 200" $ do
get FaviconR
statusIs 200

View File

@ -3,7 +3,7 @@ module Handler.HomeSpec (spec) where
import TestImport
spec :: Spec
spec = withApp $ do
spec = yesodSpecWithSiteGenerator mkApp $ do
return ()
{-
it "loads the index and checks it looks right" $ do

View File

@ -5,12 +5,12 @@ module TestImport
import Application (makeFoundation)
import ClassyPrelude as X
import Database.Persist as X hiding (get)
import Database.Persist as X hiding (delete, deleteBy, get)
import Database.Persist.Sql (SqlPersistM, SqlBackend, runSqlPersistMPool, rawExecute, rawSql, unSingle, connEscapeName)
import Foundation as X
import Foundation as X hiding (Handler)
import Model as X
import Test.Hspec as X
import Yesod.Default.Config2 (ignoreEnv, loadAppSettings)
import Yesod.Default.Config2 (ignoreEnv, loadYamlSettings)
import Yesod.Test as X
-- Wiping the database
@ -25,9 +25,9 @@ runDB query = do
pool <- fmap appConnPool getTestYesod
liftIO $ runSqlPersistMPool query pool
withApp :: SpecWith App -> Spec
withApp = before $ do
settings <- loadAppSettings
mkApp :: IO App
mkApp = do
settings <- loadYamlSettings
["config/test-settings.yml", "config/settings.yml"]
[]
ignoreEnv
@ -48,8 +48,8 @@ wipeDB app = do
-- Aside: SQLite by default *does not enable foreign key checks*
-- (disabling foreign keys is only necessary for those who specifically enable them).
let settings = appSettings app
sqliteConn <- rawConnection (sqlDatabase $ appDatabaseConf settings)
let settings = appSettings app
sqliteConn <- rawConnection (sqlDatabase $ appDatabaseConf settings)
disableForeignKeys sqliteConn
let logFunc = messageLoggerSource app (appLogger app)

View File

@ -26,7 +26,7 @@ library
, bytestring
, cereal >= 0.4
, path-pieces
, persistent >= 2.1 && < 2.3
, persistent >= 2.1
, tagged >= 0.7
, text
, time
@ -71,8 +71,8 @@ test-suite tests
, hspec >= 2.1 && < 3
, monad-logger
, persistent-sqlite >= 2.1 && < 2.3
, persistent-postgresql >= 2.1 && < 2.3
, persistent-sqlite >= 2.1
, persistent-postgresql >= 2.1
, resource-pool
, QuickCheck

View File

@ -25,8 +25,8 @@ library
, bytestring
, nonce
, path-pieces
, snap == 0.14.*
, snap-core == 0.9.*
, snap >= 0.14
, snap-core >= 0.9
, text
, time
, transformers

29
stack_nightly.yaml Normal file
View File

@ -0,0 +1,29 @@
resolver: nightly-2017-02-02
packages:
- serversession
- serversession-backend-acid-state
- serversession-backend-persistent
- serversession-backend-redis
- serversession-frontend-snap
- serversession-frontend-wai
- serversession-frontend-yesod
- examples/serversession-example-yesod-persistent
flags:
serversession:
lib-Werror: true
serversession-backend-acid-state:
lib-Werror: true
serversession-backend-persistent:
lib-Werror: true
serversession-backend-redis:
lib-Werror: true
serversession-frontend-snap:
lib-Werror: true
serversession-frontend-wai:
lib-Werror: true
serversession-frontend-yesod:
lib-Werror: true
extra-deps:
- snap-1.0.0.1
- heist-1.0.1.0
- map-syntax-0.2.0.2