1
1
mirror of https://github.com/nmattia/niv.git synced 2024-09-19 11:27:40 +03:00

Respect type attribute

This commit is contained in:
Eric Wolf 2020-11-02 13:23:34 +01:00 committed by Nicolas Mattia
parent 9d35b9e483
commit 497807b317

View File

@ -34,9 +34,9 @@ githubUpdate prefetch latestRev ghRepo = proc () -> do
<<< (useOrSet "url_template" <<< completeSpec) <+> (load "url_template") -<
()
url <- update "url" -< urlTemplate
let isTar = (\u -> "tar.gz" `T.isSuffixOf` u || ".tgz" `T.isSuffixOf` u) <$> url
useOrSet "type" -< bool "file" "tarball" <$> isTar :: Box T.Text
let doUnpack = isTar
let isTarGuess = (\u -> "tar.gz" `T.isSuffixOf` u || ".tgz" `T.isSuffixOf` u) <$> url
type' <- useOrSet "type" -< bool "file" "tarball" <$> isTarGuess :: Box T.Text
let doUnpack = (== "tarball") <$> type'
_sha256 <- update "sha256" <<< run (\(up, u) -> prefetch up u) -< (,) <$> doUnpack <*> url
returnA -< ()
where