cabal-cache 1.0.0.7 → 1.0.0.8
raw patch · 3 files changed
+14/−6 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ HaskellWorks.CabalCache.IO.Lazy: removePathRecursive :: (MonadIO m, MonadCatch m) => FilePath -> m (Either AppError ())
Files
- cabal-cache.cabal +1/−1
- src/App/Commands/SyncFromArchive.hs +3/−5
- src/HaskellWorks/CabalCache/IO/Lazy.hs +10/−0
cabal-cache.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: cabal-cache-version: 1.0.0.7+version: 1.0.0.8 synopsis: CI Assistant for Haskell projects description: CI Assistant for Haskell projects. Implements package caching. homepage: https://github.com/haskell-works/cabal-cache
src/App/Commands/SyncFromArchive.hs view
@@ -14,6 +14,7 @@ import App.Static (homeDirectory) import Control.Lens hiding ((<.>)) import Control.Monad (unless, void, when)+import Control.Monad.Catch (MonadCatch) import Control.Monad.Except import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Resource (runResourceT)@@ -194,13 +195,10 @@ return () -cleanupStorePath :: MonadIO m => FilePath -> Z.PackageId -> AppError -> m ()+cleanupStorePath :: (MonadIO m, MonadCatch m) => FilePath -> Z.PackageId -> AppError -> m () cleanupStorePath packageStorePath packageId e = do CIO.hPutStrLn IO.stderr $ "Warning: Sync failure: " <> packageId- deleteStorePath packageStorePath--deleteStorePath :: MonadIO m => FilePath -> m ()-deleteStorePath pkgStorePath = liftIO (IO.removeDirectoryRecursive pkgStorePath)+ void $ IO.removePathRecursive packageStorePath onError :: MonadIO m => (AppError -> m ()) -> a -> ExceptT AppError m a -> m a onError h failureValue f = do
src/HaskellWorks/CabalCache/IO/Lazy.hs view
@@ -11,6 +11,7 @@ , createLocalDirectoryIfMissing , linkOrCopyResource , readHttpUri+ , removePathRecursive ) where import Antiope.Core@@ -205,3 +206,12 @@ response <- liftIO $ HTTP.httpLbs request manager return $ HTTP.responseBody response++removePathRecursive :: (MonadIO m, MonadCatch m) => FilePath -> m (Either AppError ())+removePathRecursive pkgStorePath = catch action handler+ where action :: MonadIO m => m (Either AppError ())+ action = Right <$> liftIO (IO.removeDirectoryRecursive pkgStorePath)+ handler :: MonadIO m => IOError -> m (Either AppError ())+ handler e = do+ CIO.hPutStrLn IO.stderr $ "Warning: Caught " <> tshow e+ return (Left (GenericAppError (tshow e)))