Last active
August 29, 2015 13:57
-
-
Save mlen/9688268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upload :: Verbosity -> [Repo] -> Maybe Username -> Maybe Password -> [FilePath] -> IO () | |
upload verbosity repos mUsername mPassword paths = do | |
let uploadURI = if isOldHackageURI targetRepoURI | |
then legacyUploadURI | |
else targetRepoURI{uriPath = uriPath targetRepoURI `FilePath.Posix.combine` "upload"} | |
Username username <- maybe promptUsername return mUsername | |
Password password <- maybe promptPassword return mPassword | |
let auth = addAuthority AuthBasic { | |
auRealm = "Hackage", | |
auUsername = username, | |
auPassword = password, | |
auSite = uploadURI | |
} | |
flip mapM_ paths $ \path -> do | |
notice verbosity $ "Uploading " ++ path ++ "... " | |
handlePackage verbosity uploadURI auth path | |
where | |
targetRepoURI = remoteRepoURI $ last [ remoteRepo | Left remoteRepo <- map repoKind repos ] --FIXME: better error message when no repos are given |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment