angular-cn/public/doc-shredder/_test/gulpfile.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

var gulp = require('gulp');
var path = require('canonical-path');
var del = require('del');
var watch = require('gulp-watch');
var taskListing = require('gulp-task-listing');
var docShredder = require('../doc-shredder');
2015-08-11 03:27:09 -04:00
var shredOptions = {
2015-10-14 15:47:22 -04:00
examplesDir: "test_source",
2015-08-11 03:27:09 -04:00
fragmentsDir: "test_fragments"
};
gulp.task('help', taskListing);
gulp.task('shred', ['clean'], function() {
return docShredder.shred(shredOptions);
});
gulp.task('clean', function (cb) {
2015-08-11 03:27:09 -04:00
var cleanPath = path.join(shredOptions.fragmentsDir, '**/*.*')
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, "**/*.*");
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;
})
});
gulp.task('default', taskListing);