@@ -16,33 +16,45 @@ task Clean {
1616 }
1717}
1818
19- task VendorEditorServices {
20- $githubref = $config.editorComponents.editorServices.githubref
21- if ($config.editorComponents.editorServices.githubuser ) {
22- $githubuser = $config.editorComponents.editorServices.githubuser
23- }
24- else {
25- $githubuser = ' lingua-pupuli'
26- }
27- if ($config.editorComponents.editorServices.githubrepo ) {
28- $githubrepo = $config.editorComponents.editorServices.githubrepo
19+ # "editorServices": {
20+ # "release": "0.26.0"
21+ # }
22+ # "editorServices": {
23+ # "release": "0.26.0"
24+ # "githubrepo": "puppet-editor-services",
25+ # "githubuser": "glennsarti"
26+ # }
27+ # "editorServices": {
28+ # "githubrepo": "puppet-editor-services",
29+ # "githubref": "glennsarti:spike-rearch-langserver"
30+ # },
31+ task VendorEditorServices - precondition { ! (Test-Path (Join-Path $PSScriptRoot ' vendor/languageserver' )) } {
32+ $githubrepo = $config.editorComponents.editorServices.githubrepo ?? ' puppet-editor-services'
33+ $githubuser = $config.editorComponents.editorServices.githubuser ?? ' puppetlabs'
34+
35+ if ($config.editorComponents.editorServices.release ) {
36+ $releasenumber = $config.editorComponents.editorServices.release
37+ $uri = " https://github.com/${githubuser} /${githubrepo} /releases/download/${releasenumber} /puppet_editor_services_${releasenumber} .zip" ;
2938 }
3039 else {
31- $githubrepo = ' puppet-editor-services'
40+ $githubref = $config.editorComponents.editorServices.githubref ;
41+ if ($githubref -notcontains ' :' ) {
42+ throw " Invalid githubref. Must be in user:branch format like glennsarti:spike-rearch-langserver"
43+ }
44+ $githubuser = $githubref.split (" :" )[0 ]
45+ $githubbranch = $githubref.split (" :" )[1 ]
46+ $uri = " https://github.com/${githubuser} /${githubrepo} /archive/${githubbranch} .zip"
3247 }
3348
3449 if ($config.editorComponents.editorServices.directory ) {
3550 Copy-Item - Path $config.editorComponents.editorServices.directory - Destination $languageServerPath - Recurse - Force
36- }elseif ($config.editorComponents.editorServices.release ) {
37- $releasenumber = $config.editorComponents.editorServices.release
38- $uri = " https://github.com/${githubuser} /${githubrepo} /releases/download/${releasenumber} /puppet_editor_services_${releasenumber} .zip" ;
51+ }
52+ elseif ($config.editorComponents.editorServices.release ) {
3953 Invoke-RestMethod - Uri $uri - OutFile $languageServerZip - ErrorAction Stop
4054 Expand-Archive - Path $languageServerZip - DestinationPath $languageServerPath - ErrorAction Stop
4155 Remove-Item - Path $languageServerZip - Force
4256 }
4357 elseif ($config.editorComponents.editorServices.githubref ) {
44- $githubref = $config.editorComponents.editorServices.githubref ;
45- $uri = " https://github.com/${githubuser} /${githubrepo} /archive/${githubref} .zip"
4658 Invoke-RestMethod - Uri $uri - OutFile $languageServerZip - ErrorAction Stop
4759 Expand-Archive - Path $languageServerZip - DestinationPath " $ ( $languageServerPath ) /tmp" - ErrorAction Stop
4860 Move-Item - Path (Join-Path $languageServerPath " tmp/$githubrepo -$githubref /*" ) - Destination $languageServerPath
@@ -54,19 +66,9 @@ task VendorEditorServices {
5466 }
5567}
5668
57- task VendorEditorSyntax {
58- if ($config.editorComponents.editorSyntax.githubuser ) {
59- $githubuser = $config.editorComponents.editorSyntax.githubuser
60- }
61- else {
62- $githubuser = ' lingua-pupuli'
63- }
64- if ($config.editorComponents.editorSyntax.githubrepo ) {
65- $githubrepo = $config.editorComponents.editorSyntax.githubrepo
66- }
67- else {
68- $githubrepo = ' puppet-editor-syntax'
69- }
69+ task VendorEditorSyntax - precondition { ! (Test-Path (Join-Path $PSScriptRoot ' syntaxes/puppet.tmLanguage' )) } {
70+ $githubrepo = $config.editorComponents.editorSyntax.githubrepo ?? ' puppet-editor-syntax'
71+ $githubuser = $config.editorComponents.editorSyntax.githubuser ?? ' puppetlabs'
7072
7173 if ($config.editorComponents.editorSyntax.directory ) {
7274 $source = Join-Path ($config.editorComponents.editorSyntax.directory , ' syntaxes/puppet.tmLanguage' )
@@ -89,7 +91,7 @@ task VendorEditorSyntax {
8991 Invoke-RestMethod - Uri $uri - OutFile $syntaxFilePath - ErrorAction Stop
9092}
9193
92- task VendorCytoscape {
94+ task VendorCytoscape - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' vendor\cytoscape ' )) } {
9395 $cyto = Join-Path $PSScriptRoot ' node_modules\cytoscape\dist'
9496 $vendorCytoPath = (Join-Path $PSScriptRoot ' vendor\cytoscape' )
9597 Copy-Item - Path $cyto - Recurse - Destination $vendorCytoPath
@@ -103,10 +105,12 @@ task Bump {
103105 exec { npm version -- no- git- tag- version $packageVersion }
104106}
105107
106- task Vendor - depends VendorEditorServices, VendorEditorSyntax, VendorCytoscape
108+ task Npm - precondition { ! (Test-Path (Join-Path $PSScriptRoot ' node_modules' )) } {
109+ exec { npm install }
110+ }
107111
108- task Build - depends Clean , Vendor , CompileTypeScript
112+ task Vendor - depends VendorEditorServices , VendorEditorSyntax , VendorCytoscape
109113
110- task Initial - depends Clean , Vendor
114+ task Build - depends Npm , Vendor, CompileTypeScript
111115
112116task default - depends Build
0 commit comments