mongoDB works!
This commit is contained in:
parent
cc93924d3f
commit
a9297006f8
@ -81,6 +81,11 @@ scaffold = do
|
||||
backendLower = uncapitalize $ show backend
|
||||
upper = show backend
|
||||
|
||||
let runMigration =
|
||||
case backend of
|
||||
MongoDB -> ""
|
||||
_ -> "\n runConnectionPool (runMigration migrateAll) p"
|
||||
|
||||
putStrLn "That's it! I'm creating your files now..."
|
||||
|
||||
let withConnectionPool = case backend of
|
||||
@ -93,7 +98,7 @@ scaffold = do
|
||||
Postgresql -> "import Data.Text (Text, pack, concat)\nimport Prelude hiding (concat)"
|
||||
_ -> "import Data.Text (Text, pack)"
|
||||
|
||||
packages = if backend == MongoDB then ", mongoDB\n , bson\n" else ""
|
||||
packages = if backend == MongoDB then ", mongoDB >= 1.1\n , bson >= 0.1.5\n" else ""
|
||||
|
||||
let fst3 (x, _, _) = x
|
||||
year <- show . fst3 . toGregorian . utctDay <$> getCurrentTime
|
||||
|
||||
@ -47,8 +47,7 @@ getRobotsR = return $ RepPlain $ toContent ("User-agent: *" :: ByteString)
|
||||
with~sitearg~ :: AppConfig -> Logger -> (Application -> IO a) -> IO ()
|
||||
with~sitearg~ conf logger f = do
|
||||
s <- static Settings.staticDir
|
||||
Settings.withConnectionPool conf $ \p -> do
|
||||
runConnectionPool (runMigration migrateAll) p
|
||||
Settings.withConnectionPool conf $ \p -> do~runMigration~
|
||||
let h = ~sitearg~ conf logger s p
|
||||
#ifdef WINDOWS
|
||||
toWaiApp h >>= f >> return ()
|
||||
|
||||
4
yesod/test/mongodb-input.txt
Normal file
4
yesod/test/mongodb-input.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Michael
|
||||
foobar
|
||||
Foobar
|
||||
m
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash -ex
|
||||
#
|
||||
# A wrapper for the shelltest test. Passes along options to shelltest.
|
||||
#
|
||||
@ -10,14 +10,16 @@ cabal clean && cabal install && cabal sdist
|
||||
# this for loop only operates on 1 file (as per tail -1)
|
||||
for f in $(ls -1rt dist/*.tar.gz | tail -1)
|
||||
do
|
||||
tar -xzvf $f && cd `basename $f .tar.gz` || exit 1
|
||||
tar -xzvf $f && cd `basename $f .tar.gz`
|
||||
|
||||
# shelltest is designed to show you the diff of an expected stdout/stdin. We don't care about that. If it compiles, it compiles
|
||||
# shelltest ../test/scaffold.shelltest --color --diff --all $@ -- --hide-successes
|
||||
|
||||
../test/scaffold.sh < ../test/sqlite-input.txt &&
|
||||
../test/scaffold.sh < ../test/postgresql-input.txt &&
|
||||
../test/scaffold.sh < ../test/tiny-input.txt || (echo "FAILED" && exit 1)
|
||||
../test/scaffold.sh < ../test/tiny-input.txt &&
|
||||
../test/scaffold.sh < ../test/mongodb-input.txt ||
|
||||
(echo "FAILED" && exit 1)
|
||||
cd ..
|
||||
rm -r `basename $f .tar.gz`
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user