configure and build, using command line
This commit is contained in:
parent
ea51828143
commit
c9eaf84694
@ -1,7 +1,6 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Scaffold.Build
|
||||
( build
|
||||
, touch
|
||||
( touch
|
||||
, getDeps
|
||||
, touchDeps
|
||||
, findHaskellFiles
|
||||
|
||||
@ -43,8 +43,10 @@ swapApp i f = do
|
||||
I.readIORef i >>= killThread
|
||||
f >>= I.writeIORef i
|
||||
|
||||
devel :: IO ()
|
||||
devel = do
|
||||
devel :: ([String] -> IO ()) -- ^ configure command
|
||||
-> ([String] -> IO ()) -- ^ build command
|
||||
-> IO ()
|
||||
devel conf build = do
|
||||
e <- doesFileExist "dist/devel-flag"
|
||||
when e $ removeFile "dist/devel-flag"
|
||||
listenThread <- forkIO (appMessage "Initializing, please wait") >>= I.newIORef
|
||||
|
||||
19
scaffold.hs
19
scaffold.hs
@ -13,9 +13,11 @@ import qualified Data.Text.Lazy.Encoding as LT
|
||||
import Control.Monad (when, unless)
|
||||
import System.Environment (getArgs)
|
||||
|
||||
import Scaffold.Build (build, touch)
|
||||
import Scaffold.Build (touch)
|
||||
import Scaffold.Devel (devel)
|
||||
|
||||
import System.Process (rawSystem)
|
||||
|
||||
qq :: String
|
||||
#if __GLASGOW_HASKELL__ >= 700
|
||||
qq = ""
|
||||
@ -34,16 +36,25 @@ prompt f = do
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
args <- getArgs
|
||||
args' <- getArgs
|
||||
let (isDev, args) =
|
||||
case args' of
|
||||
"--dev":rest -> (True, rest)
|
||||
_ -> (False, args')
|
||||
let cmd = if isDev then "cabal-dev" else "cabal"
|
||||
let conf rest = rawSystem cmd ("configure":rest) >> return ()
|
||||
let build rest = rawSystem cmd ("build":rest) >> return ()
|
||||
case args of
|
||||
["init"] -> scaffold
|
||||
["build"] -> build
|
||||
"build":rest -> touch >> build rest
|
||||
["touch"] -> touch
|
||||
["devel"] -> devel
|
||||
["devel"] -> devel conf build
|
||||
"configure":rest -> conf rest
|
||||
_ -> 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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user