From 50d0b76d60f849d3926c18e82f4082db5949533b Mon Sep 17 00:00:00 2001 From: Miodrag Milic Date: Tue, 15 May 2018 21:45:18 +0200 Subject: [PATCH] use au_GalleryUrl if provided when checking package existence closes #95 --- AU/Public/Update-Package.ps1 | 3 ++- CHANGELOG.md | 4 +++- README.md | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AU/Public/Update-Package.ps1 b/AU/Public/Update-Package.ps1 index 328ca69f..8286a660 100644 --- a/AU/Public/Update-Package.ps1 +++ b/AU/Public/Update-Package.ps1 @@ -223,7 +223,8 @@ function Update-Package { $script:is_forced = $false if ([AUVersion] $Latest.Version -gt [AUVersion] $Latest.NuspecVersion) { if (!($NoCheckChocoVersion -or $Force)) { - $choco_url = "https://chocolatey.org/packages/{0}/{1}" -f $global:Latest.PackageName, $package.RemoteVersion + if ( !$au_GalleryUrl ) { $au_GalleryUrl = 'https://chocolatey.org' } + $choco_url = "$au_GalleryUrl/packages/{0}/{1}" -f $global:Latest.PackageName, $package.RemoteVersion try { request $choco_url $Timeout | out-null "New version is available but it already exists in the Chocolatey community feed (disable using `$NoCheckChocoVersion`):`n $choco_url" | result diff --git a/CHANGELOG.md b/CHANGELOG.md index a985be42..111adda1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # AU Project Changelog ## Next -- `Update-Package`: Now you can pass HTTP/HTTPS headers to `$Latest.Options.Headers` to avoid `Unauthorized` errors while checking URLs. +- `Update-Package`: + - Now you can pass HTTP/HTTPS headers to `$Latest.Options.Headers` to avoid `Unauthorized` errors while checking URLs. + - Package Gallery URL is no longer hard-coded but taken from the `$au_GalleryUrl` if it exists ([#95](https://github.com/majkinetor/au/issues/95)) - `Update-AUPackages`: Added `NoCheckChocoVersion` option. - Plugins: - `Git`: Added `Branch` parameter to specify a branch name diff --git a/README.md b/README.md index 2e80ea59..f5f7022b 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,8 @@ This is the same as if you added the parameters to `update` function inside the however, its way easier to setup global variable with manual intervention on multiple packages. +There is also a special variable `$au_GalleryUrl` using which you can change the URL that is used to check if package is already pushed. It defaults to https://chocolatey.org and you can change it if you need to this option for 3rd party or internal package repositories. + ### Reusing the AU updater with metapackages Metapackages can reuse an AU updater of its dependency by the following way: