2015-08-03 20:45:58 -04:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var path = require('canonical-path');
|
|
|
|
var del = require('del');
|
|
|
|
var watch = require('gulp-watch');
|
2015-08-08 16:55:53 -04:00
|
|
|
var taskListing = require('gulp-task-listing');
|
2015-08-03 20:45:58 -04:00
|
|
|
|
|
|
|
var docShredder = require('../doc-shredder');
|
|
|
|
|
2015-08-11 03:27:09 -04:00
|
|
|
var shredOptions = {
|
|
|
|
examplesDir: "test_source",
|
|
|
|
fragmentsDir: "test_fragments"
|
|
|
|
};
|
2015-08-03 20:45:58 -04:00
|
|
|
|
2015-08-08 16:55:53 -04:00
|
|
|
gulp.task('help', taskListing);
|
|
|
|
|
2015-08-03 20:45:58 -04:00
|
|
|
gulp.task('shred', function() {
|
|
|
|
return docShredder.shred(shredOptions);
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('clean', function (cb) {
|
2015-08-11 03:27:09 -04:00
|
|
|
var cleanPath = path.join(shredOptions.fragmentsDir, '**/*.*')
|
2015-08-03 20:45:58 -04:00
|
|
|
del([ cleanPath, '!**/*.ovr.*'], function (err, paths) {
|
|
|
|
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('watch', function (cb) {
|
2015-08-11 03:27:09 -04:00
|
|
|
var pattern = path.join(shredOptions.examplesDir, "**/*.*");
|
2015-08-03 20:45:58 -04:00
|
|
|
watch([ pattern], function(event, done) {
|
|
|
|
console.log('Event type: ' + event.event); // added, changed, or deleted
|
|
|
|
console.log('Event path: ' + event.path); // The path of the modified file
|
|
|
|
docShredder.shredSingleDir(shredOptions, event.path);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2015-08-10 14:17:02 -04:00
|
|
|
gulp.task('map', function() {
|
|
|
|
var options = {
|
2015-08-11 03:27:09 -04:00
|
|
|
jadeDir: 'test_jade',
|
|
|
|
examplesDir: 'test_source',
|
|
|
|
fragmentsDir: 'test_fragments',
|
|
|
|
outputDir: '.'
|
2015-08-10 14:17:02 -04:00
|
|
|
}
|
2015-08-11 03:27:09 -04:00
|
|
|
return docShredder.buildShredMap(options).then(function(x) {
|
2015-08-10 14:17:02 -04:00
|
|
|
var docMaps = x.docMaps;
|
|
|
|
})
|
|
|
|
|
|
|
|
});
|
2015-08-03 20:45:58 -04:00
|
|
|
|
2015-08-08 16:55:53 -04:00
|
|
|
gulp.task('default', taskListing);
|
2015-08-03 20:45:58 -04:00
|
|
|
|