forked from jmbauguess/ServiceNowScriptDocumenter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
75 lines (64 loc) · 2.33 KB
/
gulpfile.js
File metadata and controls
75 lines (64 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
var gulp = require('gulp'),
shell = require('gulp-shell'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
runSequence = require('run-sequence'),
gulpJsdoc2md = require("jsdoc-to-markdown"),
git = require('gulp-git');
var options = require('minimist')(process.argv.slice(2));
gulp.task('default', function() {
runSequence('extract', 'jsdoc', 'markdown-server', 'markdown-client',
'markdown-all', 'jshint-client', 'jshint-server', 'add-files',
'commit-files', 'push-files');
});
gulp.task('extract', shell.task( [
("node index.js --instance '" + options.instance + "' --username '" +
options.username + "' --password '" + options.password +
"' --update_set '" + options.update_set + "'")
])
);
gulp.task('jsdoc', shell.task([
'jsdoc -c conf.json'
])
);
gulp.task('markdown-server', shell.task([
'jsdoc2md ./sys_script_include/*.js > server.md'
]));
gulp.task('markdown-client', shell.task([
'jsdoc2md ./sys_ui_script/*.js > client.md'
]));
gulp.task('markdown-all', shell.task([
'jsdoc2md ./sys_script_include/*.js ./sys_ui_script/*.js > all.md'
]));
gulp.task('jshint-server', function() {
return gulp.src('./sys_script_include/*.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('gulp-jshint-file-reporter', {
filename: __dirname + '/jshint-server-output.log'
}));
});
gulp.task('jshint-client', function() {
return gulp.src('./sys_ui_script/*.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('gulp-jshint-file-reporter', {
filename: __dirname + '/jshint-client-output.log'
}));
});
var sourceArray = ['./all.md', './client.md', './server.md',
'./sys_script_include/*.js', './sys_ui_script/*.js',
'./u_scheduled_unit_test/*.js', './sys_remote_update_set/*.xml',
'./sys_update_set/*.*', './*.log'];
gulp.task('add-files', function() {
return gulp.src(sourceArray).pipe(git.add());
});
gulp.task('commit-files', function() {
return gulp.src(sourceArray).pipe(git.commit(options.reason))
.on('error', console.log);
});
gulp.task('push-files', function() {
git.push('origin', 'HEAD:master', {args: '-u -f'}, function(err) {
if (err) throw err;
});
});