From f3bac7faf0c6588a0b9aab48c0418f02a0d2bc9f Mon Sep 17 00:00:00 2001 From: Michael Greene Date: Fri, 29 Jul 2016 07:23:11 -0500 Subject: [PATCH] demo PowerShellGet repositories --- demos/powershellget/PowerShellGet.ps1 | 33 ++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/demos/powershellget/PowerShellGet.ps1 b/demos/powershellget/PowerShellGet.ps1 index 37bdd29690..0da9c3bf08 100644 --- a/demos/powershellget/PowerShellGet.ps1 +++ b/demos/powershellget/PowerShellGet.ps1 @@ -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 \ No newline at end of file