yesod-static 1.4.0.2 → 1.4.0.3
raw patch · 3 files changed
+13/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +3/−0
- Yesod/Static.hs +8/−11
- yesod-static.cabal +2/−1
+ ChangeLog.md view
@@ -0,0 +1,3 @@+## 1.4.0.3++Fix bug when `StaticRoute` constructor is not imported.
Yesod/Static.hs view
@@ -247,7 +247,7 @@ -- files, but only need to refer to a few of them from Haskell. staticFilesList :: Prelude.FilePath -> [Prelude.FilePath] -> Q [Dec] staticFilesList dir fs =- mkStaticFilesList dir (map split fs) "StaticRoute" True+ mkStaticFilesList dir (map split fs) True where split :: Prelude.FilePath -> [String] split [] = []@@ -266,7 +266,7 @@ -- contents, however they'll need send a request to the server to -- see if their copy is up-to-date. publicFiles :: Prelude.FilePath -> Q [Dec]-publicFiles dir = mkStaticFiles' dir "StaticRoute" False+publicFiles dir = mkStaticFiles' dir False mkHashMap :: Prelude.FilePath -> IO (M.Map F.FilePath S8.ByteString)@@ -311,23 +311,21 @@ return $ (\f -> return $ M.lookup f etags) mkStaticFiles :: Prelude.FilePath -> Q [Dec]-mkStaticFiles fp = mkStaticFiles' fp "StaticRoute" True+mkStaticFiles fp = mkStaticFiles' fp True mkStaticFiles' :: Prelude.FilePath -- ^ static directory- -> String -- ^ route constructor "StaticRoute" -> Bool -- ^ append checksum query parameter -> Q [Dec]-mkStaticFiles' fp routeConName makeHash = do+mkStaticFiles' fp makeHash = do fs <- qRunIO $ getFileListPieces fp- mkStaticFilesList fp fs routeConName makeHash+ mkStaticFilesList fp fs makeHash mkStaticFilesList :: Prelude.FilePath -- ^ static directory -> [[String]] -- ^ list of files to create identifiers for- -> String -- ^ route constructor "StaticRoute" -> Bool -- ^ append checksum query parameter -> Q [Dec]-mkStaticFilesList fp fs routeConName makeHash = do+mkStaticFilesList fp fs makeHash = do concat `fmap` mapM mkRoute fs where replace' c@@ -345,16 +343,15 @@ | isLower (head name') -> name' | otherwise -> '_' : name' f' <- [|map pack $(TH.lift f)|]- let route = mkName routeConName pack' <- [|pack|] qs <- if makeHash then do hash <- qRunIO $ base64md5File $ pathFromRawPieces fp f [|[(pack "etag", pack $(TH.lift hash))]|] else return $ ListE [] return- [ SigD routeName $ ConT route+ [ SigD routeName $ ConT ''StaticRoute , FunD routeName- [ Clause [] (NormalB $ (ConE route) `AppE` f' `AppE` qs) []+ [ Clause [] (NormalB $ (ConE 'StaticRoute) `AppE` f' `AppE` qs) [] ] ]
yesod-static.cabal view
@@ -1,5 +1,5 @@ name: yesod-static-version: 1.4.0.2+version: 1.4.0.3 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -22,6 +22,7 @@ test/embed-dir/foo test/embed-dir/lorem.txt test/embed-dir/abc/def.txt+ ChangeLog.md library build-depends: base >= 4 && < 5