Merge pull request #1529 from PowerShell/psget_demo_update
Moving the PowerShellGet.ps1 into Demos\PowerShellGet folder.
This commit is contained in:
commit
8a8b234e7a
4 changed files with 57 additions and 96 deletions
|
@ -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
|
|
@ -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
|
52
demos/powershellget/PowerShellGet.ps1
Normal file
52
demos/powershellget/PowerShellGet.ps1
Normal file
|
@ -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
|
5
demos/powershellget/README.md
Normal file
5
demos/powershellget/README.md
Normal file
|
@ -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.
|
Loading…
Reference in a new issue