yesod 1.1.4.1 → 1.1.5
raw patch · 7 files changed
+61/−95 lines, 7 filesdep +aeson
Dependencies added: aeson
Files
- Devel.hs +48/−85
- Yesod.hs +2/−0
- hsfiles/mongo.hsfiles +3/−3
- hsfiles/mysql.hsfiles +2/−2
- hsfiles/postgres.hsfiles +2/−2
- hsfiles/sqlite.hsfiles +2/−2
- yesod.cabal +2/−1
Devel.hs view
@@ -15,6 +15,7 @@ import qualified Distribution.PackageDescription as D import qualified Distribution.PackageDescription.Parse as D import qualified Distribution.Simple.Build as D+import qualified Distribution.Simple.Compiler as D import qualified Distribution.Simple.Configure as D import qualified Distribution.Simple.LocalBuildInfo as D import qualified Distribution.Simple.Program as D@@ -28,11 +29,10 @@ import Control.Concurrent.MVar (MVar, newEmptyMVar, takeMVar, tryPutMVar) import qualified Control.Exception as Ex-import Control.Monad (unless, void,- when, forever)--import Control.Monad.Trans.State (evalStateT, get)+import Control.Monad (forever, unless, void,+ when) import Control.Monad.IO.Class (liftIO)+import Control.Monad.Trans.State (evalStateT, get) import Data.Char (isNumber, isUpper) import qualified Data.List as L@@ -49,22 +49,16 @@ splitDirectories, takeExtension, (</>)) import System.FSNotify-import System.IO (hClose, hGetLine,- hIsEOF, hPutStrLn,- stderr, stdout) import System.IO.Error (isDoesNotExistError) import System.Posix.Types (EpochTime) import System.PosixCompat.Files (getFileStatus, modificationTime) import System.Process (ProcessHandle,- createProcess,+ createProcess, env, getProcessExitCode,- proc, rawSystem,- readProcess,- runInteractiveProcess,+ proc, readProcess, system,- terminateProcess,- env)+ terminateProcess) import System.Timeout (timeout) import Build (getDeps, isNewerThan,@@ -73,13 +67,14 @@ getBuildFlags) import qualified Config as GHC-import SrcLoc (Located)-import Network.HTTP.ReverseProxy (waiProxyTo, ProxyDest (ProxyDest)) import Network (withSocketsDo)-import Network.Wai (responseLBS)+import Network.HTTP.Conduit (def, newManager)+import Network.HTTP.ReverseProxy (ProxyDest (ProxyDest),+ waiProxyTo) import Network.HTTP.Types (status200)+import Network.Wai (responseLBS) import Network.Wai.Handler.Warp (run)-import Network.HTTP.Conduit (newManager, def)+import SrcLoc (Located) lockFile :: DevelOpts -> FilePath lockFile _opts = "yesod-devel/devel-terminate"@@ -109,10 +104,6 @@ getBuildDir :: DevelOpts -> String getBuildDir opts = fromMaybe "dist" (buildDir opts) -cabalCommand :: DevelOpts -> FilePath-cabalCommand opts | isCabalDev opts = "cabal-dev"- | otherwise = "cabal"- defaultDevelOpts :: DevelOpts defaultDevelOpts = DevelOpts False False False (-1) Nothing Nothing Nothing @@ -156,16 +147,16 @@ -- outer loop re-reads the cabal file mainOuterLoop filesModified = do- cabal <- liftIO $ D.findPackageDesc "."- gpd <- liftIO $ D.readPackageDescription D.normal cabal- ldar <- liftIO lookupLdAr+ ghcVer <- liftIO ghcVersion+ cabal <- liftIO $ D.findPackageDesc "."+ gpd <- liftIO $ D.readPackageDescription D.normal cabal+ ldar <- liftIO lookupLdAr (hsSourceDirs, lib) <- liftIO $ checkCabalFile gpd liftIO $ removeFileIfExists (bd </> "setup-config")- liftIO $ configure cabal gpd opts+ liftIO $ configure cabal ghcVer gpd opts liftIO $ removeFileIfExists "yesod-devel/ghcargs.txt" -- these files contain the wrong data after liftIO $ removeFileIfExists "yesod-devel/arargs.txt" -- the configure step, remove them to force liftIO $ removeFileIfExists "yesod-devel/ldargs.txt" -- a cabal build first- ghcVer <- liftIO ghcVersion rebuild <- liftIO $ mkRebuild gpd ghcVer cabal opts ldar mainInnerLoop hsSourceDirs filesModified cabal gpd lib ghcVer rebuild @@ -227,16 +218,14 @@ cabal-dev uses the command-line tool, we can fall back to cabal-dev buildopts if required -}-configure :: FilePath -> D.GenericPackageDescription -> DevelOpts -> IO ()-configure _cabalFile gpd opts- | isCabalDev opts = rawSystem (cabalCommand opts) args >> return ()- | otherwise = do- lbi <- D.configure (gpd, hookedBuildInfo) configFlags- D.writePersistBuildConfig (getBuildDir opts) lbi -- fixme we could keep this in memory instead of file+configure :: FilePath -> String -> D.GenericPackageDescription -> DevelOpts -> IO ()+configure _cabalFile ghcVer gpd opts = do+ lbi <- D.configure (gpd, hookedBuildInfo) configFlags+ D.writePersistBuildConfig (getBuildDir opts) lbi -- fixme we could keep this in memory instead of file where hookedBuildInfo = (Nothing, [])- configFlags | forceCabal opts = config- | otherwise = config+ configFlags0 | forceCabal opts = config+ | otherwise = config { DSS.configProgramPaths = [ ("ar", "yesod-ar-wrapper") , ("ld", "yesod-ld-wrapper")@@ -244,35 +233,33 @@ ] , DSS.configHcPkg = DSS.Flag "ghc-pkg" }+#if MIN_VERSION_Cabal(1,16,0)+ configFlags | isCabalDev opts = configFlags0+ { DSS.configPackageDBs =+ [ Nothing+ , Just D.GlobalPackageDB+ , Just cabalDevPackageDb+ ]+ }+#else+ configFlags | isCabalDev opts = configFlags0+ { DSS.configPackageDB = DSS.Flag cabalDevPackageDb+ }+#endif+ | otherwise = configFlags0 + cabalDevPackageDb = D.SpecificPackageDB ("cabal-dev/packages-" ++ ghcVer ++ ".conf")++ config = (DSS.defaultConfigFlags D.defaultProgramConfiguration) { DSS.configConfigurationsFlags =- [ (D.FlagName "devel", True) -- legaxy+ [ (D.FlagName "devel", True) -- legacy , (D.FlagName "library-only", True) ] , DSS.configProfLib = DSS.Flag False , DSS.configUserInstall = DSS.Flag True }- cabalArgs- | isCabalDev opts = map ("--cabal-install-arg=" ++) as- | otherwise = as- where- as =- [ "-fdevel" -- legacy- , "-flibrary-only"- ] ++ wrapperArgs- wrapperArgs- | forceCabal opts = []- | otherwise =- [ "--with-compiler=yesod-ghc-wrapper"- , "--with-hc-pkg=ghc-pkg"- , "--with-ld=yesod-ld-wrapper"- , "--with-ar=yesod-ar-wrapper"- ]- args :: [String]- args = "configure":cabalArgs ++ ["--disable-library-profiling" ] - removeFileIfExists :: FilePath -> IO () removeFileIfExists file = removeFile file `Ex.catch` handler where@@ -302,15 +289,7 @@ buildPackage bf ld ar rebuildCabal :: D.GenericPackageDescription -> DevelOpts -> IO Bool-rebuildCabal _gpd opts- | isCabalDev opts = do- let cmd = cabalCommand opts- putStrLn $ "Rebuilding application... (using " ++ cmd ++ ")"- exit <- (if verbose opts then rawSystem else rawSystemFilter) cmd ["build"]- return $ case exit of- ExitSuccess -> True- _ -> False- | otherwise = do+rebuildCabal _gpd opts = do putStrLn $ "Rebuilding application... (using Cabal library)" lbi <- getPersistBuildConfig opts -- fixme we could cache this from the configure step let buildFlags | verbose opts = DSS.defaultBuildFlags@@ -407,11 +386,12 @@ ghcPackageArgs :: DevelOpts -> String -> D.PackageDescription -> D.Library -> IO [String] ghcPackageArgs opts ghcVer cabal lib = do- lbi <- getPersistBuildConfig opts- cbi <- fromMaybeErr errCbi (D.libraryConfig lbi)- if isCabalDev opts- then return ("-hide-all-packages" : "-no-user-package-conf" : inplaceConf : selfPkgArg lbi : cabalDevConf : depArgs lbi cbi)- else return ("-hide-all-packages" : inplaceConf : selfPkgArg lbi : depArgs lbi cbi)+ lbi <- getPersistBuildConfig opts+ cbi <- fromMaybeErr errCbi (D.libraryConfig lbi)+ if isCabalDev opts+ then return ("-hide-all-packages" : "-no-user-package-conf" : inplaceConf+ : selfPkgArg lbi : cabalDevConf : depArgs lbi cbi)+ else return ("-hide-all-packages" : inplaceConf : selfPkgArg lbi : depArgs lbi cbi) where selfPkgArg lbi = pkgArg . D.inplacePackageId . D.package . D.localPkgDescr $ lbi pkgArg (D.InstalledPackageId pkgId) = "-package-id" ++ pkgId@@ -476,23 +456,6 @@ return $ (,) <$> look D.ldProgram pgmc' <*> look D.arProgram pgmc' where look pgm pdb = fmap D.programPath (D.lookupProgram pgm pdb)---- | Acts like @rawSystem@, but filters out lines from the output that we're not interested in seeing.-rawSystemFilter :: String -> [String] -> IO ExitCode-rawSystemFilter command args = do- (inh, outh, errh, ph) <- runInteractiveProcess command args Nothing Nothing- hClose inh- let go handlein handleout = do- isEof <- hIsEOF handlein- if isEof- then hClose handlein- else do- line <- hGetLine handlein- unless ("Loading package " `L.isPrefixOf` line) $ hPutStrLn handleout line- go handlein handleout- _ <- forkIO $ go outh stdout- _ <- forkIO $ go errh stderr- waitForProcess' ph -- | nonblocking version of @waitForProcess@ waitForProcess' :: ProcessHandle -> IO ExitCode
Yesod.hs view
@@ -30,6 +30,7 @@ , julius , JavascriptUrl , renderJavascriptUrl+ , toJSON -- ** Cassius/Lucius , cassius , lucius@@ -55,6 +56,7 @@ import System.IO (stderr, hPutStrLn) import Text.Blaze.Html (toHtml) import System.Environment (getEnv)+import Data.Aeson (toJSON) showIntegral :: Integral a => a -> String showIntegral x = show (fromIntegral x :: Integer)
hsfiles/mongo.hsfiles view
@@ -313,7 +313,7 @@ -- You can find more information on persistent and how to declare entities -- at: -- http://www.yesodweb.com/book/persistent/-share [mkPersist MkPersistSettings { mpsBackend = ConT ''Action }, mkMigrate "migrateAll"]+share [mkPersist MkPersistSettings { mpsBackend = ConT ''MongoBackend }, mkMigrate "migrateAll"] $(persistFileWith lowerCaseSettings "config/models") {-# START_FILE PROJECTNAME.cabal #-}@@ -370,8 +370,8 @@ , clientsession >= 0.8 && < 0.9 , bytestring >= 0.9 && < 0.11 , text >= 0.11 && < 0.12- , persistent >= 1.0 && < 1.1- , persistent-mongoDB >= 1.0 && < 1.1+ , persistent >= 1.1 && < 1.2+ , persistent-mongoDB >= 1.1 && < 1.2 , template-haskell , hamlet >= 1.1 && < 1.2 , shakespeare-css >= 1.0 && < 1.1
hsfiles/mysql.hsfiles view
@@ -371,8 +371,8 @@ , clientsession >= 0.8 && < 0.9 , bytestring >= 0.9 && < 0.11 , text >= 0.11 && < 0.12- , persistent >= 1.0 && < 1.1- , persistent-mysql >= 1.0 && < 1.1+ , persistent >= 1.1 && < 1.2+ , persistent-mysql >= 1.1 && < 1.2 , template-haskell , hamlet >= 1.1 && < 1.2 , shakespeare-css >= 1.0 && < 1.1
hsfiles/postgres.hsfiles view
@@ -371,8 +371,8 @@ , clientsession >= 0.8 && < 0.9 , bytestring >= 0.9 && < 0.11 , text >= 0.11 && < 0.12- , persistent >= 1.0 && < 1.1- , persistent-postgresql >= 1.0 && < 1.1+ , persistent >= 1.1 && < 1.2+ , persistent-postgresql >= 1.1 && < 1.2 , template-haskell , hamlet >= 1.1 && < 1.2 , shakespeare-css >= 1.0 && < 1.1
hsfiles/sqlite.hsfiles view
@@ -371,8 +371,8 @@ , clientsession >= 0.8 && < 0.9 , bytestring >= 0.9 && < 0.11 , text >= 0.11 && < 0.12- , persistent >= 1.0 && < 1.1- , persistent-sqlite >= 1.0 && < 1.1+ , persistent >= 1.1 && < 1.2+ , persistent-sqlite >= 1.1 && < 1.2 , template-haskell , hamlet >= 1.1 && < 1.2 , shakespeare-css >= 1.0 && < 1.1
yesod.cabal view
@@ -1,5 +1,5 @@ name: yesod-version: 1.1.4.1+version: 1.1.5 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -43,6 +43,7 @@ , warp >= 1.3 && < 1.4 , blaze-html >= 0.5 && < 0.6 , blaze-markup >= 0.5.1 && < 0.6+ , aeson exposed-modules: Yesod ghc-options: -Wall