@@ -16,33 +16,45 @@ task Clean {
16
16
}
17
17
}
18
18
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" ;
29
38
}
30
39
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"
32
47
}
33
48
34
49
if ($config.editorComponents.editorServices.directory ) {
35
50
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 ) {
39
53
Invoke-RestMethod - Uri $uri - OutFile $languageServerZip - ErrorAction Stop
40
54
Expand-Archive - Path $languageServerZip - DestinationPath $languageServerPath - ErrorAction Stop
41
55
Remove-Item - Path $languageServerZip - Force
42
56
}
43
57
elseif ($config.editorComponents.editorServices.githubref ) {
44
- $githubref = $config.editorComponents.editorServices.githubref ;
45
- $uri = " https://github.com/${githubuser} /${githubrepo} /archive/${githubref} .zip"
46
58
Invoke-RestMethod - Uri $uri - OutFile $languageServerZip - ErrorAction Stop
47
59
Expand-Archive - Path $languageServerZip - DestinationPath " $ ( $languageServerPath ) /tmp" - ErrorAction Stop
48
60
Move-Item - Path (Join-Path $languageServerPath " tmp/$githubrepo -$githubref /*" ) - Destination $languageServerPath
@@ -54,19 +66,9 @@ task VendorEditorServices {
54
66
}
55
67
}
56
68
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'
70
72
71
73
if ($config.editorComponents.editorSyntax.directory ) {
72
74
$source = Join-Path ($config.editorComponents.editorSyntax.directory , ' syntaxes/puppet.tmLanguage' )
@@ -89,7 +91,7 @@ task VendorEditorSyntax {
89
91
Invoke-RestMethod - Uri $uri - OutFile $syntaxFilePath - ErrorAction Stop
90
92
}
91
93
92
- task VendorCytoscape {
94
+ task VendorCytoscape - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' vendor\cytoscape ' )) } {
93
95
$cyto = Join-Path $PSScriptRoot ' node_modules\cytoscape\dist'
94
96
$vendorCytoPath = (Join-Path $PSScriptRoot ' vendor\cytoscape' )
95
97
Copy-Item - Path $cyto - Recurse - Destination $vendorCytoPath
@@ -103,10 +105,12 @@ task Bump {
103
105
exec { npm version -- no- git- tag- version $packageVersion }
104
106
}
105
107
106
- task Vendor - depends VendorEditorServices, VendorEditorSyntax, VendorCytoscape
108
+ task Npm - precondition { ! (Test-Path (Join-Path $PSScriptRoot ' node_modules' )) } {
109
+ exec { npm install }
110
+ }
107
111
108
- task Build - depends Clean , Vendor , CompileTypeScript
112
+ task Vendor - depends VendorEditorServices , VendorEditorSyntax , VendorCytoscape
109
113
110
- task Initial - depends Clean , Vendor
114
+ task Build - depends Npm , Vendor, CompileTypeScript
111
115
112
116
task default - depends Build
0 commit comments