Skip to content

Commit 46bacb6

Browse files
authored
Merge pull request #580 from jpogran/GH-579-build-script-fix-extract-path
(GH-579) Fix build script extract path
2 parents 1c33963 + 01aa9e0 commit 46bacb6

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

psakefile.ps1

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
properties {
22
$config = Get-Content (Join-Path $PSScriptRoot 'package.json') | ConvertFrom-Json
3-
$langaugeServerPath = (Join-Path $PSScriptRoot 'vendor/languageserver')
3+
$languageServerPath = (Join-Path $PSScriptRoot 'vendor/languageserver')
44
$languageServerZip = Join-Path $PSScriptRoot 'editor_services.zip'
55
$syntaxFilePath = Join-Path $PSScriptRoot 'syntaxes/puppet.tmLanguage'
66
$packageVersion = ''
@@ -17,6 +17,7 @@ task Clean {
1717
}
1818

1919
task VendorEditorServices {
20+
$githubref = $config.editorComponents.editorServices.githubref
2021
if ($config.editorComponents.editorServices.githubuser) {
2122
$githubuser = $config.editorComponents.editorServices.githubuser
2223
}
@@ -31,25 +32,26 @@ task VendorEditorServices {
3132
}
3233

3334
if ($config.editorComponents.editorServices.directory) {
34-
Copy-Item -Path $config.editorComponents.editorServices.directory -Destination $langaugeServerPath -Recurse -Force
35-
return
36-
}
37-
38-
if ($config.editorComponents.editorServices.release) {
35+
Copy-Item -Path $config.editorComponents.editorServices.directory -Destination $languageServerPath -Recurse -Force
36+
}elseif ($config.editorComponents.editorServices.release) {
3937
$releasenumber = $config.editorComponents.editorServices.release
4038
$uri = "https://github.com/${githubuser}/${githubrepo}/releases/download/${releasenumber}/puppet_editor_services_${releasenumber}.zip";
39+
Invoke-RestMethod -Uri $uri -OutFile $languageServerZip -ErrorAction Stop
40+
Expand-Archive -Path $languageServerZip -DestinationPath $languageServerPath -ErrorAction Stop
41+
Remove-Item -Path $languageServerZip -Force
4142
}
4243
elseif ($config.editorComponents.editorServices.githubref) {
4344
$githubref = $config.editorComponents.editorServices.githubref;
4445
$uri = "https://github.com/${githubuser}/${githubrepo}/archive/${githubref}.zip"
46+
Invoke-RestMethod -Uri $uri -OutFile $languageServerZip -ErrorAction Stop
47+
Expand-Archive -Path $languageServerZip -DestinationPath "$($languageServerPath)/tmp" -ErrorAction Stop
48+
Move-Item -Path (Join-Path $languageServerPath "tmp/$githubrepo-$githubref/*") -Destination $languageServerPath
49+
Remove-Item -Path $languageServerZip -Force
50+
Remove-Item -Path "$($languageServerPath)/tmp" -Force -Recurse
4551
}
4652
else {
4753
throw "Unable to vendor Editor Serices. Missing a release, directory, or git reference configuration item"
4854
}
49-
50-
Invoke-RestMethod -Uri $uri -OutFile $languageServerZip -ErrorAction Stop
51-
Expand-Archive -Path $languageServerZip -DestinationPath $langaugeServerPath -ErrorAction Stop
52-
Remove-Item -Path $languageServerZip -Force
5355
}
5456

5557
task VendorEditorSyntax {

0 commit comments

Comments
 (0)