Skip to content

Instantly share code, notes, and snippets.

@dreadjr
Created June 5, 2014 06:38
Show Gist options
  • Save dreadjr/2d3d9ae052ace0db4989 to your computer and use it in GitHub Desktop.
Save dreadjr/2d3d9ae052ace0db4989 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var gutil = require('gulp-util');
var shell = require('gulp-shell');
var git = require('gulp-git');
var docco = require('gulp-docco');
var cache = require('gulp-cached');
var remember = require('gulp-remember');
// Docs Task
// =========
// The `docs` task builds docco files, switches to the gh-pages
// branch, commits the docs, and switches back to the
// development branch.
//
// Usage: `gulp docs`
//
gulp.task('checkout-master', shell.task(['git checkout master']));
gulp.task('docs-make', ['checkout-master'], function() {
return gulp.src('./lib/**/*.js')
.pipe(docco())
.pipe(cache('docs'))
.pipe(gulp.dest('./docs/'))
.on('error', gutil.log);
});
gulp.task('docs-commit', ['docs-make'], shell.task([
'git checkout gh-pages',
'git add ./docs',
'git commit -a -m \"update docs\"',
'git checkout master',
'git checkout -b development'
]));
gulp.task('docs', ['docs-commit'], function() {
git.push('origin', 'gh-pages');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment