Improved scaffolded cabal file
This commit is contained in:
parent
f99fe1983f
commit
a4052b2784
@ -5,7 +5,6 @@ module Scaffolding.Scaffolder (scaffold) where
|
|||||||
import Scaffolding.CodeGen
|
import Scaffolding.CodeGen
|
||||||
|
|
||||||
import Language.Haskell.TH.Syntax
|
import Language.Haskell.TH.Syntax
|
||||||
import Control.Monad (when)
|
|
||||||
import qualified Data.Text.Lazy as LT
|
import qualified Data.Text.Lazy as LT
|
||||||
import qualified Data.Text.Lazy.Encoding as LT
|
import qualified Data.Text.Lazy.Encoding as LT
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
@ -73,9 +72,6 @@ scaffold = do
|
|||||||
backendLower = uncapitalize $ show backend
|
backendLower = uncapitalize $ show backend
|
||||||
upper = show backend
|
upper = show backend
|
||||||
|
|
||||||
let useTests = True
|
|
||||||
let testsDep = if useTests then ", yesod-test" else ""
|
|
||||||
|
|
||||||
let runMigration =
|
let runMigration =
|
||||||
case backend of
|
case backend of
|
||||||
MongoDB -> ""
|
MongoDB -> ""
|
||||||
@ -149,8 +145,6 @@ scaffold = do
|
|||||||
writeFile' "main.hs" $(codegen "main.hs")
|
writeFile' "main.hs" $(codegen "main.hs")
|
||||||
writeFile' "devel.hs" $(codegen "devel.hs")
|
writeFile' "devel.hs" $(codegen "devel.hs")
|
||||||
writeFile' (project ++ ".cabal") $(codegen "project.cabal")
|
writeFile' (project ++ ".cabal") $(codegen "project.cabal")
|
||||||
when useTests $
|
|
||||||
appendFile' (project ++ ".cabal") $(codegen "cabal_test_suite")
|
|
||||||
|
|
||||||
writeFile' ".ghci" $(codegen ".ghci")
|
writeFile' ".ghci" $(codegen ".ghci")
|
||||||
writeFile' "LICENSE" $(codegen "LICENSE")
|
writeFile' "LICENSE" $(codegen "LICENSE")
|
||||||
@ -179,10 +173,9 @@ scaffold = do
|
|||||||
writeFile' "config/models" $(codegen "config/models")
|
writeFile' "config/models" $(codegen "config/models")
|
||||||
writeFile' "messages/en.msg" $(codegen "messages/en.msg")
|
writeFile' "messages/en.msg" $(codegen "messages/en.msg")
|
||||||
|
|
||||||
when useTests $ do
|
mkDir "tests"
|
||||||
mkDir "tests"
|
writeFile' "tests/main.hs" $(codegen "tests/main.hs")
|
||||||
writeFile' "tests/main.hs" $(codegen "tests/main.hs")
|
writeFile' "tests/HomeTest.hs" $(codegen "tests/HomeTest.hs")
|
||||||
writeFile' "tests/HomeTest.hs" $(codegen "tests/HomeTest.hs")
|
|
||||||
|
|
||||||
S.writeFile (dir ++ "/config/favicon.ico")
|
S.writeFile (dir ++ "/config/favicon.ico")
|
||||||
$(runIO (S.readFile "scaffold/config/favicon.ico.cg") >>= \bs -> do
|
$(runIO (S.readFile "scaffold/config/favicon.ico.cg") >>= \bs -> do
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
test-suite integration-tests
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: main.hs
|
|
||||||
hs-source-dirs: tests .
|
|
||||||
ghc-options: -Wall
|
|
||||||
extensions: TemplateHaskell
|
|
||||||
QuasiQuotes
|
|
||||||
OverloadedStrings
|
|
||||||
NoImplicitPrelude
|
|
||||||
CPP
|
|
||||||
OverloadedStrings
|
|
||||||
MultiParamTypeClasses
|
|
||||||
TypeFamilies
|
|
||||||
GADTs
|
|
||||||
GeneralizedNewtypeDeriving
|
|
||||||
FlexibleContexts
|
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
|
||||||
, yesod-test
|
|
||||||
@ -8,7 +8,7 @@ synopsis: The greatest Yesod web application ever.
|
|||||||
description: I'm sure you can say something clever here if you try.
|
description: I'm sure you can say something clever here if you try.
|
||||||
category: Web
|
category: Web
|
||||||
stability: Experimental
|
stability: Experimental
|
||||||
cabal-version: >= 1.6
|
cabal-version: >= 1.8
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
homepage: http://~project~.yesodweb.com/
|
homepage: http://~project~.yesodweb.com/
|
||||||
|
|
||||||
@ -21,53 +21,25 @@ Flag library-only
|
|||||||
Default: False
|
Default: False
|
||||||
|
|
||||||
library
|
library
|
||||||
if flag(library-only)
|
|
||||||
Buildable: True
|
|
||||||
else
|
|
||||||
Buildable: False
|
|
||||||
|
|
||||||
exposed-modules: Application
|
exposed-modules: Application
|
||||||
other-modules: Foundation
|
Foundation
|
||||||
Import
|
Import
|
||||||
Model
|
Model
|
||||||
Settings
|
Settings
|
||||||
Settings.StaticFiles
|
Settings.StaticFiles
|
||||||
Handler.Home
|
Handler.Home
|
||||||
|
|
||||||
ghc-options: -Wall -threaded -O0
|
if flag(dev) || flag(library-only)
|
||||||
cpp-options: -DDEVELOPMENT
|
|
||||||
|
|
||||||
extensions: TemplateHaskell
|
|
||||||
QuasiQuotes
|
|
||||||
OverloadedStrings
|
|
||||||
NoImplicitPrelude
|
|
||||||
CPP
|
|
||||||
MultiParamTypeClasses
|
|
||||||
TypeFamilies
|
|
||||||
GADTs
|
|
||||||
GeneralizedNewtypeDeriving
|
|
||||||
FlexibleContexts
|
|
||||||
EmptyDataDecls
|
|
||||||
NoMonomorphismRestriction
|
|
||||||
|
|
||||||
executable ~project~
|
|
||||||
if flag(library-only)
|
|
||||||
Buildable: False
|
|
||||||
|
|
||||||
if flag(dev)
|
|
||||||
cpp-options: -DDEVELOPMENT
|
cpp-options: -DDEVELOPMENT
|
||||||
ghc-options: -Wall -threaded -O0
|
ghc-options: -Wall -threaded -O0
|
||||||
else
|
else
|
||||||
ghc-options: -Wall -threaded -O2
|
ghc-options: -Wall -threaded -O2
|
||||||
|
|
||||||
main-is: main.hs
|
|
||||||
|
|
||||||
extensions: TemplateHaskell
|
extensions: TemplateHaskell
|
||||||
QuasiQuotes
|
QuasiQuotes
|
||||||
OverloadedStrings
|
OverloadedStrings
|
||||||
NoImplicitPrelude
|
NoImplicitPrelude
|
||||||
CPP
|
CPP
|
||||||
OverloadedStrings
|
|
||||||
MultiParamTypeClasses
|
MultiParamTypeClasses
|
||||||
TypeFamilies
|
TypeFamilies
|
||||||
GADTs
|
GADTs
|
||||||
@ -103,4 +75,35 @@ executable ~project~
|
|||||||
, directory >= 1.1 && < 1.2
|
, directory >= 1.1 && < 1.2
|
||||||
, warp >= 1.2 && < 1.3
|
, warp >= 1.2 && < 1.3
|
||||||
|
|
||||||
~testsDep~
|
executable ~project~
|
||||||
|
if flag(library-only)
|
||||||
|
Buildable: False
|
||||||
|
|
||||||
|
main-is: ../main.hs
|
||||||
|
hs-source-dirs: dist
|
||||||
|
build-depends: base
|
||||||
|
, ~project~
|
||||||
|
, yesod-default
|
||||||
|
|
||||||
|
test-suite test
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: main.hs
|
||||||
|
hs-source-dirs: tests
|
||||||
|
ghc-options: -Wall
|
||||||
|
extensions: TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
OverloadedStrings
|
||||||
|
NoImplicitPrelude
|
||||||
|
CPP
|
||||||
|
OverloadedStrings
|
||||||
|
MultiParamTypeClasses
|
||||||
|
TypeFamilies
|
||||||
|
GADTs
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
FlexibleContexts
|
||||||
|
|
||||||
|
build-depends: base
|
||||||
|
, ~project~
|
||||||
|
, yesod-test
|
||||||
|
, yesod-default
|
||||||
|
, yesod-core
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user