packages feed

file-embed 0.0.10.1 → 0.0.11

raw patch · 5 files changed

+24/−3 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.FileEmbed: embedDirListing :: FilePath -> Q Exp

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.0.11++* embedDirListing [#26](https://github.com/snoyberg/file-embed/pull/26)+ ## 0.0.10.1  * Minor doc improvements
Data/FileEmbed.hs view
@@ -21,6 +21,7 @@       embedFile     , embedOneFileOf     , embedDir+    , embedDirListing     , getDir       -- * Embed as a IsString     , embedStringFile@@ -90,7 +91,7 @@ -- > import qualified Data.ByteString -- > -- > myFile :: Data.ByteString.ByteString--- > myFile = $(embedFile' [ "dirName/fileName", "src/dirName/fileName" ])+-- > myFile = $(embedOneFileOf [ "dirName/fileName", "src/dirName/fileName" ]) embedOneFileOf :: [FilePath] -> Q Exp embedOneFileOf ps =   (runIO $ readExistingFile ps) >>= \ ( path, content ) -> do@@ -116,6 +117,18 @@ embedDir fp = do     typ <- [t| [(FilePath, B.ByteString)] |]     e <- ListE <$> ((runIO $ fileList fp) >>= mapM (pairToExp fp))+    return $ SigE e typ++-- | Embed a directory listing recursively in your source code.+--+-- > myFiles :: [FilePath]+-- > myFiles = $(embedDirListing "dirName")+--+-- @since 0.0.11+embedDirListing :: FilePath -> Q Exp+embedDirListing fp = do+    typ <- [t| [FilePath] |]+    e <- ListE <$> ((runIO $ fmap fst <$> fileList fp) >>= mapM strToExp)     return $ SigE e typ  -- | Get a directory tree in the IO monad.
README.md view
@@ -1,4 +1,8 @@ ## file-embed +[![Build Status](https://travis-ci.org/snoyberg/file-embed.svg?branch=master)](https://travis-ci.org/snoyberg/file-embed)+[![Build status](https://ci.appveyor.com/api/projects/status/vlgo8uudpt374uoy/branch/master?svg=true)](https://ci.appveyor.com/project/snoyberg/file-embed/branch/master)++ Use Template Haskell to read a file or all the files in a directory, and turn them into (path, bytestring) pairs embedded in your haskell code.
file-embed.cabal view
@@ -1,5 +1,5 @@ name:            file-embed-version:         0.0.10.1+version:         0.0.11 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>
test/main.hs view
@@ -18,4 +18,4 @@         , ("bar" </> "baz", "baz\r\n")         ]     let str = $(embedStringFile "test/sample/foo") :: String-    str @?= "foo\r\n"+    filter (/= '\r') str @?= "foo\n"