git:// now replaced with https:// (configurable). Ref #86.
This commit is contained in:
parent
afd03df8af
commit
2f57dd1b2a
3 changed files with 14 additions and 2 deletions
|
|
@ -303,6 +303,9 @@ You can currently configure the following in this file:
|
|||
a ``[PackageList]`` section named "official". Multiple URLs can be specified
|
||||
under each section, Nimble will try each in succession if
|
||||
downloading from the first fails.
|
||||
* ``cloneUsingHttps`` - Whether to replace any ``git://`` inside URLs with
|
||||
``https://``.
|
||||
**Default: true**
|
||||
|
||||
## Creating Packages
|
||||
|
||||
|
|
|
|||
|
|
@ -471,10 +471,15 @@ proc downloadPkg(url: string, verRange: VersionRange,
|
|||
## which was downloaded.
|
||||
let downloadDir = (getNimbleTempDir() / getDownloadDirName(url, verRange))
|
||||
createDir(downloadDir)
|
||||
echo("Downloading ", url, " into ", downloadDir, " using ", downMethod, "...")
|
||||
let modUrl =
|
||||
if url.startsWith("git://") and options.config.cloneUsingHttps:
|
||||
"https://" & url[6 .. ^1]
|
||||
else: url
|
||||
echo("Downloading ", modUrl, " into ", downloadDir, " using ",
|
||||
downMethod, "...")
|
||||
result = (
|
||||
downloadDir,
|
||||
doDownload(url, downloadDir, verRange, downMethod, options)
|
||||
doDownload(modUrl, downloadDir, verRange, downMethod, options)
|
||||
)
|
||||
|
||||
proc getDownloadInfo*(pv: PkgTuple, options: Options,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ type
|
|||
nimbleDir*: string
|
||||
chcp*: bool # Whether to change the code page in .cmd files on Win.
|
||||
packageLists*: Table[string, PackageList] ## URLs to packages.json files
|
||||
cloneUsingHttps*: bool # Whether to replace git:// for https://
|
||||
|
||||
PackageList* = object
|
||||
name*: string
|
||||
|
|
@ -21,6 +22,7 @@ proc initConfig(): Config =
|
|||
result.nimbleDir = getHomeDir() / ".babel"
|
||||
|
||||
result.chcp = true
|
||||
result.cloneUsingHttps = true
|
||||
|
||||
result.packageLists = initTable[string, PackageList]()
|
||||
let defaultPkgList = PackageList(name: "Official", urls: @[
|
||||
|
|
@ -79,6 +81,8 @@ proc parseConfig*(): Config =
|
|||
result.nimbleDir = e.value
|
||||
of "chcp":
|
||||
result.chcp = parseBool(e.value)
|
||||
of "cloneusinghttps":
|
||||
result.cloneUsingHttps = parseBool(e.value)
|
||||
of "name":
|
||||
case currentSection.normalize
|
||||
of "packagelist":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue