Added better url detection to publish

Publish will now look at the hostname part of the ssh url to figure out
what git server to use. This definitely works with both github and
gitlab, and adds gitlab support to `nimble publish`.
This commit is contained in:
waylon531 2017-07-25 17:10:05 -07:00
commit 4a78953fc6
No known key found for this signature in database
GPG key ID: ABEF2C28A9990A48

View file

@ -206,7 +206,7 @@ proc publish*(p: PackageInfo, o: Options) =
if parsed.scheme == "":
# Assuming that we got an ssh write/read URL.
let sshUrl = parseUri("ssh://" & url)
url = "https://github.com/" & sshUrl.port & sshUrl.path
url = "https://" & sshUrl.hostname & "/" & sshUrl.port & sshUrl.path
elif dirExists(os.getCurrentDir() / ".hg"):
downloadMethod = "hg"
# TODO: Retrieve URL from hg.