Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
212c881
update powershellget tests
alerickson May 1, 2023
b62da7f
update powershellget version in csproj
alerickson May 1, 2023
0c3ce58
Merge branch 'master' of https://github.com/powershell/PowerShell int…
alerickson Jun 7, 2023
20bb612
Add PSResourceGet and tests
alerickson Jun 7, 2023
0628931
Rename test files
alerickson Jun 7, 2023
a03dc1c
Update PSResourceGet tests
alerickson Jun 7, 2023
dc48c43
Remove -Force param from Uninstall-PSResource in tests
alerickson Jun 8, 2023
5b4346a
Add bom refs for PSResourceGet
alerickson Jun 8, 2023
c01272c
Modify PSGallery repo in test file
alerickson Jun 8, 2023
a916fa5
update bom
alerickson Jun 8, 2023
3272f46
Update name to 'Microsoft.PowerShell.PSResourceGet'
alerickson Jun 9, 2023
cdb9be7
Update tests
alerickson Jun 9, 2023
9850395
update psresourceget tests
alerickson Jun 14, 2023
38c6ef4
update boms
alerickson Jun 14, 2023
137714a
Update boms
alerickson Jun 14, 2023
6311f0d
update windows bom
alerickson Jun 14, 2023
e9dd899
Merge branch 'master' into upPowershellget
alerickson Jun 14, 2023
d6cabb4
update test
alerickson Jun 14, 2023
7efacce
update test
alerickson Jun 14, 2023
15cd659
Merge branch 'upPowershellget' of https://github.com/alerickson/Power…
alerickson Jun 14, 2023
c5e5055
Update powershellget test
alerickson Jun 14, 2023
f8777f8
Update psresourceget test
alerickson Jun 14, 2023
ea3feaf
Create "InstalledScriptInfos" if it doesn't exist
alerickson Jun 14, 2023
3eb94ef
write scriptinfopath
alerickson Jun 15, 2023
1ec0e01
add debugging info
alerickson Jun 15, 2023
8ec21f1
Update and clean psresourceget tests
alerickson Jun 15, 2023
6a961e4
ignore cfurrentUser test if macOS
alerickson Jun 15, 2023
99788c2
change $macOS to $IsMacOS
alerickson Jun 15, 2023
1d9a510
Change PSResourceGet bom to nonproduct
alerickson Jun 16, 2023
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
1 change: 1 addition & 0 deletions 1 src/Modules/PSGalleryModules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="PowerShellGet" Version="2.2.5" />
<PackageReference Include="PackageManagement" Version="1.4.8.1" />
<PackageReference Include="Microsoft.PowerShell.PSResourceGet" Version="0.5.22-beta22" />
<PackageReference Include="Microsoft.PowerShell.Archive" Version="1.2.5" />
<PackageReference Include="PSReadLine" Version="2.2.6" />
<PackageReference Include="ThreadJob" Version="2.0.3" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# no progress output during these tests
$ProgressPreference = "SilentlyContinue"

$RepositoryName = 'PSGallery'
$TestModule = 'newTestModule'
$TestScript = 'TestTestScript'
$Initialized = $false

#region Install locations for modules and scripts

if($IsWindows) {
$script:ProgramFilesPSPath = Microsoft.PowerShell.Management\Join-Path -Path $env:ProgramFiles -ChildPath 'PowerShell'
}
else {
$script:ProgramFilesPSPath = Split-Path -Path ([System.Management.Automation.Platform]::SelectProductNameForDirectory('SHARED_MODULES')) -Parent
}

try
{
$script:MyDocumentsFolderPath = [Environment]::GetFolderPath("MyDocuments")
}
catch
{
$script:MyDocumentsFolderPath = $null
}


if($IsWindows)
{
$script:MyDocumentsPSPath = if($script:MyDocumentsFolderPath)
{
Microsoft.PowerShell.Management\Join-Path -Path $script:MyDocumentsFolderPath -ChildPath 'PowerShell'
}
else
{
Microsoft.PowerShell.Management\Join-Path -Path $HOME -ChildPath "Documents\PowerShell"
}
}
else
{
$script:MyDocumentsPSPath = Split-Path -Path ([System.Management.Automation.Platform]::SelectProductNameForDirectory('USER_MODULES')) -Parent
}


