Use consistent directory for cloning repositories
All checks were successful
Build / audit (push) Successful in 16m35s
Build / test (push) Successful in 16m41s

... with submodules.
This commit is contained in:
2024-01-04 09:36:11 +01:00
parent a25655c2b2
commit 7edb811dc2
4 changed files with 75 additions and 62 deletions

View File

@@ -6,14 +6,16 @@
module SlackBuilder.Trans
( SlackBuilderException(..)
, SlackBuilderT(..)
, relativeToRepository
) where
import Control.Monad.Trans.Reader (ReaderT(..))
import Control.Monad.Trans.Reader (ReaderT(..), asks)
import Data.Text (Text)
import SlackBuilder.Config
import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Catch (MonadCatch(..), MonadThrow(..))
import Control.Exception (Exception(..))
import System.FilePath ((</>))
newtype SlackBuilderException = UpdaterNotFound Text
deriving Show
@@ -24,6 +26,10 @@ newtype SlackBuilderT a = SlackBuilderT
{ runSlackBuilderT :: ReaderT Settings IO a
}
relativeToRepository :: FilePath -> SlackBuilderT FilePath
relativeToRepository filePath =
(</> filePath) <$> SlackBuilderT (asks repository)
instance Functor SlackBuilderT
where
fmap f (SlackBuilderT slackBuilderT) = SlackBuilderT $ f <$> slackBuilderT