re-organize files for case insensitive fs
This commit is contained in:
parent
06bda2877e
commit
822a507f28
@ -1,5 +1,5 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
module Scaffold.Build
|
module Build
|
||||||
( touch
|
( touch
|
||||||
, getDeps
|
, getDeps
|
||||||
, touchDeps
|
, touchDeps
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
module Scaffold.Devel
|
module Devel
|
||||||
( devel
|
( devel
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ import Distribution.Verbosity (normal)
|
|||||||
import Distribution.PackageDescription.Parse (readPackageDescription, readHookedBuildInfo)
|
import Distribution.PackageDescription.Parse (readPackageDescription, readHookedBuildInfo)
|
||||||
import Distribution.PackageDescription (emptyHookedBuildInfo)
|
import Distribution.PackageDescription (emptyHookedBuildInfo)
|
||||||
-- import Distribution.Simple.LocalBuildInfo (localPkgDescr)
|
-- import Distribution.Simple.LocalBuildInfo (localPkgDescr)
|
||||||
import Scaffold.Build (getDeps, touchDeps, findHaskellFiles)
|
import Build (getDeps, touchDeps, findHaskellFiles)
|
||||||
-- import Network.Wai.Handler.Warp (run)
|
-- import Network.Wai.Handler.Warp (run)
|
||||||
-- import Network.Wai.Middleware.Debug (debug)
|
-- import Network.Wai.Middleware.Debug (debug)
|
||||||
-- import Distribution.Text (display)
|
-- import Distribution.Text (display)
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
-- | A code generation template haskell. Everything is taken as literal text,
|
-- | A code generation template haskell. Everything is taken as literal text,
|
||||||
-- with ~var~ variable interpolation.
|
-- with ~var~ variable interpolation.
|
||||||
module CodeGen (codegen, codegenDir) where
|
module Scaffolding.CodeGen (codegen, codegenDir) where
|
||||||
|
|
||||||
import Language.Haskell.TH.Syntax
|
import Language.Haskell.TH.Syntax
|
||||||
import Text.ParserCombinators.Parsec
|
import Text.ParserCombinators.Parsec
|
||||||
@ -1,31 +1,20 @@
|
|||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
import CodeGen
|
module Scaffolding.Scaffolder (scaffold) where
|
||||||
import System.IO
|
|
||||||
import System.Directory
|
import Scaffolding.CodeGen
|
||||||
import qualified Data.ByteString.Char8 as S
|
|
||||||
import Language.Haskell.TH.Syntax
|
import Language.Haskell.TH.Syntax
|
||||||
import Data.Time (getCurrentTime, utctDay, toGregorian)
|
import Control.Monad (unless)
|
||||||
import Data.Char (toLower)
|
|
||||||
import Control.Applicative ((<$>))
|
|
||||||
import qualified Data.ByteString.Lazy as L
|
|
||||||
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 Control.Monad (unless)
|
import qualified Data.ByteString.Lazy as L
|
||||||
import System.Environment (getArgs)
|
import Control.Applicative ((<$>))
|
||||||
import System.Exit (exitWith)
|
import qualified Data.ByteString.Char8 as S
|
||||||
|
import Data.Time (getCurrentTime, utctDay, toGregorian)
|
||||||
import Scaffold.Build (touch)
|
import Data.Char (toLower)
|
||||||
import Scaffold.Devel (devel)
|
import System.Directory
|
||||||
|
import System.IO
|
||||||
import System.Process (rawSystem)
|
|
||||||
|
|
||||||
qq :: String
|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
|
||||||
qq = ""
|
|
||||||
#else
|
|
||||||
qq = "$"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
prompt :: (String -> Bool) -> IO String
|
prompt :: (String -> Bool) -> IO String
|
||||||
prompt f = do
|
prompt f = do
|
||||||
@ -36,42 +25,23 @@ prompt f = do
|
|||||||
putStrLn "That was not a valid entry, please try again: "
|
putStrLn "That was not a valid entry, please try again: "
|
||||||
prompt f
|
prompt f
|
||||||
|
|
||||||
main :: IO ()
|
qq :: String
|
||||||
main = do
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
args' <- getArgs
|
qq = ""
|
||||||
let (isDev, args) =
|
#else
|
||||||
case args' of
|
qq = "$"
|
||||||
"--dev":rest -> (True, rest)
|
#endif
|
||||||
_ -> (False, args')
|
|
||||||
let cmd = if isDev then "cabal-dev" else "cabal"
|
|
||||||
let cabal rest = rawSystem cmd rest >> return ()
|
|
||||||
let build rest = rawSystem cmd $ "build":rest
|
|
||||||
case args of
|
|
||||||
["init"] -> scaffold
|
|
||||||
"build":rest -> touch >> build rest >>= exitWith
|
|
||||||
["touch"] -> touch
|
|
||||||
["devel"] -> devel cabal
|
|
||||||
["version"] -> putStrLn "0.9"
|
|
||||||
"configure":rest -> rawSystem cmd ("configure":rest) >>= exitWith
|
|
||||||
_ -> do
|
|
||||||
putStrLn "Usage: yesod <command>"
|
|
||||||
putStrLn "Available commands:"
|
|
||||||
putStrLn " init Scaffold a new site"
|
|
||||||
putStrLn " configure Configure a project for building"
|
|
||||||
putStrLn " build Build project (performs TH dependency analysis)"
|
|
||||||
putStrLn " touch Touch any files with altered TH dependencies but do not build"
|
|
||||||
putStrLn " devel Run project with the devel server"
|
|
||||||
putStrLn " version Print the version of Yesod"
|
|
||||||
|
|
||||||
puts :: String -> IO ()
|
|
||||||
puts s = putStr s >> hFlush stdout
|
|
||||||
|
|
||||||
data Backend = Sqlite | Postgresql | MongoDB | Tiny
|
data Backend = Sqlite | Postgresql | MongoDB | Tiny
|
||||||
deriving (Eq, Read, Show, Enum, Bounded)
|
deriving (Eq, Read, Show, Enum, Bounded)
|
||||||
|
|
||||||
|
puts :: String -> IO ()
|
||||||
|
puts s = putStr s >> hFlush stdout
|
||||||
|
|
||||||
backends :: [Backend]
|
backends :: [Backend]
|
||||||
backends = [minBound .. maxBound]
|
backends = [minBound .. maxBound]
|
||||||
|
|
||||||
|
|
||||||
scaffold :: IO ()
|
scaffold :: IO ()
|
||||||
scaffold = do
|
scaffold = do
|
||||||
puts $(codegenDir "input" "welcome")
|
puts $(codegenDir "input" "welcome")
|
||||||
35
yesod/main.hs
Normal file
35
yesod/main.hs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import Scaffolding.Scaffolder
|
||||||
|
import System.Environment (getArgs)
|
||||||
|
import System.Exit (exitWith)
|
||||||
|
|
||||||
|
import Build (touch)
|
||||||
|
import Devel (devel)
|
||||||
|
|
||||||
|
import System.Process (rawSystem)
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
args' <- getArgs
|
||||||
|
let (isDev, args) =
|
||||||
|
case args' of
|
||||||
|
"--dev":rest -> (True, rest)
|
||||||
|
_ -> (False, args')
|
||||||
|
let cmd = if isDev then "cabal-dev" else "cabal"
|
||||||
|
let cabal rest = rawSystem cmd rest >> return ()
|
||||||
|
let build rest = rawSystem cmd $ "build":rest
|
||||||
|
case args of
|
||||||
|
["init"] -> scaffold
|
||||||
|
"build":rest -> touch >> build rest >>= exitWith
|
||||||
|
["touch"] -> touch
|
||||||
|
["devel"] -> devel cabal
|
||||||
|
["version"] -> putStrLn "0.9"
|
||||||
|
"configure":rest -> rawSystem cmd ("configure":rest) >>= exitWith
|
||||||
|
_ -> do
|
||||||
|
putStrLn "Usage: yesod <command>"
|
||||||
|
putStrLn "Available commands:"
|
||||||
|
putStrLn " init Scaffold a new site"
|
||||||
|
putStrLn " configure Configure a project for building"
|
||||||
|
putStrLn " build Build project (performs TH dependency analysis)"
|
||||||
|
putStrLn " touch Touch any files with altered TH dependencies but do not build"
|
||||||
|
putStrLn " devel Run project with the devel server"
|
||||||
|
putStrLn " version Print the version of Yesod"
|
||||||
@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
|
|
||||||
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
|
rm -rf foobar && runghc main.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# Important! run with test/run.sh
|
# Important! run with test/run.sh
|
||||||
|
|
||||||
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
|
rm -rf foobar && runghc main.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
|
||||||
<<<
|
<<<
|
||||||
Michael
|
Michael
|
||||||
foobar
|
foobar
|
||||||
@ -10,7 +10,7 @@ t
|
|||||||
>>> /.*Registering foobar-0.0.0.*/
|
>>> /.*Registering foobar-0.0.0.*/
|
||||||
>>>= 0
|
>>>= 0
|
||||||
|
|
||||||
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
|
rm -rf foobar && runghc main.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
|
||||||
<<<
|
<<<
|
||||||
Michael
|
Michael
|
||||||
foobar
|
foobar
|
||||||
@ -20,7 +20,7 @@ s
|
|||||||
>>> /.*Registering foobar-0.0.0.*/
|
>>> /.*Registering foobar-0.0.0.*/
|
||||||
>>>= 0
|
>>>= 0
|
||||||
|
|
||||||
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd .. && rm -rf foobar
|
rm -rf foobar && runghc main.hs init && cd foobar && cabal install && cabal install -fdevel && cd .. && rm -rf foobar
|
||||||
<<<
|
<<<
|
||||||
Michael
|
Michael
|
||||||
foobar
|
foobar
|
||||||
|
|||||||
@ -99,10 +99,11 @@ executable yesod
|
|||||||
, blaze-builder >= 0.2 && < 0.4
|
, blaze-builder >= 0.2 && < 0.4
|
||||||
, process
|
, process
|
||||||
ghc-options: -Wall -threaded
|
ghc-options: -Wall -threaded
|
||||||
main-is: scaffold.hs
|
main-is: main.hs
|
||||||
other-modules: CodeGen
|
other-modules: Scaffolding.CodeGen
|
||||||
Scaffold.Build
|
Scaffolding.Scaffolder
|
||||||
Scaffold.Devel
|
Devel
|
||||||
|
Build
|
||||||
|
|
||||||
source-repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user