Fixes cloning repo for develop command.

This commit is contained in:
Dominik Picheta 2017-08-19 22:03:45 +01:00
commit acbce88bac
3 changed files with 18 additions and 2 deletions

View file

@ -926,13 +926,21 @@ proc developFromDir(dir: string, options: Options) =
# processDeps).
saveNimbleData(options)
display("Success:", (pkgInfo.name & " linked successfully to '$1'.") %
dir, Success, HighPriority)
proc develop(options: Options) =
if options.action.packages == @[]:
developFromDir(getCurrentDir(), options)
else:
# Install each package.
for pv in options.action.packages:
let downloadDir = getCurrentDir() / pv.name
let name =
if isURL(pv.name):
parseUri(pv.name).path
else:
pv.name
let downloadDir = getCurrentDir() / name
if dirExists(downloadDir):
let msg = "Cannot clone into '$1': directory exists." % downloadDir
let hint = "Remove the directory, or run this command somewhere else."

View file

@ -219,7 +219,7 @@ proc parseArgument*(key: string, result: var Options) =
case result.action.typ
of actionNil:
assert false
of actionInstall, actionPath, actionUninstall:
of actionInstall, actionPath, actionDevelop, actionUninstall:
# Parse pkg@verRange
if '@' in key:
let i = find(key, '@')

View file

@ -518,3 +518,11 @@ suite "develop feature":
checkpoint(output)
check exitCode == QuitSuccess
check(not output.processOutput.inLines("warning"))
test "can git clone for develop":
let cloneDir = installDir / "developTmp"
createDir(cloneDir)
cd cloneDir:
let url = "https://github.com/nimble-test/packagea.git"
let (output, exitCode) = execNimble("develop", "-y", url)
check exitCode == QuitSuccess