Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename PowerShellGet to PSResourceGet #30

Merged
merged 25 commits into from
Jul 11, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
5 changes: 1 addition & 4 deletions .github/workflows/lint-powershell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ jobs:
- name: Install ConvertToSARIF
run: Install-Module ConvertToSARIF -Force

- name: Install PowerShellGet
run: Install-Module PowerShellGet -Force -AllowClobber -AllowPrerelease

- name: Run PSScriptAnalyzer
run: |
Import-Module AnyPackage, ConvertToSARIF, PowerShellGet -PassThru
Import-Module AnyPackage, ConvertToSARIF -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
Fixed Show fixed Hide fixed

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 Down Expand Up @@ -134,10 +134,10 @@
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
# https://github.com/PowerShell/PSResourceGet/issues/842
Get-PSResource @params |
ForEach-Object {
try {
Expand Down Expand Up @@ -171,7 +171,7 @@
ConvertTo-Hashtable -Hashtable $updateParams -IsBound

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

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 @@
[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 @@
}

[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 @@
$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 @@
)

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

process {
Expand All @@ -537,7 +537,7 @@
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
10 changes: 5 additions & 5 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 Microsoft.PowerShell.Archive -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 $_ |
$resource = Find-PSResource -Name Microsoft.PowerShell.Archive -Version $_ |
Select-Object -First 1
$package = Find-Package -Name PowerShellGet -Version $_ -Provider PowerShellGet -Latest
$package = Find-Package -Name Microsoft.PowerShell.Archive -Version $_ -Provider PSResourceGet -Latest

$package.Version.ToString() | Should -Be $resource.Version.ToString()
}
Expand Down
4 changes: 1 addition & 3 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 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