diff --git a/CHANGELOG.md b/CHANGELOG.md index 7387e58..82f0cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +v1.5.0 - 2017- +------------------- + +- Read additional registry URLs (semicolon separated) from DUB_REGISTRY env var - [pull #1173][issue1173] + +[issue1173]: https://github.com/dlang/dub/issues/1173 + v1.4.0 - 2017- ------------------- diff --git a/source/dub/dub.d b/source/dub/dub.d index 32c84bf..3e4802b 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -133,9 +133,11 @@ PackageSupplier[] ps = additional_package_suppliers; if (skip_registry < SkipPackageSuppliers.all) - ps ~= m_config.registryURLs + { + ps ~= (environment.get("DUB_REGISTRY", null).split(";") ~ m_config.registryURLs) .map!(url => cast(PackageSupplier)new RegistryPackageSupplier(URL(url))) .array; + } if (skip_registry < SkipPackageSuppliers.standard) ps ~= defaultPackageSuppliers(); @@ -145,6 +147,22 @@ updatePackageSearchPath(); } + unittest + { + scope (exit) environment.remove("DUB_REGISTRY"); + auto dub = new Dub(".", null, SkipPackageSuppliers.standard); + assert(dub.m_packageSuppliers.length == 0); + environment["DUB_REGISTRY"] = "http://example.com/"; + dub = new Dub(".", null, SkipPackageSuppliers.standard); + logInfo("%s", dub.m_packageSuppliers); + assert(dub.m_packageSuppliers.length == 1); + environment["DUB_REGISTRY"] = "http://example.com/;http://foo.com/"; + dub = new Dub(".", null, SkipPackageSuppliers.standard); + assert(dub.m_packageSuppliers.length == 2); + dub = new Dub(".", [new RegistryPackageSupplier(URL("http://bar.com/"))], SkipPackageSuppliers.standard); + assert(dub.m_packageSuppliers.length == 3); + } + /** Initializes the instance with a single package search path, without loading a package.