Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Gallery package root url #255

Merged
merged 4 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
implement au_GalleryPackageRootUrl variable
  • Loading branch information
danmetzler committed Dec 17, 2021
commit 793f9c7c90c00ae1167787bdf85a1303014fd859
7 changes: 5 additions & 2 deletions AU/Public/Update-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,11 @@ function Update-Package {
$script:is_forced = $false
if ([AUVersion] $Latest.Version -gt [AUVersion] $Latest.NuspecVersion) {
if (!($NoCheckChocoVersion -or $Force)) {
if ( !$au_GalleryUrl ) { $au_GalleryUrl = 'https://chocolatey.org' }
$choco_url = "$au_GalleryUrl/packages/{0}/{1}" -f $global:Latest.PackageName, $package.RemoteVersion
if ( !$au_GalleryPackageRootUrl ) {
if ( $au_GalleryUrl ) { $au_GalleryPackageRootUrl = "$au_GalleryUrl/packages" }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$au_GalleryPackageRootUrl = if ($au_GalleryUrl) { "$au_GalleryUrl/packages" } else { 'https://chocolatey.org/packages' }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed your cleaner update. Thanks.

else { $au_GalleryPackageRootUrl = 'https://chocolatey.org/packages' }
}
$choco_url = "$au_GalleryPackageRootUrl/{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
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ 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.
There is also a special variable `$au_GalleryPackageRootUrl` that can be added to `update.ps1` to change the URL that is used to check if package is already pushed. It defaults to https://chocolatey.org/packages and you can change it if you need to this option for 3rd party or internal package repositories.

> Note: The `$au_GalleryUrl` variable was replaced by `$au_GalleryPackageRootUrl`. The `$au_GalleryUrl` will still work for compatibility, but makes assumptions about the URL that may not work for some repositories.

### Reusing the AU updater with metapackages

Expand Down