demo PowerShellGet repositories

This commit is contained in:
Michael Greene
2016-07-29 07:23:11 -05:00
parent d5f3fd3f83
commit f3bac7faf0
+32 -1
View File
@@ -31,16 +31,25 @@ Uninstall-Script Fabrikam-Script -Verbose
#endregion
#region Using PowerShellGet find and install other demos
#region Using PowerShellGet find and install modules
# Value: equivalent of pypi
# Look for all the modules we'll be demoing today
Find-Module -Tag 'PowerShellCore_Demo'
# Save module to specified location
Save-Module -Tag 'PowerShellCore_Demo' -Path /tmp
# Pipe this to Install-Module to install them
Find-Module -Tag 'PowerShellCore_Demo' | Install-Module -Verbose
Get-InstalledModule
# Update all installed modules
Update-Module
#endregion
#region Using PowerShellGet with tags
# Look for all the scripts we'll be demoing today
Find-Script -Tag 'PowerShellCore_Demo'
@@ -50,3 +59,25 @@ Find-Script -Tag 'PowerShellCore_Demo' | Install-Script -Verbose
Get-InstalledScript
#endregion
#region Working with PowerShellGet repositories
# List available PS repositories
Get-PSRepository
# Publish script to the PS Gallery
Publish-Script -Path C:\Demo.ps1 -NuGetApiKey 1234 -Repository PSGallery -WhatIf
# Publish module to PS Gallery
Publish-Module -Name Demo -RequiredVersion 0.1 -NuGetApiKey 1234 -Repository PSGallery -WhatIf
# Register a new private feed
Register-PSRepository -Name "myPrivateGallery" –SourceLocation "https://www.myget.org/F/powershellgetdemo/api/v2" -PublishLocation "https://www.myget.org/F/powershellgetdemo/api/v2/Packages" -InstallationPolicy Trusted
# Change the trust level for a repositories
Set-PSRepository -Name "myPrivateGallery" -InstallationPolicy "Untrusted"
# Remove a private feed
Unregister-PSRepository -Name "myPrivateGallery"
#endregion