From 1a2c8a650ccd16b18c4f57dc2dfb281c069e54ce Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Tue, 26 Jul 2016 15:54:31 -0700 Subject: [PATCH] Moving the PowerShellGet.ps1 into Demos\PowerShellGet folder. Moving the PowerShellGet.ps1 into Demos\PowerShellGet folder. --- demos/1-PowerShellGet.ps1 | 24 --------- demos/PowerShellGet.ps1 | 72 --------------------------- demos/powershellget/PowerShellGet.ps1 | 52 +++++++++++++++++++ demos/powershellget/README.md | 5 ++ 4 files changed, 57 insertions(+), 96 deletions(-) delete mode 100644 demos/1-PowerShellGet.ps1 delete mode 100644 demos/PowerShellGet.ps1 create mode 100644 demos/powershellget/PowerShellGet.ps1 create mode 100644 demos/powershellget/README.md diff --git a/demos/1-PowerShellGet.ps1 b/demos/1-PowerShellGet.ps1 deleted file mode 100644 index aeebd09e7c..0000000000 --- a/demos/1-PowerShellGet.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -#region Package Management - -## List available package provider -Get-PackageProvider #(should show 2 providers - NuGet,PowerShellGet) - -## Using PowerShellGet find and install other demos -# Value: equivalent of pypi -# Look for all the modules we'll be demoing today -Find-Module -Tag 'PSEdition_PowerShellCore','Demos' -# Pipe this to Install-Module to install them -Find-Module -Tag 'PSEdition_PowerShellCore','Demos' | Install-Module -Verbose -Get-Module -# Note that ScriptAnalyzer gets installed because the VSCode demo is dependent upon it - -# Register trusted endpoints -Register-PackageSource -Name NuGet -Location http://nuget.org/api/v2 -Trusted -ProviderName NuGet - -# Finding and installing becomes very easy -Find-Package -Name jQuery -Verbose | Install-Package -Verbose - -# Discover installed packages -Get-Package -ProviderName NuGet - -#endregion diff --git a/demos/PowerShellGet.ps1 b/demos/PowerShellGet.ps1 deleted file mode 100644 index 873e9a66f6..0000000000 --- a/demos/PowerShellGet.ps1 +++ /dev/null @@ -1,72 +0,0 @@ -#region cleanup -Get-InstalledModule PSScriptAnalyzer -AllVersions -ErrorAction SilentlyContinue | Uninstall-Module -Get-InstalledModule xJea -AllVersions -ErrorAction SilentlyContinue | Uninstall-Module -Get-InstalledScript Fabrikam-Script -ErrorAction SilentlyContinue | Uninstall-Script -Get-InstalledScript Start-Demo -ErrorAction SilentlyContinue | Uninstall-Script -Remove-Item /tmp/PSScriptAnalyzer -Force -Recurse -ErrorAction SilentlyContinue -Remove-Item /tmp/Start-Demot.ps1 -Force -ErrorAction SilentlyContinue - -#endregion - -# List of PowerShellGet commands -Get-Command -Module PowerShellGet - -# Discover modules -Find-Module -Find-Module PSScriptAnalyzer - -# Save a module to the local machine -Save-Module PSScriptAnalyzer -Repository PSGallery -Path /tmp -Get-ChildItem -Path /tmp/PSScriptAnalyzer/1.6.0/ -Recurse - -# Install a module to the common modules location -Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.0.2 -Scope CurrentUser -Repository PSGallery - -# Discover the installed modules -Get-InstalledModule -Get-Module -ListAvailable PSScriptAnalyzer -Get-InstalledModule PSScriptAnalyzer | Format-List * - -# Install xJea module -Install-Module -Name xJea -RequiredVersion 0.2 -Scope CurrentUser -Get-InstalledModule xJea -Get-Module -ListAvailable xJea - -# Update a module -Update-Module xJea -RequiredVersion 0.2.5 -Get-InstalledModule xJea -Get-Module -ListAvailable xJea - -# Update all modules -Update-Module -WhatIf -Update-Module -Get-InstalledModule - -# Uninstall a module version -Get-InstalledModule xJea -AllVersions -Uninstall-Module xJea -Get-InstalledModule xJea -AllVersions - -# Discover PowerShell Scripts -Find-Script -Find-Script -Name Start-Demo - -# Save scripts to a specified location -Save-Script Start-Demo -Repository PSGallery -Path /tmp -Get-ChildItem -Path /tmp/Start-Demo.ps1 - -# Install a script to the common scripts location -Find-Script -Name Start-Demo -Repository PSGallery | Install-Script -Scope CurrentUser -Get-InstalledScript - -Install-Script Fabrikam-Script -RequiredVersion 1.0 -Scope CurrentUser -Get-InstalledScript -Get-InstalledScript Fabrikam-Script | Format-List * - -# Update the installed scripts -Update-Script -WhatIf -Update-Script -Get-InstalledScript - -# Uninstall a script file -Uninstall-Script Fabrikam-Script -Verbose diff --git a/demos/powershellget/PowerShellGet.ps1 b/demos/powershellget/PowerShellGet.ps1 new file mode 100644 index 0000000000..37bdd29690 --- /dev/null +++ b/demos/powershellget/PowerShellGet.ps1 @@ -0,0 +1,52 @@ +#region find, install, update, uninstall the PowerShell scripts from an online repository. +# Value: equivalent of pypi + +# List of PowerShellGet commands +Get-Command -Module PowerShellGet + +# Discover PowerShell Scripts +Find-Script +Find-Script -Name Start-Demo + +# Save scripts to a specified location +Save-Script Start-Demo -Repository PSGallery -Path /tmp +Get-ChildItem -Path /tmp/Start-Demo.ps1 + +# Install a script to the common scripts location +Find-Script -Name Start-Demo -Repository PSGallery | Install-Script +Get-InstalledScript + +# Install another script to show the update functionality +Install-Script Fabrikam-Script -RequiredVersion 1.0 +Get-InstalledScript +Get-InstalledScript Fabrikam-Script | Format-List * + +# Update the installed scripts +Update-Script -WhatIf +Update-Script +Get-InstalledScript + +# Uninstall a script file +Uninstall-Script Fabrikam-Script -Verbose + +#endregion + +#region Using PowerShellGet find and install other demos + +# Value: equivalent of pypi +# Look for all the modules we'll be demoing today +Find-Module -Tag 'PowerShellCore_Demo' + +# Pipe this to Install-Module to install them +Find-Module -Tag 'PowerShellCore_Demo' | Install-Module -Verbose +Get-InstalledModule + + +# Look for all the scripts we'll be demoing today +Find-Script -Tag 'PowerShellCore_Demo' + +# Pipe this to Install-Script to install them +Find-Script -Tag 'PowerShellCore_Demo' | Install-Script -Verbose +Get-InstalledScript + +#endregion diff --git a/demos/powershellget/README.md b/demos/powershellget/README.md new file mode 100644 index 0000000000..f225610169 --- /dev/null +++ b/demos/powershellget/README.md @@ -0,0 +1,5 @@ +## PowerShellGet demo + +PowerShellGet is a PowerShell module with the commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, DSC Resources, Role Capabilities and Scripts. + +This demo shows discovering, installing, updating, uninstalling the PowerShell scripts from an online repository.