From 350f0e947c0848cc99c2ef099b3be627c1a024e5 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 16 May 2011 22:04:35 +0300 Subject: [PATCH] Messages files support in yesod build --- Scaffold/Build.hs | 56 +++++++++++++++++++++++----------------- Scaffold/Devel.hs | 1 - scaffold/favicon_ico.cg | Bin 1150 -> 1150 bytes yesod.cabal | 10 +++---- 4 files changed, 38 insertions(+), 29 deletions(-) diff --git a/Scaffold/Build.hs b/Scaffold/Build.hs index 3660fb63..24ea56a3 100644 --- a/Scaffold/Build.hs +++ b/Scaffold/Build.hs @@ -23,6 +23,7 @@ import Data.Monoid (mappend) import qualified Data.Map as Map import qualified Data.Set as Set import System.PosixCompat.Files (accessTime, modificationTime, getFileStatus, setFileTimes) +import Data.Text (unpack) build :: IO () build = do @@ -56,7 +57,7 @@ touchDeps = mapM_ go . Map.toList where go (x, ys) = do - fs <- getFileStatus x + fs <- getFileStatus x -- FIXME ignore exceptions flip mapM_ (Set.toList ys) $ \y -> do fs' <- getFileStatus y if modificationTime fs' < modificationTime fs @@ -88,38 +89,47 @@ findHaskellFiles path = do then return [y] else return [] -data TempType = Hamlet | Cassius | Lucius | Julius | Widget | Verbatim +data TempType = Hamlet | Verbatim | Messages FilePath deriving Show determineHamletDeps :: FilePath -> IO [FilePath] determineHamletDeps x = do - y <- TIO.readFile x + y <- TIO.readFile x -- FIXME catch IO exceptions let z = A.parse (A.many $ (parser <|> (A.anyChar >> return Nothing))) y case z of A.Fail{} -> return [] - A.Done _ r -> return $ mapMaybe go r + A.Done _ r -> return $ concatMap go r where - go (Just (Hamlet, f)) = Just $ "hamlet/" ++ f ++ ".hamlet" - go (Just (Widget, f)) = Just $ "hamlet/" ++ f ++ ".hamlet" - go (Just (Verbatim, f)) = Just f - go _ = Nothing + go (Just (Hamlet, f)) = [f, "hamlet/" ++ f ++ ".hamlet"] + go (Just (Verbatim, f)) = [f] + go (Just (Messages f, _)) = [f] + go Nothing = [] parser = do ty <- (A.string "$(hamletFile " >> return Hamlet) - <|> (A.string "$(cassiusFile " >> return Cassius) - <|> (A.string "$(luciusFile " >> return Lucius) - <|> (A.string "$(juliusFile " >> return Julius) - <|> (A.string "$(widgetFile " >> return Widget) + <|> (A.string "$(ihamletFile " >> return Hamlet) + <|> (A.string "$(whamletFile " >> return Hamlet) + <|> (A.string "$(html " >> return Hamlet) + <|> (A.string "$(widgetFile " >> return Hamlet) <|> (A.string "$(Settings.hamletFile " >> return Hamlet) - <|> (A.string "$(Settings.cassiusFile " >> return Cassius) - <|> (A.string "$(Settings.luciusFile " >> return Lucius) - <|> (A.string "$(Settings.juliusFile " >> return Julius) - <|> (A.string "$(Settings.widgetFile " >> return Widget) + <|> (A.string "$(Settings.widgetFile " >> return Hamlet) <|> (A.string "$(persistFile " >> return Verbatim) <|> (A.string "$(parseRoutesFile " >> return Verbatim) - A.skipWhile isSpace - _ <- A.char '"' - y <- A.many1 $ A.satisfy (/= '"') - _ <- A.char '"' - A.skipWhile isSpace - _ <- A.char ')' - return $ Just (ty, y) + <|> (do + A.string "\nmkMessage \"" + A.skipWhile (/= '"') + A.string "\" \"" + x <- A.many1 $ A.satisfy (/= '"') + A.string "\" \"" + y <- A.many1 $ A.satisfy (/= '"') + A.string "\"" + return $ Messages $ concat [x, "/", y, ".msg"]) + case ty of + Messages{} -> return $ Just (ty, "") + _ -> do + A.skipWhile isSpace + _ <- A.char '"' + y <- A.many1 $ A.satisfy (/= '"') + _ <- A.char '"' + A.skipWhile isSpace + _ <- A.char ')' + return $ Just (ty, y) diff --git a/Scaffold/Devel.hs b/Scaffold/Devel.hs index fa71aa69..e6c50345 100644 --- a/Scaffold/Devel.hs +++ b/Scaffold/Devel.hs @@ -143,7 +143,6 @@ getFileList = do loop :: FileList -> IO () -> IO () loop oldList getNewApp = do - putStrLn "Testing files..." newList <- getFileList when (newList /= oldList) getNewApp threadDelay 1000000 diff --git a/scaffold/favicon_ico.cg b/scaffold/favicon_ico.cg index 9888b98f958ff23094403e2f8ce27894d1f186c3..283cccf089c024071d661928a493e978865c2f21 100644 GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYJy!T(w)W!~#&Ph{3~ z*H5077It)ANy^qmKtDXZeM5^_{a244cAAtFbaGZs%>D&sshek)rffccXpa}jZbJ5d z`tY8A>x{m}zDSR&)3c)X&n`~hI_^rtOX>8teE>>7yB5wY*}Zg50m%OOwYe)U z9Nq7R&;ECBUW?33kJ{fC;(U8nZrtumNA|m&*|)=YQA5GfB~3+(w=bSi^6BFTK5XF* za@VDUd%W7*&0bCjcfGl^p=9CPS1(0D;l8@BapJPpl7&k;s%AcY^gte){%=6HFR92` z(dA|Nd{T_hg`M-JR>0zG8!-Ms_Al?Mnt6EZniy<;cy#NAR*R$IyIwz=$1^jd_TM;t z+zw{X={;M6R&-X)T+>%KW$o0C&fTjPWWnTM^ya?S?lwn*552xNj~7?wEl0NF)$?bP zYbUpNuIj0szIkSM`{sEQ>R|d{^wb#tQxhV*FHBF3ICym3iX@mgjJ|W_qS5*pJvYhz#zuJz@P!dKp~(AL>x#lFaYJy!TS&&*#8U}>}C_TXR z-o5)#7sf`Wf$231TbO5L967&l-_tOV+DDH*tFB#pzW`Yuhz&|-ad8Lkf%F5@t}(Lw ziWPS%K=DymcV>N5)c(g;uDr8AmItwcY2O}XPiyOWjQ9rm3n;!E7^ZK5anp^g_w#=S hhKE4>7Ks0$;Xm~Z3?TdyhW9fte1_uZ#~Bzv7y!I9`)dFI diff --git a/yesod.cabal b/yesod.cabal index 5914e099..50a94401 100644 --- a/yesod.cabal +++ b/yesod.cabal @@ -1,5 +1,5 @@ name: yesod -version: 0.8.0.1 +version: 0.8.1 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -13,7 +13,7 @@ category: Web, Yesod stability: Stable cabal-version: >= 1.6 build-type: Simple -homepage: http://docs.yesodweb.com/ +homepage: http://www.yesodweb.com/ extra-source-files: scaffold/*.cg flag ghc7 @@ -24,8 +24,8 @@ library cpp-options: -DGHC7 else build-depends: base >= 4 && < 4.3 - build-depends: yesod-core >= 0.8 && < 0.9 - , yesod-auth >= 0.4 && < 0.5 + build-depends: yesod-core >= 0.8.1 && < 0.9 + , yesod-auth >= 0.4 && < 0.6 , yesod-json >= 0.1 && < 0.2 , yesod-persistent >= 0.1 && < 0.2 , yesod-static >= 0.1 && < 0.2 @@ -34,7 +34,7 @@ library , transformers >= 0.2 && < 0.3 , wai >= 0.4 && < 0.5 , wai-extra >= 0.4 && < 0.5 - , hamlet >= 0.8 && < 0.9 + , hamlet >= 0.8.1 && < 0.9 , warp >= 0.4 && < 0.5 , mime-mail >= 0.3 && < 0.4 , hjsmin >= 0.0.13 && < 0.1