yesod-bin 1.4.11 → 1.4.12
raw patch · 4 files changed
+38/−3 lines, 4 filesdep ~directory
Dependency ranges changed: directory
Files
- AddHandler.hs +23/−0
- ChangeLog.md +4/−0
- Devel.hs +9/−1
- yesod-bin.cabal +2/−2
AddHandler.hs view
@@ -9,6 +9,7 @@ import qualified Data.Text as T import qualified Data.Text.IO as TIO import System.Directory (getDirectoryContents, doesFileExist)+import Control.Monad (unless) data RouteError = EmptyRoute | RouteCaseError@@ -78,7 +79,11 @@ modify cabal $ fixCabal name modify "config/routes" $ fixRoutes name pattern methods writeFile handlerFile $ mkHandler name pattern methods+ specExists <- doesFileExist specFile+ unless specExists $+ writeFile specFile $ mkSpec name pattern methods where+ specFile = "test/Handler/" ++ name ++ "Spec.hs" modify fp f = readFile fp >>= writeFile fp . f getCabal :: IO FilePath@@ -141,6 +146,24 @@ , "\n" ] startingCharacter = if "\n" `isSuffixOf` fileContents then "" else "\n"++mkSpec :: String -> String -> String -> String+mkSpec name _ methods = unlines+ $ ("module Handler." ++ name ++ "Spec (spec) where")+ : ""+ : "import TestImport"+ : ""+ : "spec :: Spec"+ : "spec = withApp $ do"+ : concatMap go (words methods)+ where+ go method =+ [ ""+ , " describe \"" ++ func ++ "\" $ do"+ , " error \"Spec not implemented: " ++ func ++ "\""+ , ""]+ where+ func = concat [map toLower method, name, "R"] mkHandler :: String -> String -> String -> String mkHandler name pattern methods = unlines
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.4.12++* Devel server: have to type quit to quit+ ## 1.4.11 * Add support to `yesod devel` to detect and use `GHC_PACKAGE_PATH`. This makes
Devel.hs view
@@ -238,9 +238,17 @@ let (terminator, after) = case terminateWith opts of TerminateOnEnter ->- ("Press ENTER", void getLine)+ ("Type 'quit'", blockQuit) TerminateOnlyInterrupt -> -- run for one year ("Interrupt", threadDelay $ 1000 * 1000 * 60 * 60 * 24 * 365)++ blockQuit = do+ s <- getLine+ if s == "quit"+ then return ()+ else do+ putStrLn "Type 'quit' to quit"+ blockQuit putStrLn $ "Yesod devel server. " ++ terminator ++ " to quit"
yesod-bin.cabal view
@@ -1,5 +1,5 @@ name: yesod-bin-version: 1.4.11+version: 1.4.12 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -52,7 +52,7 @@ , bytestring >= 0.9.1.4 , time >= 1.1.4 , template-haskell- , directory >= 1.0+ , directory >= 1.2.1 , Cabal , unix-compat >= 0.2 && < 0.5 , containers >= 0.2