Merge branch 'master' of https://github.com/paul-rouse/yesod into paul-rouse-master
This commit is contained in:
commit
253beb3107
@ -1,3 +1,7 @@
|
|||||||
|
## 1.4.3.1
|
||||||
|
|
||||||
|
* Handle exceptions while writing a file in `addStaticContentExternal`
|
||||||
|
|
||||||
## 1.4.3
|
## 1.4.3
|
||||||
|
|
||||||
* Switch to `Data.Yaml.Config`
|
* Switch to `Data.Yaml.Config`
|
||||||
|
|||||||
@ -18,6 +18,9 @@ import qualified Data.ByteString.Lazy as L
|
|||||||
import Data.Text (Text, pack, unpack)
|
import Data.Text (Text, pack, unpack)
|
||||||
import Yesod.Core -- purposely using complete import so that Haddock will see addStaticContent
|
import Yesod.Core -- purposely using complete import so that Haddock will see addStaticContent
|
||||||
import Control.Monad (when, unless)
|
import Control.Monad (when, unless)
|
||||||
|
import Control.Monad.Trans.Resource (runResourceT)
|
||||||
|
import Data.Conduit (($$))
|
||||||
|
import Data.Conduit.Binary (sourceLbs, sinkFileCautious)
|
||||||
import System.Directory (doesFileExist, createDirectoryIfMissing)
|
import System.Directory (doesFileExist, createDirectoryIfMissing)
|
||||||
import Language.Haskell.TH.Syntax
|
import Language.Haskell.TH.Syntax
|
||||||
import Text.Lucius (luciusFile, luciusFileReload)
|
import Text.Lucius (luciusFile, luciusFileReload)
|
||||||
@ -43,7 +46,8 @@ addStaticContentExternal
|
|||||||
addStaticContentExternal minify hash staticDir toRoute ext' _ content = do
|
addStaticContentExternal minify hash staticDir toRoute ext' _ content = do
|
||||||
liftIO $ createDirectoryIfMissing True statictmp
|
liftIO $ createDirectoryIfMissing True statictmp
|
||||||
exists <- liftIO $ doesFileExist fn'
|
exists <- liftIO $ doesFileExist fn'
|
||||||
unless exists $ liftIO $ L.writeFile fn' content'
|
unless exists $
|
||||||
|
liftIO $ runResourceT $ sourceLbs content' $$ sinkFileCautious fn'
|
||||||
return $ Just $ Right (toRoute ["tmp", pack fn], [])
|
return $ Just $ Right (toRoute ["tmp", pack fn], [])
|
||||||
where
|
where
|
||||||
fn, statictmp, fn' :: FilePath
|
fn, statictmp, fn' :: FilePath
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod
|
name: yesod
|
||||||
version: 1.4.3
|
version: 1.4.3.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -40,7 +40,9 @@ library
|
|||||||
, bytestring
|
, bytestring
|
||||||
, monad-logger
|
, monad-logger
|
||||||
, fast-logger
|
, fast-logger
|
||||||
, conduit-extra
|
, conduit
|
||||||
|
, conduit-extra >= 1.1.14
|
||||||
|
, resourcet
|
||||||
, shakespeare
|
, shakespeare
|
||||||
, streaming-commons
|
, streaming-commons
|
||||||
, wai-logger
|
, wai-logger
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user