Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 8318249

Browse files
committed
Merge branch 'joneshf-master'
2 parents d32d3a5 + 51f8c8f commit 8318249

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,11 @@ Invokes the `psc-make` command.
6262
- verboseErrors: Boolean value that toggles `--verbose-errors`
6363
- browserNamespace: String value that sets `--browser-namespace=<string>`
6464
- output: String value that sets `--output=<string>`
65+
66+
### purescript.docgen(options)
67+
68+
Invokes the `docgen` command.
69+
70+
#### options
71+
72+
- hierarchy: Boolean value that toggles `--hierarchy-images`

index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ var gutil = require('gulp-util')
3030
}
3131
, single: {browserNamespace: '--browser-namespace', output: '--output'}
3232
, multi: {}
33+
},
34+
docgen: {
35+
flags: {
36+
hierarchy: '--hierarchy-images'
37+
}
38+
, single: {}
39+
, multi: {}
3340
}
3441
}
3542
;
@@ -115,7 +122,34 @@ function pscMake(opts) {
115122
});
116123
}
117124

125+
function docgen(opts) {
126+
return acc(function(files, cb){
127+
var args = options(OPTIONS.docgen, opts).concat(files)
128+
, cmd = cp.spawn('docgen', args)
129+
, buffer = new Buffer(0)
130+
, that = this
131+
;
132+
cmd.stdout.on('data', function(stdout){
133+
buffer = Buffer.concat([buffer, new Buffer(stdout)]);
134+
});
135+
cmd.stderr.on('data', function(stderr){
136+
gutil.log('Stderr from \'' + gutil.colors.cyan('docgen') + '\'\n' + gutil.colors.magenta(stderr));
137+
});
138+
cmd.on('close', function(code){
139+
if (!!code) that.emit('error', new gutil.PluginError(PLUGIN, buffer.toString()));
140+
else {
141+
that.push(new gutil.File({
142+
path: '.',
143+
contents: buffer
144+
}));
145+
}
146+
cb();
147+
});
148+
});
149+
}
150+
118151
module.exports = {
152+
docgen: docgen,
119153
psc: psc,
120154
pscMake: pscMake
121155
}

0 commit comments

Comments
 (0)