Skip to content

Commit 5c31076

Browse files
author
James Pogran
authored
Merge pull request #298 from glennsarti/update-vendor-process
(maint) Add custom git reference for vendoring
2 parents 9357cc1 + 1541889 commit 5c31076

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

README_BUILD.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,21 @@ By default the extension will use the specified released version of the Puppet E
4141
}
4242
```
4343

44-
To use a local directory that contains the Puppet Editor services, use the directory configuration setting; for example if the the editor services was located in `C:\puppet-editor-services` use the following;
44+
To use a specific GitHub repository that contains the Puppet Editor services, use the `githubref` configuration setting; for example to use the `puppet-editing` repository, owned by `Alice` with the `testing` branch
45+
46+
``` json
47+
{
48+
"githubuser": "Alice",
49+
"githubrepo": "puppet-editing",
50+
"githubref": "testing"
51+
}
52+
```
53+
54+
Note - By default the githubuser is `lingua-pupuli` and the githubrepo is `puppet-editor-services`
55+
56+
Note - Use the full length commit SHA for `githubref`, not the abbreviated eight character SHA
57+
58+
To use a local directory that contains the Puppet Editor services, use the `directory` configuration setting; for example if the the editor services was located in `C:\puppet-editor-services` use the following;
4559

4660
``` json
4761
{

gulpfile.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ function getEditorServicesReleaseURL(config) {
3636
return `https://github.com/${githubuser}/${githubrepo}/releases/download/${releasenumber}/puppet_editor_services_${releasenumber}.zip`;
3737
};
3838

39+
function getEditorServicesGithubURL(config) {
40+
var githubuser = (config.githubuser == undefined) ? 'lingua-pupuli' : config.githubuser
41+
var githubrepo = (config.githubrepo == undefined) ? 'puppet-editor-services' : config.githubrepo
42+
var githubref = config.githubref;
43+
44+
if (githubref == undefined) {
45+
throw "The git reference must be specified"
46+
};
47+
48+
// Example URL - Branch
49+
// https://github.com/<owner>/puppet-editor-services/archive/add-code-action-provider.zip
50+
// Example URL - SHA ref
51+
// https://github.com/<owner>/puppet-editor-services/archive/1a2623217dbd8e0deed11808bba4ef8de8f3880d.zip
52+
return `https://github.com/${githubuser}/${githubrepo}/archive/${githubref}.zip`
53+
};
54+
3955
// The default task (called when you run `gulp` from cli)
4056
gulp.task('default', ['build']);
4157

@@ -72,6 +88,18 @@ gulp.task('vendor_editor_services', function (callback) {
7288
.pipe(gulp.dest('./vendor/languageserver'));
7389
}
7490

91+
// Use a custom github download if a github reference is defined
92+
if (config.githubref != undefined) {
93+
return download({
94+
fileName: 'editor_services.zip',
95+
request: {
96+
url: getEditorServicesGithubURL(config)
97+
}
98+
})
99+
.pipe(decompress({strip: 1}))
100+
.pipe(gulp.dest('./vendor/languageserver'));
101+
}
102+
75103
// Use a simple filecopy if 'directory' is defined
76104
if (config.directory != undefined) {
77105
return gulp.src([path.join(config.directory,'lib/**/*'),
@@ -82,7 +110,7 @@ gulp.task('vendor_editor_services', function (callback) {
82110
.pipe(gulp.dest('./vendor/languageserver'));
83111
}
84112

85-
throw "Unable to vendor Editor Serices. Missing a release or directory configuration item"
113+
throw "Unable to vendor Editor Serices. Missing a release, directory, or git reference configuration item"
86114
});
87115

88116
gulp.task('compile_typescript', function (callback) {

0 commit comments

Comments
 (0)