Skip to content

Commit 6d760ce

Browse files
committed
Merge pull request #10 from iilei/add_github_option
Add option - boolean: infer github links
2 parents 40e8b7a + 207c526 commit 6d760ce

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ var through2 = require('through2'),
4242
*/
4343
module.exports = function (options) {
4444
options = options || {};
45+
var docOptions = {
46+
github : !!(options.github || options.g)
47+
};
4548
var files = [];
4649
options.format = options.format || 'html';
4750
var formatter = documentation.formats[options.format];
@@ -54,7 +57,7 @@ module.exports = function (options) {
5457
}, function (cb) {
5558
documentation(files.map(function(file) {
5659
return file.path;
57-
}), {}, function(err, comments) {
60+
}), docOptions, function(err, comments) {
5861
formatter(comments, {}, function (err, output) {
5962
if (options.format === 'json' || options.format === 'md') {
6063
this.push(new File({

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"gulp": "^3.8.11",
1414
"concat-stream": "^1.4.8",
1515
"prova": "^2.1.1",
16+
"proxyquire": "^1.7.3",
1617
"tape": "^3.5.0"
1718
},
1819
"keywords": [

test/test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var test = require('prova'),
22
path = require('path'),
33
concat = require('concat-stream'),
44
gulp = require('gulp'),
5+
proxyquire = require('proxyquire'),
56
documentation = require('../');
67

78
test('gulp-documentation', function(t) {
@@ -45,6 +46,24 @@ test('gulp-documentation html', function(t) {
4546
}));
4647
});
4748

49+
test('gulp-documentation github links', function(t) {
50+
var through2Stub = {
51+
obj : function (indexes, callback) {
52+
callback.call();
53+
}
54+
},
55+
documentationStub = function(indexes, options) {
56+
t.equal(options.github, true);
57+
t.end();
58+
},
59+
documentationjs = proxyquire('../', {
60+
'through2': through2Stub,
61+
'documentation': documentationStub
62+
});
63+
64+
documentationjs({ format: 'html', github: true });
65+
});
66+
4867
test('gulp-documentation exit callback', function(t) {
4968
t.plan(1);
5069
gulp.src(path.join(__dirname, '/fixture.js'))

0 commit comments

Comments
 (0)