mongoDB works!
This commit is contained in:
parent
cc93924d3f
commit
a9297006f8
@ -81,6 +81,11 @@ scaffold = do
|
|||||||
backendLower = uncapitalize $ show backend
|
backendLower = uncapitalize $ show backend
|
||||||
upper = 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..."
|
putStrLn "That's it! I'm creating your files now..."
|
||||||
|
|
||||||
let withConnectionPool = case backend of
|
let withConnectionPool = case backend of
|
||||||
@ -93,7 +98,7 @@ scaffold = do
|
|||||||
Postgresql -> "import Data.Text (Text, pack, concat)\nimport Prelude hiding (concat)"
|
Postgresql -> "import Data.Text (Text, pack, concat)\nimport Prelude hiding (concat)"
|
||||||
_ -> "import Data.Text (Text, pack)"
|
_ -> "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
|
let fst3 (x, _, _) = x
|
||||||
year <- show . fst3 . toGregorian . utctDay <$> getCurrentTime
|
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~ :: AppConfig -> Logger -> (Application -> IO a) -> IO ()
|
||||||
with~sitearg~ conf logger f = do
|
with~sitearg~ conf logger f = do
|
||||||
s <- static Settings.staticDir
|
s <- static Settings.staticDir
|
||||||
Settings.withConnectionPool conf $ \p -> do
|
Settings.withConnectionPool conf $ \p -> do~runMigration~
|
||||||
runConnectionPool (runMigration migrateAll) p
|
|
||||||
let h = ~sitearg~ conf logger s p
|
let h = ~sitearg~ conf logger s p
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
toWaiApp h >>= f >> return ()
|
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.
|
# 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)
|
# this for loop only operates on 1 file (as per tail -1)
|
||||||
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` || 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 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
|
# shelltest ../test/scaffold.shelltest --color --diff --all $@ -- --hide-successes
|
||||||
|
|
||||||
../test/scaffold.sh < ../test/sqlite-input.txt &&
|
../test/scaffold.sh < ../test/sqlite-input.txt &&
|
||||||
../test/scaffold.sh < ../test/postgresql-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 ..
|
cd ..
|
||||||
rm -r `basename $f .tar.gz`
|
rm -r `basename $f .tar.gz`
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user