-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (51 loc) · 1.77 KB
/
gulpfile.js
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
// # [GRJS...](/lights-cameras-actions/)gulpfile.js
// ## gulpfile
//
// A [gulpfile](https://gulpjs.com/docs/en/getting-started/javascript-and-gulpfiles) is an implementation description file for **Gulp**.
//
// #### Dependency Documentation
// * Gulp - [documentation](https://gulpjs.com/) / [package](https://www.npmjs.com/package/gulp)
//
// ---
// Notes:
require('colors');
const { src, dest, watch, series, parallel } = require('gulp');
const { exec } = require('child_process');
function gulpSettings(){
// * This will tell gulp to generate documentation using [docco]() for:
// > Utilities
generateDocumentation('./gulpfile.js');
// > Files
generateDocumentation('./index.js');
generateDocumentation('./lights/index.js');
generateDocumentation('./cameras/index.js');
generateDocumentation('./actions/index.js');
// > Step Definitions
generateDocumentation('./features/step_definitions/utilities.js');
generateDocumentation('./features/step_definitions/lights.js');
generateDocumentation('./features/step_definitions/cameras.js');
generateDocumentation('./features/step_definitions/actions.js');
}
/**
* A general use function to generate documentation using a command executer.
* @param {string} source A path to a file to watch and generate documentation for.
*/
function generateDocumentation(source){
function runExec(){
console.log(`Generating Docs :: ${source}`.green);
return new Promise((resolve, reject) => {
exec(`docco ${source}`, (error, stdout, stderr) => {
if (error) {
console.error(`Generating Docs Error ::`.red, error);
reject();
return;
}
resolve();
});
})
}
watch(source, function documentation(done) {
runExec().then(done);
})
}
exports.default = gulpSettings