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 all commits
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
6 changes: 4 additions & 2 deletions AU/Public/Update-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ 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 ) {
$au_GalleryPackageRootUrl = if ($au_GalleryUrl) { "$au_GalleryUrl/packages" } else { '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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# AU Project Changelog

## NEXT

- Added `$au_GalleryPackageRootUrl` as a slightly more flexible alternative to `$au_GalleryUrl` ([#250](https://github.com/majkinetor/au/pull/255))
- `$au_GalleryUrl` is still maintained for compatibility

## 2021.7.18

- Fixed bad packaging of previous version
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 this option for 3rd party or internal package repositories.

> Note: The `$au_GalleryUrl` variable also performs this function, but `$au_GalleryPackageRootUrl` allows more flexibility for 3rd party package repositories. The `$au_GalleryUrl` will still work for compatibility, but makes assumptions about the URL that may not work in all situations.

### Reusing the AU updater with metapackages

Expand Down