yesod-bin 1.4.0.4 → 1.4.0.5
raw patch · 2 files changed
+7/−7 lines, 2 files
Files
- AddHandler.hs +6/−6
- yesod-bin.cabal +1/−1
AddHandler.hs view
@@ -1,13 +1,13 @@+{-# LANGUAGE PatternGuards #-} module AddHandler (addHandler) where import Prelude hiding (readFile) import System.IO (hFlush, stdout) import Data.Char (isLower, toLower, isSpace)-import Data.List (isPrefixOf, isSuffixOf)+import Data.List (isPrefixOf, isSuffixOf, stripPrefix) import qualified Data.Text as T import qualified Data.Text.IO as TIO import System.Directory (getDirectoryContents, doesFileExist)-import Control.Monad (when) -- strict readFile readFile :: FilePath -> IO String@@ -62,18 +62,18 @@ fixApp name = unlines . reverse . go . reverse . lines where- l = "import Handler." ++ name+ l spaces = "import " ++ spaces ++ "Handler." ++ name - go [] = [l]+ go [] = [l ""] go (x:xs)- | "import Handler." `isPrefixOf` x = l : x : xs+ | Just y <- stripPrefix "import " x, "Handler." `isPrefixOf` dropWhile (== ' ') y = l (takeWhile (== ' ') y) : x : xs | otherwise = x : go xs fixCabal :: String -> String -> String fixCabal name = unlines . reverse . go . reverse . lines where- l = "import Handler." ++ name+ l = " Handler." ++ name go [] = [l] go (x:xs)
yesod-bin.cabal view
@@ -1,5 +1,5 @@ name: yesod-bin-version: 1.4.0.4+version: 1.4.0.5 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>