Skip to content

Commit

Permalink
cleaned up new gallery more
Browse files Browse the repository at this point in the history
  • Loading branch information
james-garriss committed Jul 29, 2024
1 parent f0e643a commit cc2c3f6
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions utils/workflow/Publish-ScubaGear.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function New-PrivateGallery {
$Trusted
)

Write-Output "Creating new private gallery..."
Write-Output "Registering a new private gallery..."
$GalleryPath = Join-Path -Path $GalleryRootPath -ChildPath $GalleryName
if (Test-Path $GalleryPath) {
Write-Output "Removing private gallery at $GalleryPath"
Expand All @@ -37,7 +37,7 @@ function New-PrivateGallery {

New-Item -Path $GalleryPath -ItemType Directory

$Registered = $false
$AlreadyRegistered = $false
try {
$Registered = (Get-PSRepository).Name -contains $GalleryName
}
Expand All @@ -47,20 +47,21 @@ function New-PrivateGallery {
exit 1
}

if (-not $Registered) {
Write-Output "Attempting to register $GalleryName repository"
$Parameters = @{
Name = $GalleryName
SourceLocation = $GalleryPath
PublishLocation = $GalleryPath
InstallationPolicy = if ($Trusted) { 'Trusted' } else { 'Untrusted' }
}
Register-PSRepository @Parameters
if ($AlreadyRegistered) {
Write-Error "Private gallery was not created because $GalleryName is already registered."
Write-Error "To unregister: `nUnregister-PSRepository -Name $GalleryName"
exit 1
}
else {
Write-Output "Private gallery was not created because $GalleryName is already registered."
Write-Output "To unregister: `nUnregister-PSRepository -Name $GalleryName"

Write-Output "Attempting to register $GalleryName..."
$Parameters = @{
Name = $GalleryName
SourceLocation = $GalleryPath
PublishLocation = $GalleryPath
InstallationPolicy = if ($Trusted) { 'Trusted' } else { 'Untrusted' }
}
Register-PSRepository @Parameters
Write-Output "The gallery was registered..."
}

function Publish-ScubaGearModule {
Expand Down

0 comments on commit cc2c3f6

Please sign in to comment.