mirror of
https://github.com/rgl/nexus-vagrant.git
synced 2026-09-30 00:31:11 +02:00
install psresourceget 1.2.0
This commit is contained in:
Vendored
+3
-1
@@ -48,8 +48,10 @@ Vagrant.configure(2) do |config|
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-base.ps1', nexus_domain]
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-chocolatey.ps1']
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-powershellget.ps1']
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-psresourceget.ps1']
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-chocolatey-repository.ps1', nexus_domain]
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-powershell-repository.ps1', nexus_domain]
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-powershell-repository-powershellget.ps1', nexus_domain]
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-powershell-repository-psresourceget.ps1', nexus_domain]
|
||||
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-npm-repository.ps1', nexus_domain]
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# install PSResourceGet (previously known as PowerShellGet 3.x).
|
||||
# see https://learn.microsoft.com/en-us/powershell/gallery/powershellget/install-powershellget?view=powershellget-3.x
|
||||
# see https://github.com/PowerShell/PSResourceGet
|
||||
|
||||
# see https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
|
||||
# renovate: datasource=nuget:powershellgallery depName=Microsoft.PowerShell.PSResourceGet
|
||||
$psResourceGetModuleVersion = '1.2.0'
|
||||
Write-Host "Installing PSResourceGet $psResourceGetModuleVersion..."
|
||||
Install-Module `
|
||||
-Repository PSGallery `
|
||||
-Name Microsoft.PowerShell.PSResourceGet `
|
||||
-RequiredVersion $psResourceGetModuleVersion `
|
||||
-Force
|
||||
@@ -0,0 +1,66 @@
|
||||
param(
|
||||
[string]$nexusDomain = 'nexus.example.com'
|
||||
)
|
||||
|
||||
Write-Host 'Default PSResourceGet repositories:'
|
||||
Get-PSResourceRepository
|
||||
|
||||
Write-Host "Unregistering the default PSResourceGet sources..."
|
||||
Get-PSResourceRepository | Unregister-PSResourceRepository
|
||||
|
||||
Write-Host 'Configuring PSResourceGet to only use the nexus server...'
|
||||
Register-PSResourceRepository `
|
||||
-Name nexus `
|
||||
-Uri https://$nexusDomain/repository/powershell-hosted/index.json `
|
||||
-ApiVersion V3 `
|
||||
-Trusted
|
||||
|
||||
Write-Host 'Current PSResourceGet repositories:'
|
||||
Get-PSResourceRepository
|
||||
|
||||
Write-Host 'Publishing the ExampleGreeter module into the nexus server...'
|
||||
Set-Location $env:TEMP
|
||||
mkdir ExamplePSResourceGreeter | Out-Null
|
||||
Push-Location ExamplePSResourceGreeter
|
||||
Set-Content `
|
||||
-Encoding Ascii `
|
||||
ExamplePSResourceGreeter.psm1 `
|
||||
@'
|
||||
function Write-ExamplePSResourceGreeting([string]$name) {
|
||||
"Hello $name!"
|
||||
}
|
||||
'@
|
||||
New-ModuleManifest `
|
||||
ExamplePSResourceGreeter.psd1 `
|
||||
-ModuleVersion '1.0.0' `
|
||||
-Author 'John Doe' `
|
||||
-Description 'The Classic Hello World' `
|
||||
-LicenseUri 'https://opensource.org/licenses/MIT' `
|
||||
-ProjectUri 'https://example.com/ExamplePSResourceGreeter' `
|
||||
-RootModule 'ExamplePSResourceGreeter.psm1' `
|
||||
-Tags `
|
||||
hello,
|
||||
example `
|
||||
-FunctionsToExport `
|
||||
Write-ExamplePSResourceGreeting `
|
||||
-CmdletsToExport @() `
|
||||
-VariablesToExport @() `
|
||||
-AliasesToExport @()
|
||||
Test-ModuleManifest ExamplePSResourceGreeter.psd1
|
||||
Publish-PSResource `
|
||||
-Repository nexus `
|
||||
-ApiKey (Get-Content c:\vagrant\shared\jenkins-nuget-api-key) `
|
||||
-Path .
|
||||
Pop-Location
|
||||
|
||||
Write-Host 'Installing and using the ExamplePSResourceGreeter module...'
|
||||
Install-PSResource ExamplePSResourceGreeter
|
||||
Get-PSResource ExamplePSResourceGreeter | Format-List
|
||||
Get-Module ExamplePSResourceGreeter -ListAvailable | Format-List
|
||||
|
||||
Write-Host 'Using the ExamplePSResourceGreeter module...'
|
||||
Import-Module ExamplePSResourceGreeter
|
||||
Write-ExamplePSResourceGreeting 'World'
|
||||
|
||||
Write-Host 'Uninstalling the ExamplePSResourceGreeter module...'
|
||||
Uninstall-PSResource ExamplePSResourceGreeter
|
||||
Reference in New Issue
Block a user