$script:ProgramFilesModulesPath = Microsoft.PowerShell.Management\Join-Path -Path $script:ProgramFilesPSPath -ChildPath 'Modules'
$script:MyDocumentsModulesPath = Microsoft.PowerShell.Management\Join-Path -Path $script:MyDocumentsPSPath -ChildPath 'Modules'

$script:ProgramFilesScriptsPath = Microsoft.PowerShell.Management\Join-Path -Path $script:ProgramFilesPSPath -ChildPath 'Scripts'
$script:MyDocumentsScriptsPath = Microsoft.PowerShell.Management\Join-Path -Path $script:MyDocumentsPSPath -ChildPath 'Scripts'

$script:ProgramFilesScriptsInfoPath = Microsoft.PowerShell.Management\Join-Path -Path $script:ProgramFilesScriptsPath -ChildPath 'InstalledScriptInfos'
$script:MyDocumentsScriptsInfoPath = Microsoft.PowerShell.Management\Join-Path -Path $script:MyDocumentsScriptsPath -ChildPath 'InstalledScriptInfos'

if (!(Test-Path $script:ProgramFilesScriptsInfoPath)) {
New-Item -Path $script:ProgramFilesScriptsInfoPath -ItemType Directory
}

if (!(Test-Path $script:MyDocumentsScriptsPath)) {
New-Item -Path $script:MyDocumentsScriptsInfoPath -ItemType Directory
}

#endregion

#region Register a test repository

function Initialize
{
$repo = Get-PSResourceRepository $RepositoryName -ErrorAction SilentlyContinue
if($repo)
{
Set-PSResourceRepository -Name $repo.Name -Trusted
}
else
{
Register-PSResourceRepository -PSGallery -Trusted
}
}

#endregion

function Remove-InstalledModules
{
Get-InstalledPSResource -Name $TestModule -Version '*' -ErrorAction SilentlyContinue | Microsoft.PowerShell.PSResourceGet\Uninstall-PSResource
}

