Adds update suggestion to failed install commands.
The install proc checks the didUpdatePackages first to avoid infinite recursion.
This commit is contained in:
parent
58ee3a5d81
commit
e08f9101b8
1 changed files with 10 additions and 2 deletions
|
|
@ -296,12 +296,20 @@ proc install(packages: seq[String], verRange: PVersionRange): string =
|
||||||
result = installFromDir(getCurrentDir(), false)
|
result = installFromDir(getCurrentDir(), false)
|
||||||
else:
|
else:
|
||||||
if not existsFile(babelDir / "packages.json"):
|
if not existsFile(babelDir / "packages.json"):
|
||||||
|
if didUpdatePackages == false and prompt("Local packages.json not found, download it from internet?"):
|
||||||
|
update()
|
||||||
|
install(packages, verRange)
|
||||||
|
else:
|
||||||
quit("Please run babel update.", QuitFailure)
|
quit("Please run babel update.", QuitFailure)
|
||||||
for p in packages:
|
for p in packages:
|
||||||
var pkg: TPackage
|
var pkg: TPackage
|
||||||
if getPackage(p, babelDir / "packages.json", pkg):
|
if getPackage(p, babelDir / "packages.json", pkg):
|
||||||
let downloadDir = downloadPkg(pkg, verRange)
|
let downloadDir = downloadPkg(pkg, verRange)
|
||||||
result = installFromDir(downloadDir, false)
|
result = installFromDir(downloadDir, false)
|
||||||
|
else:
|
||||||
|
if didUpdatePackages == false and prompt(p & " not found in local packages.json, check internet for updated packages?"):
|
||||||
|
update()
|
||||||
|
install(@[p], verRange)
|
||||||
else:
|
else:
|
||||||
raise newException(EBabel, "Package not found.")
|
raise newException(EBabel, "Package not found.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue