diff --git a/source/dub/dub.d b/source/dub/dub.d index ebfd72e..a06888f 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -610,26 +610,27 @@ if (m_dryRun) return; string[string] depVers; + string[] notFound; // keep track of any failed packages in here foreach(ps; this.m_packageSuppliers){ foreach(dep; deps){ try{ auto versionStrings = ps.getVersions(dep); depVers[dep] = versionStrings[$-1].toString; } catch(Exception e){ - import std.range : take; - logError("Package '%s' was not found", dep); - auto candidates = ps.getPackageNames() - .fuzzySearch(dep) - .take(4); - if(candidates.length > 1) - logInfo("Did you mean one of: %-(%s%|, %)?", candidates); - else if(candidates.length == 1) - logInfo("Did you mean %s?", candidates.front); - return; + notFound ~= dep; } } } - initPackage(path, depVers, type); + if(notFound.length > 1){ + logError("Couldnt find packages: %-(%s, %). Exiting...", notFound); + return; + } + else if(notFound.length == 1){ + logError("Couldnt find package: %-(%s, %). Exiting...", notFound); + return; + } + + initPackage(path, depVers, type); //Act smug to the user. logInfo("Successfully created an empty project in '%s'.", path.toNativeString()); diff --git a/source/dub/packagesupplier.d b/source/dub/packagesupplier.d index c087713..1f3e758 100644 --- a/source/dub/packagesupplier.d +++ b/source/dub/packagesupplier.d @@ -42,8 +42,6 @@ /// perform cache operation void cacheOp(Path cacheDir, CacheOp op); - /// get all package names for this supplier - string[] getPackageNames(); } /// operations on package supplier cache @@ -95,10 +93,6 @@ void cacheOp(Path cacheDir, CacheOp op) { } - string[] getPackageNames(){ - assert(false, "FileSystemPackageSupplier.getPackageNames, not implemented yet"); - } - private Path bestPackageFile(string packageId, Dependency dep, bool pre_release) { Path toPath(Version ver) { @@ -161,17 +155,6 @@ return getBestPackage(packageId, dep, pre_release); } - string[] getPackageNames(){ - import std.array : replace; - auto url = m_registryUrl ~ Path(PackagesPath~"/index.json"); - Json data = (cast(string)download(url)).parseJsonString(); - string[] packages; - foreach(ele; data){ - packages ~= ele.toString().replace("\"", ""); - } - return packages; - } - void cacheOp(Path cacheDir, CacheOp op) { auto path = cacheDir ~ cacheFileName; diff --git a/test/0-init-fail/0-init-multi b/test/0-init-fail/0-init-multi deleted file mode 120000 index ae4cc8d..0000000 --- a/test/0-init-fail/0-init-multi +++ /dev/null @@ -1 +0,0 @@ -/home/colin/workspace/dub/test/0-init-fail/.dub/build/application-unittest-linux.posix-x86_64-dmd_2066-BD50D2FB8B6166C4598C63A62DB03A99/0-init-multi \ No newline at end of file