Skip to content

Commit

Permalink
Rename PowerShellGet to PSResourceGet (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasNieto committed Jul 11, 2023
1 parent 9f6d59c commit 64b5e44
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 143 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ jobs:
- name: Install AnyPackage
run: Install-Module AnyPackage -Force -AllowClobber

- name: Install PowerShellGet
run: Install-Module PowerShellGet -AllowPrerelease -Force -AllowClobber
- name: Install PSResourceGet
run: Install-Module Microsoft.PowerShell.PSResourceGet -AllowPrerelease -Force -AllowClobber

- name: Download module
uses: actions/download-artifact@v3
with:
name: module
path: AnyPackage.PowerShellGet
path: AnyPackage.PSResourceGet

- name: Move module
run: |
Expand All @@ -57,7 +57,7 @@ jobs:
$path = "$HOME/.local/share/powershell/Modules"
}
Move-Item AnyPackage.PowerShellGet $path
Move-Item AnyPackage.PSResourceGet $path
- name: Test with Pester
run: |
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Create and sign catalog file
run: |
$config = Import-PowerShellDataFile SignSettings.psd1
$config['FilePath'] = 'AnyPackage.PowerShellGet.cat'
$config['FilePath'] = 'AnyPackage.PSResourceGet.cat'
$config['Certificate'] = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert
Set-Location .\module
New-FileCatalog $config['FilePath'] -CatalogVersion 2
Expand All @@ -122,12 +122,12 @@ jobs:
uses: actions/download-artifact@v3
with:
name: module-signed
path: '~/.local/share/powershell/Modules/AnyPackage.PowerShellGet'
path: '~/.local/share/powershell/Modules/AnyPackage.PSResourceGet'

- name: Install AnyPackage
run: Install-Module AnyPackage -Force -AllowClobber

- name: Publish Module
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
run: Publish-Module -Name AnyPackage.PowerShellGet -NuGetApiKey $env:NUGET_KEY
run: Publish-Module -Name AnyPackage.PSResourceGet -NuGetApiKey $env:NUGET_KEY
6 changes: 3 additions & 3 deletions .github/workflows/lint-powershell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
- name: Install ConvertToSARIF
run: Install-Module ConvertToSARIF -Force

- name: Install PowerShellGet
run: Install-Module PowerShellGet -Force -AllowClobber -AllowPrerelease
- name: Install Microsoft.PowerShell.PSResourceGet
run: Install-Module Microsoft.PowerShell.PSResourceGet -Force -AllowClobber -AllowPrerelease

- name: Run PSScriptAnalyzer
run: |
Import-Module AnyPackage, ConvertToSARIF, PowerShellGet -PassThru
Import-Module AnyPackage, ConvertToSARIF, Microsoft.PowerShell.PSResourceGet -PassThru
Invoke-ScriptAnalyzer -Path . -Recurse | ConvertTo-SARIF -FilePath results.sarif
- name: Upload SARIF results file
Expand Down
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release

[Unreleased]: https://github.com/AnyPackage/anypackage/powershellget/compare/v0.2.4...HEAD
[0.2.4]: https://github.com/anypackage/powershellget/releases/tag/v0.2.4
[0.2.3]: https://github.com/anypackage/powershellget/releases/tag/v0.2.3
[0.2.2]: https://github.com/anypackage/powershellget/releases/tag/v0.2.2
[0.2.1]: https://github.com/anypackage/powershellget/releases/tag/v0.2.1
[0.2.0]: https://github.com/anypackage/powershellget/releases/tag/v0.2.0
[0.1.0]: https://github.com/anypackage/powershellget/releases/tag/v0.1.0
[Unreleased]: https://github.com/AnyPackage/anypackage/psresourceget/compare/v0.2.4...HEAD
[0.2.4]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.4
[0.2.3]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.3
[0.2.2]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.2
[0.2.1]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.1
[0.2.0]: https://github.com/anypackage/psresourceget/releases/tag/v0.2.0
[0.1.0]: https://github.com/anypackage/psresourceget/releases/tag/v0.1.0
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# AnyPackage.PowerShellGet
# AnyPackage.PSResourceGet

AnyPackage.PowerShellGet is an AnyPackage provider that facilitates installing PowerShellGet v3 resources from NuGet repositories.
AnyPackage.PSResourceGet is an AnyPackage provider that facilitates installing PSResourceGet resources from NuGet repositories.

## Documentation

