Skip to content

Commit

Permalink
Version bump, spelling fix, changelog update, directory name decoding…
Browse files Browse the repository at this point in the history
… fix. Fixes #11
  • Loading branch information
Alexey Kuleshevich committed Aug 21, 2018
1 parent 4ebbae9 commit 17be4e5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.1.6

* Addition ability to store relative paths with `--relative-path` argument: [#11](https://github.com/fpco/cache-s3/issues/11)

# v0.1.5

* Fixes [#9](https://github.com/fpco/cache-s3/issues/9)
Expand Down
4 changes: 2 additions & 2 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ commonArgsParser version mS3Bucket =
saveArgsParser :: (Parser FilePath -> Parser [FilePath]) -> Parser SaveArgs
saveArgsParser paths =
SaveArgs <$>
paths (option str (long "path" <> short 'p' <> help "All the paths that should be chached")) <*>
paths (option str (long "path" <> short 'p' <> help "All the paths that should be cached")) <*>
paths (option str (long "relative-path" <>
short 'l' <>
help "All the relative paths that should be chached")) <*>
help "All the relative paths that should be cached")) <*>
option
readText
(long "hash" <> value "sha256" <> help "Hashing algorithm to use for cache validation") <*>
Expand Down
2 changes: 1 addition & 1 deletion cache-s3.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cache-s3
version: 0.1.5
version: 0.1.6
synopsis: Use an AWS S3 bucket for caching your stack build environment.
description: Save local directories to S3 bucket and restore them later to their
original locations. Designed for stack usage during CI, but can be
Expand Down
7 changes: 3 additions & 4 deletions src/Network/AWS/S3/Cache/Local.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- |
-- Module : Network.AWS.S3.Cache.Local
Expand All @@ -22,7 +21,6 @@ import Control.Monad.Trans.Resource (MonadResource, ResourceT)
import Crypto.Hash (Digest, HashAlgorithm)
import Crypto.Hash.Conduit
import Data.ByteString as S
import Data.ByteString.Char8 as S8
import Data.Conduit
import Data.Conduit.Binary
import Data.Conduit.List as C
Expand All @@ -45,7 +43,7 @@ tarFiles :: (MonadCatch m, MonadResource m, MonadLogger m) =>
tarFiles dirs relativeDirs = do
logDebugN "Preparing files for saving in the cache."
dirsCanonical <- liftIO $ P.mapM canonicalizePath dirs
uniqueDirs <- Maybe.catMaybes <$> P.mapM skipMissing ((removeSubpaths dirsCanonical) ++ relativeDirs)
uniqueDirs <- Maybe.catMaybes <$> P.mapM skipMissing (removeSubpaths dirsCanonical ++ relativeDirs)
if P.null uniqueDirs
then logErrorN "No paths to cache has been specified."
else sourceList uniqueDirs .| filePathConduit .| void tar
Expand Down Expand Up @@ -115,6 +113,7 @@ restoreFilesFromCache comp _ =
where
restoreFile' fi = do
case fileType fi of
FTDirectory -> liftIO $ createDirectoryIfMissing True (S8.unpack (filePath fi))
FTDirectory -- Make sure nested folders:
-> liftIO $ createDirectoryIfMissing True (decodeFilePath (filePath fi))
_ -> return ()
restoreFile fi

0 comments on commit 17be4e5

Please sign in to comment.