diff --git a/yesod-bin/ChangeLog.md b/yesod-bin/ChangeLog.md index e1b086cb..a48acc60 100644 --- a/yesod-bin/ChangeLog.md +++ b/yesod-bin/ChangeLog.md @@ -1,3 +1,7 @@ +## 1.4.3 + +Add the minimal scaffolding + ## 1.4.2 Scaffolding updates: diff --git a/yesod-bin/Scaffolding/Scaffolder.hs b/yesod-bin/Scaffolding/Scaffolder.hs index 3f12291c..67d054b5 100644 --- a/yesod-bin/Scaffolding/Scaffolder.hs +++ b/yesod-bin/Scaffolding/Scaffolder.hs @@ -35,6 +35,7 @@ data Backend = Sqlite | Mysql | MongoDB | Simple + | Minimal deriving (Eq, Read, Show, Enum, Bounded) puts :: LT.Text -> IO () @@ -50,6 +51,7 @@ showBackend PostgresqlFay = "pf" showBackend Mysql = "mysql" showBackend MongoDB = "mongo" showBackend Simple = "simple" +showBackend Minimal = "mini" readBackend :: String -> Maybe Backend readBackend s = lookup s $ map (showBackend &&& id) backends @@ -61,6 +63,7 @@ backendBS PostgresqlFay = $(embedFile "hsfiles/postgres-fay.hsfiles") backendBS Mysql = $(embedFile "hsfiles/mysql.hsfiles") backendBS MongoDB = $(embedFile "hsfiles/mongo.hsfiles") backendBS Simple = $(embedFile "hsfiles/simple.hsfiles") +backendBS Minimal = $(embedFile "hsfiles/minimal.hsfiles") validPackageName :: String -> Bool validPackageName s = isJust (simpleParse s :: Maybe PackageName) diff --git a/yesod-bin/hsfiles/minimal.hsfiles b/yesod-bin/hsfiles/minimal.hsfiles new file mode 100644 index 00000000..0b6c61fe --- /dev/null +++ b/yesod-bin/hsfiles/minimal.hsfiles @@ -0,0 +1,125 @@ +{-# START_FILE .dir-locals.el #-} +((haskell-mode . ((haskell-indent-spaces . 4) + (haskell-process-use-ghci . t))) + (hamlet-mode . ((hamlet/basic-offset . 4) + (haskell-process-use-ghci . t)))) + +{-# START_FILE .ghci #-} +:set -i.:config:dist/build/autogen +:set -DDEVELOPMENT +:set -XCPP -XTemplateHaskell -XQuasiQuotes -XTypeFamilies -XFlexibleContexts -XGADTs -XOverloadedStrings -XMultiParamTypeClasses -XGeneralizedNewtypeDeriving -XEmptyDataDecls -XDeriveDataTypeable + +{-# START_FILE .gitignore #-} +dist* +static/tmp/ +static/combined/ +config/client_session_key.aes +*.hi +*.o +*.sqlite3 +.hsenv* +cabal-dev/ +yesod-devel/ +.cabal-sandbox +cabal.sandbox.config +.DS_Store +*.swp + +{-# START_FILE Add.hs #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} +module Add where + +import Foundation +import Yesod + +getAddR :: Int -> Int -> Handler TypedContent +getAddR x y = selectRep $ do + provideRep $ defaultLayout $ do + setTitle "Addition" + [whamlet|#{x} + #{y} = #{z}|] + provideJson $ object ["result" .= z] + where + z = x + y + +{-# START_FILE Application.hs #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE ViewPatterns #-} +module Application where + +import Foundation +import Yesod + +import Add +import Home + +mkYesodDispatch "App" resourcesApp + +{-# START_FILE Foundation.hs #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ViewPatterns #-} +module Foundation where + +import Yesod + +data App = App + +mkYesodData "App" $(parseRoutesFile "routes") + +instance Yesod App + +{-# START_FILE Home.hs #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} +module Home where + +import Foundation +import Yesod + +getHomeR :: Handler Html +getHomeR = defaultLayout $ do + setTitle "Minimal Multifile" + [whamlet| +