-
Notifications
You must be signed in to change notification settings - Fork 6
/
localpester.ps1
45 lines (39 loc) · 1.14 KB
/
localpester.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<#
.Description
Installs and loads all the required modules for the build.
Derived from scripts written by Warren F. (RamblingCookieMonster)
#>
[cmdletbinding()]
param ($Task = 'LocalPester')
"Starting build"
# " Installing latest NuGet Provider"
#Install-PackageProvider -name NuGet -Force
# Grab nuget bits, install modules, set build variables, start build.
" Install Dependent Modules"
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
Install-Module InvokeBuild, BuildHelpers, PSDeploy, PlatyPS -force -Scope CurrentUser
Install-Module PSScriptAnalyzer, Pester -Force -SkipPublisherCheck -Scope CurrentUser
" Import Dependent Modules"
$modules = New-Object System.Collections.ArrayList
$modules.add('InvokeBuild')
$modules.add('BuildHelpers')
$modules.add('PSScriptAnalyzer')
foreach($module in $modules) {
if(Get-Module $$module -ErrorAction 'Ignore' -ListAvailable){
"Module $module is installed. skipping install"
}else{
"Installing $module ..."
Import-Module $module
}
}
Set-BuildEnvironment
" InvokeBuild"
Invoke-Build $Task -Result result -Verbose
if ($Result.Error)
{
exit 1
}
else
{
exit 0
}