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 = {
|
2015-10-14 15:47:22 -04:00
|
|
|
examplesDir: "test_source",
|
2015-08-11 03:27:09 -04:00
|
|
|
fragmentsDir: "test_fragments"
|
|
|
|
};
|
2015-08-03 20:45:58 -04:00
|
|
|
|
2015-08-08 16:55:53 -04:00
|
|
|
gulp.task('help', taskListing);
|
|
|
|
|
2015-10-13 22:44:27 -04:00
|
|
|
gulp.task('shred', ['clean'], function() {
|
2015-08-03 20:45:58 -04:00
|
|
|
return docShredder.shred(shredOptions);
|
|
|
|
});
|
|
|
|
|
2016-06-05 17:46:52 -04:00
|
|
|
gulp.task('clean', function () {
|
2015-08-11 03:27:09 -04:00
|
|
|
var cleanPath = path.join(shredOptions.fragmentsDir, '**/*.*')
|
2016-06-05 17:46:52 -04:00
|
|
|
del([ cleanPath, '!**/*.ovr.*']).then(function (err, paths) {
|
2015-08-03 20:45:58 -04:00
|
|
|
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
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',
|
2015-11-04 05:47:05 -05:00
|
|
|
apiExamplesDir: 'test_source',
|
2015-08-11 03:27:09 -04:00
|
|
|
fragmentsDir: 'test_fragments',
|
2015-11-04 05:47:05 -05:00
|
|
|
devguideExamplesDir: 'test_source',
|
2015-08-11 03:27:09 -04:00
|
|
|
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
|
|
|
|