AnyPackage.PowerShellGet documentation is located in [Provider Catalog](https://www.anypackage.dev/docs/provider-catalog/powershellget/about_PowerShellGet_Provider) on how to use the provider and what dynamic parameters exist.
AnyPackage.PSResourceGet documentation is located in [Provider Catalog](https://www.anypackage.dev/docs/provider-catalog/psresourceget/about_PSResourceGet_Provider) on how to use the provider and what dynamic parameters exist.

## Install AnyPackage.PowerShellGet
## Install AnyPackage.PSResourceGet

> NOTE! PowerShellGet v3 is required.
Due to a PowerShellGet issue, prerelease modules cannot be defined as dependencies, so manual installation of PowerShellGet v3 is required.
> NOTE! Microsoft.PowerShell.PSResourceGet is required.
Due to a PSResourceGet issue, prerelease modules cannot be defined as dependencies, so manual installation of PSResourceGet is required.

```PowerShell
# Install PowerShellGet v3
Install-Module PowerShellGet -AllowPrerelease -AllowClobber -Force
# Install Microsoft.PowerShell.PSResourceGet
Install-Module Microsoft.PowerShell.PSResourceGet -AllowPrerelease -AllowClobber -Force
Install-Module AnyPackage.PowerShellGet
Install-Module AnyPackage.PSResourceGet
```

## Import AnyPackage.PowerShellGet
## Import AnyPackage.PSResourceGet

```PowerShell
Import-Module AnyPackage.PowerShellGet
Import-Module AnyPackage.PSResourceGet
```

## Sample usages
Expand Down Expand Up @@ -81,7 +81,7 @@ Publish-Package -Path C:\Temp\module\module.psd1
### Manage official package sources

```PowerShell
Register-PackageSource -Provider PowerShellGet -PSGallery
Register-PackageSource -Provider PSResourceGet -PSGallery
Find-Package -Name Scoop | Install-Package
Unregister-PackageSource -Name PSGallery
```
Expand All @@ -96,7 +96,7 @@ Unregister-PackageSource -Name Test

## Known Issues

### Missing PowerShellGet parameters
### Missing PSResourceGet parameters

There are a few missing dynamic parameters:

Expand Down
2 changes: 1 addition & 1 deletion SignSettings.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
FilePath = @('AnyPackage.PowerShellGet.psd1', 'AnyPackage.PowerShellGet.psm1')
FilePath = @('AnyPackage.PSResourceGet.psd1', 'AnyPackage.PSResourceGet.psm1')
TimeStampServer = 'http://timestamp.sectigo.com'
HashAlgorithm = 'SHA256'
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
@{
RootModule = 'AnyPackage.PowerShellGet.psm1'
RootModule = 'AnyPackage.PSResourceGet.psm1'
ModuleVersion = '0.2.4'
CompatiblePSEditions = @('Desktop', 'Core')
GUID = 'cc680200-a0c8-40df-a004-64c3899a72c9'
GUID = '4ffeffd3-7f83-4655-ac94-19eb41ebc792'
Author = 'Thomas Nieto'
Copyright = '(c) 2023 Thomas Nieto. All rights reserved.'
Description = 'PowerShellGet provider for AnyPackage.'
Description = 'PSResourceGet provider for AnyPackage.'
PowerShellVersion = '5.1'
RequiredModules = @(
@{ ModuleName = 'AnyPackage'; ModuleVersion = '0.5.1' },
'PowerShellGet')
'Microsoft.PowerShell.PSResourceGet')
FunctionsToExport = @()
CmdletsToExport = @()
AliasesToExport = @()
PrivateData = @{
AnyPackage = @{
Providers = 'PowerShellGet'
Providers = 'PSResourceGet'
}
PSData = @{
Tags = @('AnyPackage', 'Provider', 'PowerShellGet', 'Windows', 'Linux', 'MacOS')
LicenseUri = 'https://github.com/anypackage/powershellget/blob/main/LICENSE'
ProjectUri = 'https://github.com/anypackage/powershellget'
Tags = @('AnyPackage', 'Provider', 'PSResourceGet', 'Windows', 'Linux', 'MacOS')
LicenseUri = 'https://github.com/anypackage/psresourceget/blob/main/LICENSE'
ProjectUri = 'https://github.com/anypackage/psresourceget'
}
}
HelpInfoUri = 'https://go.anypackage.dev/help'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# terms of the MIT license.

using module AnyPackage
using module PowerShellGet
using module Microsoft.PowerShell.PSResourceGet

using namespace System.Collections.Generic
using namespace AnyPackage.Provider
using namespace Microsoft.PowerShell.PowerShellGet.UtilClasses
using namespace Microsoft.PowerShell.PSResourceGet.UtilClasses

[PackageProvider('PowerShellGet')]
class PowerShellGetProvider : PackageProvider, IGetPackage, IFindPackage,
[PackageProvider('PSResourceGet')]
class PSResourceGetProvider : PackageProvider, IGetPackage, IFindPackage,
IInstallPackage, ISavePackage, IUninstallPackage,
IUpdatePackage, IPublishPackage, IGetSource, ISetSource {
#region GetPackage
Expand All @@ -27,7 +27,7 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource {
$request.DynamicParameters |
ConvertTo-Hashtable -Hashtable $params -IsBound

Get-PSResource @params |
Get-InstalledPSResource @params |
Write-Package -Request $request
}
#endregion
Expand Down Expand Up @@ -134,11 +134,11 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource {
ConvertTo-Hashtable -Hashtable $uninstallParams -IsBound

# Issue to get PassThru parameter added
# https://github.com/PowerShell/PowerShellGet/issues/667
# https://github.com/PowerShell/PSResourceGet/issues/667

# Prerelease parameter causes it to silently fail
# https://github.com/PowerShell/PowerShellGet/issues/842
Get-PSResource @params |
# https://github.com/PowerShell/PSResourceGet/issues/842
Get-InstalledPSResource @params |
ForEach-Object {
try {
$_ | Uninstall-PSResource @uninstallParams -ErrorAction Stop
Expand Down Expand Up @@ -171,8 +171,8 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource {
ConvertTo-Hashtable -Hashtable $updateParams -IsBound

# Find-PSResource pipeline input
# https://github.com/PowerShell/PowerShellGet/issues/666
Get-PSResource -Name $request.Name -ErrorAction SilentlyContinue |
# https://github.com/PowerShell/PSResourceGet/issues/666
Get-InstalledPSResource -Name $request.Name -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty Name -Unique |
Find-PSResource @params -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty Name -Unique |
Expand All @@ -196,7 +196,7 @@ IUpdatePackage, IPublishPackage, IGetSource, ISetSource {

try {
# PassThru parameter
# https://github.com/PowerShell/PowerShellGet/issues/718
# https://github.com/PowerShell/PSResourceGet/issues/718
Publish-PSResource @params -ErrorAction Stop

$params.Remove('Path')
Expand Down Expand Up @@ -359,19 +359,19 @@ class InstallPackageDynamicParameters : InstallUpdateDynamicParameters {
[switch] $Reinstall

# Install-PSResource -NoClobber fails
# https://github.com/PowerShell/PowerShellGet/issues/946
# https://github.com/PowerShell/PSResourceGet/issues/946
# [Parameter()]
# [switch] $NoClobber
}

class SavePackageDynamicParameters : InstallDynamicParameters {
# Pipeline input fails with -AsNupkg
# https://github.com/PowerShell/PowerShellGet/issues/948
# https://github.com/PowerShell/PSResourceGet/issues/948
# [Parameter()]
# [switch] $AsNupkg

# Pipeline input fails with -IncludeXml
# https://github.com/PowerShell/PowerShellGet/issues/949
# https://github.com/PowerShell/PSResourceGet/issues/949
# [Parameter()]
# [switch] $IncludeXml
}
Expand Down Expand Up @@ -403,7 +403,7 @@ class RegisterPackageSourceDynamicParameters : SetPackageSourceDynamicParameters
}

[guid] $id = 'c9a39544-274b-4935-9cad-7423e8c47e6b'
[PackageProviderManager]::RegisterProvider($id, [PowerShellGetProvider], $MyInvocation.MyCommand.ScriptBlock.Module)
[PackageProviderManager]::RegisterProvider($id, [PSResourceGetProvider], $MyInvocation.MyCommand.ScriptBlock.Module)

$MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
[PackageProviderManager]::UnregisterProvider($id)
Expand Down Expand Up @@ -476,7 +476,7 @@ function Get-Latest {
$resources |
Group-Object -Property Name |
ForEach-Object {
# PowerShellGet returns the latest as the first object
# PSResourceGet returns the latest as the first object
$_.Group | Select-Object -First 1
}
}
Expand Down Expand Up @@ -520,7 +520,7 @@ function Write-Package {
)

begin {
$sources = Get-PackageSource -Provider AnyPackage.PowerShellGet\PowerShellGet
$sources = Get-PackageSource -Provider AnyPackage.PSResourceGet\PSResourceGet
}

process {
Expand All @@ -537,7 +537,7 @@ function Write-Package {
Where-Object Name -eq $resource.Repository

# Blank RepositorySourceLocation
# https://github.com/PowerShell/PowerShellGet/issues/1052
# https://github.com/PowerShell/PSResourceGet/issues/1052
if (-not $source -and $resource.RepositorySourceLocation) {
$source = [PackageSourceInfo]::new($resource.Repository, $resource.RepositorySourceLocation, $false, $Request.ProviderInfo)
}
Expand Down
12 changes: 6 additions & 6 deletions test/Find-Package.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#requires -modules AnyPackage.PowerShellGet
#requires -modules AnyPackage.PSResourceGet

Describe Find-Package {
Context 'with -Name parameter' {
It 'should return results for <_>' -TestCases 'PSReadline', @('PSReadline', 'PowerShellGet'), 'AnyPackage*' {
It 'should return results for <_>' -TestCases 'PSReadLine', @('PSReadLine', 'Microsoft.PowerShell.Archive'), 'AnyPackage*' {
$resources = Find-PSResource -Name $_
$results = Find-Package -Name $_

Expand Down Expand Up @@ -64,17 +64,17 @@ Describe Find-Package {

Context 'with -Prerelease parameter' {
It 'should return prerelease versions' {
Find-Package -Name PowerShellGet -Version * -Prerelease |
Find-Package -Name PSReadLine -Version * -Prerelease |
Where-Object { $_.Version.IsPrerelease } |
Should -Not -BeNullOrEmpty
}
}

Context 'with -Latest parameter' {
It 'should return latest version for <_> version range' -TestCases '[1.0,2.0]' {
$resource = Find-PSResource -Name PowerShellGet -Version $_ |
It 'should return latest version for <_> version range' -TestCases '[2.0,2.2]' {
$resource = Find-PSResource -Name PSReadLine -Version $_ |
Select-Object -First 1
$package = Find-Package -Name PowerShellGet -Version $_ -Provider PowerShellGet -Latest
$package = Find-Package -Name PSReadLine -Version $_ -Provider PSResourceGet -Latest

$package.Version.ToString() | Should -Be $resource.Version.ToString()
}
Expand Down
10 changes: 4 additions & 6 deletions test/Get-Package.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#requires -modules AnyPackage.PowerShellGet

using namespace NuGet.Versioning
#requires -modules AnyPackage.PSResourceGet

Describe Get-Package {
BeforeAll {
Expand All @@ -21,7 +19,7 @@ Describe Get-Package {

Context 'with -Name parameter' {
It 'should return results for <_>' -TestCases 'SNMP', @('PSWindowsUpdate', 'DellBIOSProvider'), '*win*' {
$resources = Get-PSResource -Name $_
$resources = Get-InstalledPSResource -Name $_
$results = Get-Package -Name $_

$results | Should -Not -BeNullOrEmpty
Expand All @@ -34,7 +32,7 @@ Describe Get-Package {
}

It 'should have correct properties for <_>' -TestCases 'SNMP' {
$resource = Get-PSResource -Name $_
$resource = Get-InstalledPSResource -Name $_
$package = Get-Package -Name $_

if ($resource.Prerelease) {
Expand Down Expand Up @@ -67,7 +65,7 @@ Describe Get-Package {
'(0.2.0,0.3.0]',
'(0.2.0,0.3.0)',
'[0.2.0,0.3.0)' {
$resources = Get-PSResource -Name Cobalt -Version $_
$resources = Get-InstalledPSResource -Name Cobalt -Version $_

Get-Package -Name Cobalt -Version $_ |
Should -HaveCount $resources.Count
Expand Down
4 changes: 2 additions & 2 deletions test/Get-PackageSource.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#requires -modules AnyPackage.PowerShellGet
#requires -modules AnyPackage.PSResourceGet

Describe Get-PackageSource {
BeforeAll {
Expand All @@ -11,7 +11,7 @@ Describe Get-PackageSource {
Unregister-PSResourceRepository -Name Test
}

Context 'with no additonal parameters' {
Context 'with no additional parameters' {
It 'should return results' {
Get-PackageSource |
Should -Not -BeNullOrEmpty
Expand Down
Loading

0 comments on commit 64b5e44

Please sign in to comment.