5
5
#
6
6
Param (
7
7
[string ] $containerName = " " ,
8
+ [ValidateSet (" UserPassword" , " Windows" )]
8
9
[string ] $auth = " " ,
9
10
[pscredential ] $credential = $null ,
10
11
[string ] $licenseFileUrl = " " ,
11
12
[switch ] $fromVSCode ,
12
- [switch ] $accept_insiderEula
13
+ [switch ] $accept_insiderEula ,
14
+ [switch ] $clean
13
15
)
14
16
15
17
$errorActionPreference = " Stop" ; $ProgressPreference = " SilentlyContinue" ; Set-StrictMode - Version 2.0
16
18
19
+ function DownloadHelperFile {
20
+ param (
21
+ [string ] $url ,
22
+ [string ] $folder
23
+ )
24
+
25
+ $prevProgressPreference = $ProgressPreference ; $ProgressPreference = ' SilentlyContinue'
26
+ $name = [System.IO.Path ]::GetFileName($url )
27
+ Write-Host " Downloading $name from $url "
28
+ $path = Join-Path $folder $name
29
+ Invoke-WebRequest - UseBasicParsing - uri $url - OutFile $path
30
+ $ProgressPreference = $prevProgressPreference
31
+ return $path
32
+ }
33
+
17
34
try {
18
35
Clear-Host
19
36
Write-Host
@@ -27,17 +44,11 @@ Write-Host -ForegroundColor Yellow @'
27
44
28
45
'@
29
46
30
- $webClient = New-Object System.Net.WebClient
31
- $webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy - argumentList ([System.Net.Cache.RequestCacheLevel ]::NoCacheNoStore)
32
- $webClient.Encoding = [System.Text.Encoding ]::UTF8
33
- $GitHubHelperUrl = ' https://raw.githubusercontent.com/freddydk/AL-Go/nuget/Actions/Github-Helper.psm1'
34
- Write-Host " Downloading GitHub Helper module from $GitHubHelperUrl "
35
- $GitHubHelperPath = " $ ( [System.IO.Path ]::GetTempFileName()) .psm1"
36
- $webClient.DownloadFile ($GitHubHelperUrl , $GitHubHelperPath )
37
- $ALGoHelperUrl = ' https://raw.githubusercontent.com/freddydk/AL-Go/nuget/Actions/AL-Go-Helper.ps1'
38
- Write-Host " Downloading AL-Go Helper script from $ALGoHelperUrl "
39
- $ALGoHelperPath = " $ ( [System.IO.Path ]::GetTempFileName()) .ps1"
40
- $webClient.DownloadFile ($ALGoHelperUrl , $ALGoHelperPath )
47
+ $tmpFolder = Join-Path ([System.IO.Path ]::GetTempPath()) " $ ( [Guid ]::NewGuid().ToString()) "
48
+ New-Item - Path $tmpFolder - ItemType Directory - Force | Out-Null
49
+ $GitHubHelperPath = DownloadHelperFile - url ' https://raw.githubusercontent.com/microsoft/AL-Go/c198d5ffe9434dda2087ec2c5a9edc61e5118f28/Actions/Github-Helper.psm1' - folder $tmpFolder
50
+ $ALGoHelperPath = DownloadHelperFile - url ' https://raw.githubusercontent.com/microsoft/AL-Go/c198d5ffe9434dda2087ec2c5a9edc61e5118f28/Actions/AL-Go-Helper.ps1' - folder $tmpFolder
51
+ DownloadHelperFile - url ' https://raw.githubusercontent.com/microsoft/AL-Go/c198d5ffe9434dda2087ec2c5a9edc61e5118f28/Actions/Packages.json' - folder $tmpFolder | Out-Null
41
52
42
53
Import-Module $GitHubHelperPath
43
54
. $ALGoHelperPath - local
@@ -134,7 +145,8 @@ CreateDevEnv `
134
145
- auth $auth `
135
146
- credential $credential `
136
147
- licenseFileUrl $licenseFileUrl `
137
- - accept_insiderEula:$accept_insiderEula
148
+ - accept_insiderEula:$accept_insiderEula `
149
+ - clean:$clean
138
150
}
139
151
catch {
140
152
Write-Host - ForegroundColor Red " Error: $ ( $_.Exception.Message ) `n Stacktrace: $ ( $_.scriptStackTrace ) "
0 commit comments