Skip to content

Commit 0aa716b

Browse files
committed
feat(docs): add SassDoc option
Closes #13
1 parent cf125c9 commit 0aa716b

File tree

6 files changed

+68
-4
lines changed

6 files changed

+68
-4
lines changed

app/index.js

+17
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ var BangularGenerator = yeoman.generators.Base.extend({
7474
value: 'browsersync',
7575
name: 'BrowserSync'
7676
}]
77+
}, {
78+
type: 'checkbox',
79+
name: 'docs',
80+
message: 'Do you want to add some documentation generators?',
81+
choices: [{
82+
value: 'sassdoc',
83+
name: 'SassDoc',
84+
checked: false
85+
}]
7786
}, {
7887
type: 'checkbox',
7988
name: 'tests',
@@ -127,6 +136,14 @@ var BangularGenerator = yeoman.generators.Base.extend({
127136
});
128137
}
129138

139+
if (props.docs && props.docs.length) {
140+
props.docs.forEach(function (doc) {
141+
self.filters[doc] = true;
142+
});
143+
}
144+
145+
self.filters.hasDocs = !!self.filters.sassdoc;
146+
130147
if (props.tests && props.tests.length) {
131148
props.tests.forEach(function (test) {
132149
self.filters[test] = true;

app/templates/_.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ client/styles/css
44
.idea/
55
dist/
66
.sass-cache/
7-
.bangular-refresh
7+
.bangular-refresh<% if (filters.hasDocs) { %>
8+
docs/<% } %>

app/templates/gulpfile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ gulp.task('version', require('./tasks/chore').version);<% if (f
1717
gulp.task('control', require('./tasks/control'));<% } if (filters.e2e) { %>
1818
gulp.task('e2e:update', require('./tasks/test').e2eUpdate);
1919
gulp.task('e2e', ['serve'], require('./tasks/test').e2eTests);<% } if (filters.karma || filters.mocha) { %>
20-
gulp.task('test', require('./tasks/test').test);<% } %>
20+
gulp.task('test', require('./tasks/test').test);<% } if (filters.sassdoc) { %>
21+
gulp.task('sassdoc', require('./tasks/doc').sassdoc);<% } %>

app/templates/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"karma-ng-html2js-preprocessor": "^0.1.2",
3838
"karma-phantomjs-launcher": "^0.1.4",<% } %>
3939
"main-bower-files": "^2.5.0",
40-
"run-sequence": "^1.0.2",<% if (filters.mocha) { %>
40+
"run-sequence": "^1.0.2",<% if (filters.sassdoc) { %>
41+
"sassdoc": "^2.1.8",<% } if (filters.mocha) { %>
4142
"should": "^5.1.0",<% } %>
4243
"streamqueue": "^0.1.2"<% if (filters.karma) { %>,
4344
"supertest": "^0.15.0"<% } %>

app/templates/tasks/doc.js(hasDocs)

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
/**
4+
* Documentation tasks
5+
*/
6+
7+
var gulp = require('gulp');<% if (filters.sassdoc) { %>
8+
var sassdoc = require('sassdoc');<% } %><% if (filters.sassdoc) { %>
9+
10+
exports.sassdoc = function () {
11+
gulp.src('client/styles/**/*.scss')
12+
.pipe(sassdoc({
13+
dest: 'docs/sass'
14+
}));
15+
};<% } %>

test/app.js

+30-1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,35 @@ describe('Launching app generator tests', function () {
358358

359359
describe('', function () {
360360

361+
before(function (done) {
362+
363+
utils.scaffold({
364+
name: 'Test',
365+
backend: 'json',
366+
reload: 'livereload',
367+
modules: [],
368+
docs: ['sassdoc']
369+
}, done);
370+
371+
});
372+
373+
it('should create all the files', basicFileCheck);
374+
375+
it('should check sassdoc dependency', function () {
376+
assert.fileContent('package.json', 'sassdoc');
377+
});
378+
379+
it('should check sassdoc task is present', function () {
380+
assert.file('tasks/doc.js');
381+
assert.fileContent('tasks/doc.js', 'exports.sassdoc = function () {');
382+
assert.fileContent('gulpfile.js', 'gulp.task(\'sassdoc\', ');
383+
assert.fileContent('.gitignore', 'docs/');
384+
});
385+
386+
});
387+
388+
/*describe('', function () {
389+
361390
before(function (done) {
362391
363392
this.timeout(240000);
@@ -443,6 +472,6 @@ describe('Launching app generator tests', function () {
443472
});
444473
});
445474
446-
});
475+
});*/
447476

448477
});

0 commit comments

Comments
 (0)