Describe "PSResourceGet - Module tests" -tags "Feature" {

BeforeAll {
if ($script:Initialized -eq $false) {
Initialize
$script:Initialized = $true
}
}

BeforeEach {
Remove-InstalledModules
}

It "Should find a module correctly" {
$psgetModuleInfo = Find-PSResource -Name $TestModule -Repository $RepositoryName
$psgetModuleInfo.Name | Should -Be $TestModule
$psgetModuleInfo.Repository | Should -Be $RepositoryName
}

It "Should install a module correctly to the required location with default CurrentUser scope" {
Install-PSResource -Name $TestModule -Repository $RepositoryName
$installedModuleInfo = Get-InstalledPSResource -Name $TestModule

if (!$IsMacOS) {
$installedModuleInfo | Should -Not -BeNullOrEmpty
$installedModuleInfo.Name | Should -Be $TestModule
$installedModuleInfo.InstalledLocation.StartsWith($script:MyDocumentsModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue

$module = Get-Module $TestModule -ListAvailable
$module.Name | Should -Be $TestModule
$module.ModuleBase.StartsWith($script:MyDocumentsModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
}
}

AfterAll {
Remove-InstalledModules
}
}

Describe "PSResourceGet - Module tests (Admin)" -Tags @('Feature', 'RequireAdminOnWindows', 'RequireSudoOnUnix') {

BeforeAll {
if ($script:Initialized -eq $false) {
Initialize
$script:Initialized = $true
}
}

BeforeEach {
Remove-InstalledModules
}

It "Should install a module correctly to the required location with AllUsers scope" {
Install-PSResource -Name $TestModule -Repository $RepositoryName -Scope AllUsers

$module = Get-Module $TestModule -ListAvailable
$module.Name | Should -Be $TestModule
$module.ModuleBase.StartsWith($script:programFilesModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
}

AfterAll {
Remove-InstalledModules
}
}

function Remove-InstalledScripts
{
Get-InstalledPSResource -Name $TestScript -ErrorAction SilentlyContinue | Uninstall-PSResource
}

Describe "PSResourceGet - Script tests" -tags "Feature" {

BeforeAll {
if ($script:Initialized -eq $false) {
Initialize
$script:Initialized = $true
}
}

BeforeEach {
Remove-InstalledScripts
}

It "Should find a script correctly" {
$psgetScriptInfo = Find-PSResource -Name $TestScript -Repository $RepositoryName
$psgetScriptInfo.Name | Should -Be $TestScript
$psgetScriptInfo.Repository | Should -Be $RepositoryName
}

It "Should install a script correctly to the required location with default CurrentUser scope" {
Install-PSResource -Name $TestScript -Repository $RepositoryName -Verbose
$installedScriptInfo = Get-InstalledPSResource -Name $TestScript

if (!$IsMacOS)
{
$installedScriptInfo | Should -Not -BeNullOrEmpty
$installedScriptInfo.Name | Should -Be $TestScript
$installedScriptInfo.InstalledLocation.StartsWith($script:MyDocumentsScriptsPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
}
}

AfterAll {
Remove-InstalledScripts
}
}

Describe "PSResourceGet - Script tests (Admin)" -Tags @('Feature', 'RequireAdminOnWindows', 'RequireSudoOnUnix') {

BeforeAll {
if ($script:Initialized -eq $false) {
Initialize
$script:Initialized = $true
}
}

BeforeEach {
Remove-InstalledScripts
}

It "Should install a script correctly to the required location with AllUsers scope" {
Install-PSResource -Name $TestScript -Repository $RepositoryName -Scope AllUsers
}

AfterAll {
Remove-InstalledScripts
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,10 @@ Describe "PowerShellGet - Module tests (Admin)" -Tags @('Feature', 'RequireAdmin

It "Should install a module correctly to the required location with AllUsers scope" {
Install-Module -Name $TestModule -Repository $RepositoryName -Scope AllUsers
$installedModuleInfo = Get-InstalledModule -Name $TestModule

$installedModuleInfo | Should -Not -BeNullOrEmpty
$installedModuleInfo.Name | Should -Be $TestModule
$installedModuleInfo.InstalledLocation.StartsWith($script:programFilesModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue

$module = Get-Module $TestModule -ListAvailable
$module.Name | Should -Be $TestModule
$module.ModuleBase | Should -Be $installedModuleInfo.InstalledLocation
$module.ModuleBase.StartsWith($script:programFilesModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
}

AfterAll {
Expand Down
28 changes: 28 additions & 0 deletions 28 tools/packaging/boms/linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,34 @@
"Pattern": "Modules/PSReadLine/*.txt",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/*.dll",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/*.ps?1",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/*.ps1xml",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/LICENSE",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/Notice.txt",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/_manifest/spdx_2.2/*.json*",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/_manifest/spdx_2.2/*.cat",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/ThreadJob/*.dll",
"FileType": "NonProduct"
Expand Down
28 changes: 28 additions & 0 deletions 28 tools/packaging/boms/mac.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,34 @@
"Pattern": "Modules/PSReadLine/*.txt",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/*.dll",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/*.ps?1",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/*.ps1xml",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/LICENSE",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/Notice.txt",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/_manifest/spdx_2.2/*.json*",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/PSResourceGet/_manifest/spdx_2.2/*.cat",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/ThreadJob/*.dll",
"FileType": "NonProduct"
Expand Down
32 changes: 32 additions & 0 deletions 32 tools/packaging/boms/windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,38 @@
"Pattern": "Modules/ThreadJob/*.psd1",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/_manifest/spdx_2.2/manifest.cat",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/LICENSE",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/Notice.txt",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/dependencies/*.dll",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.dll",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.psd1",
"FileType": "NonProduct"
},
{
"Pattern": "Modules/Microsoft.PowerShell.PSResourceGet/PSGet.Format.ps1xml",
"FileType": "NonProduct"
},
{
"Pattern": "mscordaccore_*.dll",
"FileType": "NonProduct"
},
{
"Pattern": "mscordaccore_*.dll",
"FileType": "NonProduct"
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.