Created
April 28, 2017 09:28
-
-
Save johnmmoss/3173d6c9a582faee18c993a21f679911 to your computer and use it in GitHub Desktop.
cmdlet to setup pester
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Setup-Pester { | |
$ModulePath = "C:\Users\johnm\Documents\WindowsPowerShell\Modules" | |
$PesterModulePath = "$ModulePath\Pester" | |
if ((Test-Path $PesterModulePath) -eq $true) { | |
write-host Deleting Existing -ForegroundColor Gray | |
ri $PesterModulePath -Recurse -Force | |
} | |
write-host Cloneing https://github.com/pester/Pester.git to [$ModulePath]... -ForegroundColor gray | |
$current = pwd | |
cd C:\Users\johnm\Documents\WindowsPowerShell\Modules | |
git clone https://github.com/pester/Pester.git # Reports an error because git clone uses standard out | |
write-host PLEASE NOTE: git reports standard output to stderr??? -ForegroundColor Green | |
cd $current | |
write-host Installing Module... -ForegroundColor Gray | |
Import-Module Pester | |
write-host Module Installed! -ForegroundColor Gray | |
write-host Installed Commands: -ForegroundColor Green | |
Get-Module -Name Pester | Select -ExpandProperty ExportedCommands | |
write-host Setup Pester complete! -ForegroundColor Green | |
} | |
function Get-UserModulePath { | |
$Path = $env:PSModulePath -split ";" -match $env:USERNAME | |
if (-not (Test-Path -Path $Path)) | |
{ | |
New-Item -Path $Path -ItemType Container | Out-Null | |
} | |
$Path | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment