@@ -24,20 +24,21 @@ task Clean {
24
24
# "githubrepo": "puppet-editor-services",
25
25
# "githubuser": "glennsarti"
26
26
# }
27
- # "editorServices": {
27
+ # "editorServices": {
28
28
# "githubrepo": "puppet-editor-services",
29
29
# "githubref": "glennsarti:spike-rearch-langserver"
30
30
# },
31
- task VendorEditorServices {
31
+ task VendorEditorServices - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' vendor/languageserver ' )) } {
32
32
$githubrepo = $config.editorComponents.editorServices.githubrepo ?? ' puppet-editor-services'
33
33
$githubuser = $config.editorComponents.editorServices.githubuser ?? ' puppetlabs'
34
34
35
- if ($config.editorComponents.editorServices.release ){
35
+ if ($config.editorComponents.editorServices.release ) {
36
36
$releasenumber = $config.editorComponents.editorServices.release
37
37
$uri = " https://github.com/${githubuser} /${githubrepo} /releases/download/${releasenumber} /puppet_editor_services_${releasenumber} .zip" ;
38
- }else {
38
+ }
39
+ else {
39
40
$githubref = $config.editorComponents.editorServices.githubref ;
40
- if ($githubref -notcontains ' :' ){
41
+ if ($githubref -notcontains ' :' ) {
41
42
throw " Invalid githubref. Must be in user:branch format like glennsarti:spike-rearch-langserver"
42
43
}
43
44
$githubuser = $githubref.split (" :" )[0 ]
@@ -47,7 +48,8 @@ task VendorEditorServices {
47
48
48
49
if ($config.editorComponents.editorServices.directory ) {
49
50
Copy-Item - Path $config.editorComponents.editorServices.directory - Destination $languageServerPath - Recurse - Force
50
- }elseif ($config.editorComponents.editorServices.release ) {
51
+ }
52
+ elseif ($config.editorComponents.editorServices.release ) {
51
53
Invoke-RestMethod - Uri $uri - OutFile $languageServerZip - ErrorAction Stop
52
54
Expand-Archive - Path $languageServerZip - DestinationPath $languageServerPath - ErrorAction Stop
53
55
Remove-Item - Path $languageServerZip - Force
@@ -64,19 +66,9 @@ task VendorEditorServices {
64
66
}
65
67
}
66
68
67
- task VendorEditorSyntax {
68
- if ($config.editorComponents.editorSyntax.githubuser ) {
69
- $githubuser = $config.editorComponents.editorSyntax.githubuser
70
- }
71
- else {
72
- $githubuser = ' lingua-pupuli'
73
- }
74
- if ($config.editorComponents.editorSyntax.githubrepo ) {
75
- $githubrepo = $config.editorComponents.editorSyntax.githubrepo
76
- }
77
- else {
78
- $githubrepo = ' puppet-editor-syntax'
79
- }
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'
80
72
81
73
if ($config.editorComponents.editorSyntax.directory ) {
82
74
$source = Join-Path ($config.editorComponents.editorSyntax.directory , ' syntaxes/puppet.tmLanguage' )
@@ -99,7 +91,7 @@ task VendorEditorSyntax {
99
91
Invoke-RestMethod - Uri $uri - OutFile $syntaxFilePath - ErrorAction Stop
100
92
}
101
93
102
- task VendorCytoscape {
94
+ task VendorCytoscape - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' vendor\cytoscape ' )) } {
103
95
$cyto = Join-Path $PSScriptRoot ' node_modules\cytoscape\dist'
104
96
$vendorCytoPath = (Join-Path $PSScriptRoot ' vendor\cytoscape' )
105
97
Copy-Item - Path $cyto - Recurse - Destination $vendorCytoPath
@@ -113,14 +105,12 @@ task Bump {
113
105
exec { npm version -- no- git- tag- version $packageVersion }
114
106
}
115
107
116
- task Npm {
108
+ task Npm - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' node_modules ' )) } {
117
109
exec { npm install }
118
110
}
119
111
120
112
task Vendor - depends VendorEditorServices, VendorEditorSyntax, VendorCytoscape
121
113
122
- task Build - depends Clean , Npm, Vendor, CompileTypeScript
123
-
124
- task Initial - depends Clean , Vendor
114
+ task Build - depends Npm, Vendor, CompileTypeScript
125
115
126
116
task default - depends Build
0 commit comments