summaryrefslogtreecommitdiff
path: root/lib/SlackBuilder/Download.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2024-03-05 23:06:32 +0100
committerEugen Wissner <belka@caraus.de>2024-03-05 23:06:32 +0100
commit16c70632242f00ac424601426575feb9ea523b75 (patch)
tree54269033d739bb0f9a71b5e5275c309b84f41fda /lib/SlackBuilder/Download.hs
parentcd15b25db15e8fd5ee11e4f2c11410d904ec1636 (diff)
downloadslackbuilder-16c70632242f00ac424601426575feb9ea523b75.tar.gz
Make local paths relative to cwd
Diffstat (limited to 'lib/SlackBuilder/Download.hs')
-rw-r--r--lib/SlackBuilder/Download.hs23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/SlackBuilder/Download.hs b/lib/SlackBuilder/Download.hs
index 719efe9..23ed3a4 100644
--- a/lib/SlackBuilder/Download.hs
+++ b/lib/SlackBuilder/Download.hs
@@ -142,16 +142,6 @@ remoteFileExists url = hostedSources url
}
go uri = req HEAD uri NoReqBody ignoreResponse mempty
-uploadCommand :: FilePath -> Text -> SlackBuilderT ()
-uploadCommand localPath remotePath' = do
- remoteRoot <- SlackBuilderT $ asks remotePath
- localPathFromRepository <- relativeToRepository localPath
-
- liftIO $ callProcess "scp"
- [ localPathFromRepository
- , Text.unpack $ remoteRoot <> remotePath'
- ]
-
cloneAndArchive :: Text -> FilePath -> Text -> SlackBuilderT ()
cloneAndArchive repo tarballPath tagPrefix = do
let version = snd $ Text.breakOnEnd "-"
@@ -217,6 +207,19 @@ cloneAndUpload repo tarballPath tagPrefix = do
>> uploadCommand localPath remoteArchivePath
>> liftIO (runConduitRes go) <&> (remoteResultURI,)
+-- | Given a path to a local file and a remote path uploads the file using
+-- the settings given in the configuration file.
+--
+-- The remote path is given relative to the path in the configuration.
+uploadCommand :: FilePath -> Text -> SlackBuilderT ()
+uploadCommand localPath remotePath' = do
+ remoteRoot <- SlackBuilderT $ asks remotePath
+
+ liftIO $ callProcess "scp"
+ [ localPath
+ , Text.unpack $ remoteRoot <> remotePath'
+ ]
+
-- | Downlaods a file into the directory. Returns name of the downloaded file
-- and checksum.
--