From 7e3058657c4ff3ca70288595fc2a21f791c50f7c Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Fri, 23 Feb 2018 22:43:28 +0000 Subject: [PATCH] Fixes problem with subdirs and 'develop'. Documents package urls. --- readme.markdown | 16 ++++++++++++++-- src/nimble.nim | 2 +- tests/tester.nim | 5 +++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/readme.markdown b/readme.markdown index e1c80c9..c414684 100644 --- a/readme.markdown +++ b/readme.markdown @@ -183,8 +183,17 @@ the current working directory. This can be useful for developers who are testing locally their ``.nimble`` files before submitting them to the official package list. See the [Creating Packages](#creating-packages) section for more info on this. -A URL to a repository can also be specified, Nimble will automatically detect -the type of the repository that the url points to and install it. +#### Package URLs + +A valid URL to a Git or Merurial repository can also be specified, Nimble will +automatically detect the type of the repository that the url points to and +install it. + +For repositories containing the Nimble package in a subdirectory, you can +instruct Nimble about the location of your package using the ``?subdir=`` +query parameter. For example: + + $ nimble install https://github.com/nimble-test/multi?subdir=alpha ### nimble develop @@ -206,6 +215,9 @@ current working directory. The ``jester`` package will be cloned into ``./jester`` and it will be linked to your installation directory. +Just as with the ``install`` command, a package URL may also be specified +instead of a name. + ### nimble uninstall The ``uninstall`` command will remove an installed package. Attempting to remove diff --git a/src/nimble.nim b/src/nimble.nim index edb3b3d..f51f7fd 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -1012,7 +1012,7 @@ proc develop(options: Options) = let (meth, url, metadata) = getDownloadInfo(pv, options, true) let subdir = metadata.getOrDefault("subdir") discard downloadPkg(url, pv.ver, meth, subdir, options, downloadDir) - developFromDir(downloadDir, options) + developFromDir(downloadDir / subdir, options) proc test(options: Options) = ## Executes all tests. diff --git a/tests/tester.nim b/tests/tester.nim index c907348..f94ec45 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -679,4 +679,9 @@ suite "check command": suite "multi": test "can install package from git subdir": let args = ["install", "-y", "https://github.com/nimble-test/multi?subdir=alpha"] + check execNimble(args).exitCode == QuitSuccess + + test "can develop package from git subdir": + removeDir("nimble-test/multi") + let args = ["develop", "-y", "https://github.com/nimble-test/multi?subdir=beta"] check execNimble(args).exitCode == QuitSuccess \ No newline at end of file