archive-sig 0.2.3.0 → 1.0.0.0
raw patch · 5 files changed
+46/−8 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Archive: packFiles :: [FilePath] -> IO ByteString
- Archive: unpackToDir :: FilePath -> ByteString -> IO ()
+ Archive: data FP
+ Archive: instance GHC.Exception.Type.Exception {Archive.Error}
+ Archive: packFilesRaw :: [FP] -> IO ByteString
+ Archive: toFP :: FilePath -> FP
+ Archive: unpackToDirRaw :: FP -> ByteString -> IO ()
Files
- CHANGELOG.md +6/−0
- archive-sig.cabal +4/−1
- src/Archive.hsig +23/−6
- src/Archive/Compression.hs +10/−0
- src/Archive/Generic.hs +3/−1
CHANGELOG.md view
@@ -1,3 +1,9 @@+# 1.0.0.0++ * Add `FP` type to allow the filepath type to be abstract+ * Add `toFP`, `packFromFilesRaw`, `unpackToDirRaw`+ * Move `packFromFiles`, `unpackToDir` to `Archive.Compression`+ # 0.2.3.0 * Add `archiveSigVersion` function
archive-sig.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: archive-sig-version: 0.2.3.0+version: 1.0.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2019-2020 Vanessa McHale@@ -51,3 +51,6 @@ if impl(ghc >=8.4) ghc-options: -Wmissing-export-lists++ if impl(ghc >=8.10)+ ghc-options: -Wunused-packages
src/Archive.hsig view
@@ -1,25 +1,42 @@ signature Archive ( Entry , Error- , unpackToDir+ , FP+ , unpackToDirRaw , readArchiveBytes- , packFiles+ , packFilesRaw , writeArchiveBytes , versionInfo+ , toFP ) where +import Control.Exception (Exception) import qualified Data.ByteString.Lazy as BSL data Entry data Error +-- | The type for filepaths used by the library+--+-- @since 1.0.0.0+data FP+ instance Show Error --- | @since 0.2.0.0-packFiles :: [FilePath] -- ^ Files and directories to write to archive- -> IO BSL.ByteString -- ^ 'BSL.ByteString' containing archive+-- | @since 1.0.0.0+instance Exception Error -unpackToDir :: FilePath -> BSL.ByteString -> IO ()+-- | Function to get an 'FP' from a 'FilePath'. May throw exceptions if need be.+--+-- @since 1.0.0.0+toFP :: FilePath -> FP++-- @since 1.0.0.0+packFilesRaw :: [FP] -- ^ Files and directories to write to archive+ -> IO BSL.ByteString -- ^ 'BSL.ByteString' containing archive++-- @since 1.0.0.0+unpackToDirRaw :: FP -> BSL.ByteString -> IO () readArchiveBytes :: BSL.ByteString -> Either Error [Entry]
src/Archive/Compression.hs view
@@ -14,6 +14,15 @@ type Decompressor = BSL.ByteString -> BSL.ByteString type Compressor = BSL.ByteString -> BSL.ByteString +-- | @since 1.0.0.0+packFiles :: [FilePath] -- ^ Files and directories to write to archive+ -> IO BSL.ByteString -- ^ 'BSL.ByteString' containing archive+packFiles = packFilesRaw . fmap toFP++-- | @since 1.0.0.0+unpackToDir :: FilePath -> BSL.ByteString -> IO ()+unpackToDir = unpackToDirRaw . toFP+ -- | @since 0.2.0.0 unpackFileToDirAndDecompress :: Decompressor -- ^ Decompression to use -> FilePath -- ^ Filepath pointing to archive@@ -35,6 +44,7 @@ packSrcDirAndCompress :: Compressor -> FilePath -> FilePath -> IO () packSrcDirAndCompress f dir tar = packFromFilesAndCompress f tar =<< getDirFiltered (pure.srcFilter) dir +-- FIXME: isInfixOf? srcFilter :: FilePath -> Bool srcFilter fp | ".git" `isSuffixOf` fp = False | "_darcs" `isSuffixOf` fp = False
src/Archive/Generic.hs view
@@ -9,10 +9,12 @@ import Archive import Archive.Compression import Control.Composition ((.@))+import Control.Exception (throw) import qualified Data.ByteString.Lazy as BSL import qualified Data.Version as V import qualified Paths_archive_sig as P + -- | @since 0.2.3.0 archiveSigVersion :: V.Version archiveSigVersion = P.version@@ -26,7 +28,7 @@ packToFile = writeArchiveBytes .@ BSL.writeFile unpackFromFile :: FilePath -> IO [Entry]-unpackFromFile = fmap (either (error . show) id . readArchiveBytes) . BSL.readFile+unpackFromFile = fmap (either throw id . readArchiveBytes) . BSL.readFile unpackFileToDir :: FilePath -- ^ Filepath pointing to archive -> FilePath -- ^ Directory