Merge pull request #82 from maxcan/master

touch command as discussed
This commit is contained in:
Michael Snoyman 2011-06-30 05:49:34 -07:00
commit c931fb0afd
2 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Scaffold.Build module Scaffold.Build
( build ( build
, touch
, getDeps , getDeps
, touchDeps , touchDeps
, findHaskellFiles , findHaskellFiles
@ -27,6 +28,14 @@ import Data.Text (unpack)
import Control.Monad (filterM) import Control.Monad (filterM)
import Control.Exception (SomeException, try) import Control.Exception (SomeException, try)
-- | Touch any files with altered dependencies but do not build
touch :: IO ()
touch = do
hss <- findHaskellFiles "."
deps' <- mapM determineHamletDeps hss
let deps = fixDeps $ zip hss deps'
touchDeps deps
build :: IO () build :: IO ()
build = do build = do
{- {-

View File

@ -13,7 +13,7 @@ import qualified Data.Text.Lazy.Encoding as LT
import Control.Monad (when, unless) import Control.Monad (when, unless)
import System.Environment (getArgs) import System.Environment (getArgs)
import Scaffold.Build (build) import Scaffold.Build (build, touch)
import Scaffold.Devel (devel) import Scaffold.Devel (devel)
qq :: String qq :: String
@ -38,12 +38,14 @@ main = do
case args of case args of
["init"] -> scaffold ["init"] -> scaffold
["build"] -> build ["build"] -> build
["touch"] -> touch
["devel"] -> devel ["devel"] -> devel
_ -> do _ -> do
putStrLn "Usage: yesod <command>" putStrLn "Usage: yesod <command>"
putStrLn "Available commands:" putStrLn "Available commands:"
putStrLn " init Scaffold a new site" putStrLn " init Scaffold a new site"
putStrLn " build Build project (performs TH dependency analysis)" 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 " devel Run project with the devel server"
puts :: String -> IO () puts :: String -> IO ()