-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.ps1
50 lines (43 loc) · 1.74 KB
/
build.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
46
47
48
49
50
[cmdletbinding()]
param()
function InternalGet-ScriptDirectory{
split-path (((Get-Variable MyInvocation -Scope 1).Value).MyCommand.Path)
}
$scriptDir = ((InternalGet-ScriptDirectory) + "\")
$global:publishsettings = New-Object -TypeName psobject -Property @{
MinGeoffreyModuleVersion = '0.0.10.1'
PubSamplesRoot = [System.IO.DirectoryInfo](Join-Path $scriptDir 'publish-samples')
NumIterations = 10
AzureSiteName = 'sayedpubdemo01'
}
function Ensure-GeoffreyLoaded{
[cmdletbinding()]
param(
[string]$minGeoffreyModuleVersion = $global:publishsettings.MinGeoffreyModuleVersion
)
process{
# see if nuget-powershell is available and load if not
$geoffreyloaded = $false
if((get-command Invoke-Geoffrey -ErrorAction SilentlyContinue)){
if($env:GeoffreySkipReload -eq $true){
$geoffreyloaded = $true
}
else{
# check the module to ensure we have the correct version
$currentversion = (Get-Module -Name geoffrey).Version
if( ($currentversion -ne $null) -and ($currentversion.CompareTo([version]::Parse($minGeoffreyModuleVersion)) -ge 0 )){
$geoffreyloaded = $true
}
}
}
if(!$geoffreyloaded){
(new-object Net.WebClient).DownloadString('https://raw.githubusercontent.com/geoffrey-ps/geoffrey/master/getgeoffrey.ps1') | Invoke-Expression
}
# verify it was loaded
if(-not (get-command Invoke-Geoffrey -ErrorAction SilentlyContinue)){
throw ('Unable to load geoffrey, unknown error')
}
}
}
Ensure-GeoffreyLoaded
Invoke-Geoffrey -scriptPath (Join-Path $scriptDir 'gfile.ps1') -taskName default