refact(doc-shredder): move into `tools` folder
This commit is contained in:
parent
a06b98ba75
commit
ce298009e6
|
@ -37,8 +37,9 @@ gulp.task('watch', function (cb) {
|
||||||
gulp.task('map', function() {
|
gulp.task('map', function() {
|
||||||
var options = {
|
var options = {
|
||||||
jadeDir: 'test_jade',
|
jadeDir: 'test_jade',
|
||||||
examplesDir: 'test_source',
|
apiExamplesDir: 'test_source',
|
||||||
fragmentsDir: 'test_fragments',
|
fragmentsDir: 'test_fragments',
|
||||||
|
devguideExamplesDir: 'test_source',
|
||||||
outputDir: '.'
|
outputDir: '.'
|
||||||
}
|
}
|
||||||
return docShredder.buildShredMap(options).then(function(x) {
|
return docShredder.buildShredMap(options).then(function(x) {
|
|
@ -62,11 +62,11 @@ function createShredPackage(shredOptions) {
|
||||||
var options = resolveShredOptions(shredOptions);
|
var options = resolveShredOptions(shredOptions);
|
||||||
|
|
||||||
initializePackage(pkg)
|
initializePackage(pkg)
|
||||||
.factory(require('./fileShredder'))
|
.factory(require('./fileReaders/regionFileReader'))
|
||||||
.processor(require('./mdWrapperProcessor'))
|
.processor(require('./processors/renderAsMarkdownProcessor'))
|
||||||
|
|
||||||
.config(function(readFilesProcessor, fileShredder ) {
|
.config(function(readFilesProcessor, regionFileReader) {
|
||||||
readFilesProcessor.fileReaders = [ fileShredder];
|
readFilesProcessor.fileReaders = [regionFileReader];
|
||||||
})
|
})
|
||||||
// default configs - may be overriden
|
// default configs - may be overriden
|
||||||
.config(function(readFilesProcessor) {
|
.config(function(readFilesProcessor) {
|
||||||
|
@ -106,8 +106,8 @@ var createShredMapPackage = function(mapOptions) {
|
||||||
var options = resolveMapOptions(mapOptions);
|
var options = resolveMapOptions(mapOptions);
|
||||||
|
|
||||||
initializePackage(pkg)
|
initializePackage(pkg)
|
||||||
.factory(require('./extractPathsReader'))
|
.factory(require('./fileReaders/extractPathsReader'))
|
||||||
.processor(require('./shredMapProcessor'))
|
.processor(require('./processors/shredMapProcessor'))
|
||||||
.config(function(shredMapProcessor) {
|
.config(function(shredMapProcessor) {
|
||||||
shredMapProcessor.options = options;
|
shredMapProcessor.options = options;
|
||||||
})
|
})
|
||||||
|
@ -180,11 +180,12 @@ var createShredMapPackage = function(mapOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveShredOptions(shredOptions) {
|
function resolveShredOptions(shredOptions) {
|
||||||
|
var DOCS_FOLDER = '../../public/docs';
|
||||||
var so = _.defaults({}, shredOptions, {
|
var so = _.defaults({}, shredOptions, {
|
||||||
// read files from any subdir under here
|
// read files from any subdir under here
|
||||||
examplesDir: "./docs/_examples",
|
examplesDir: path.join(DOCS_FOLDER, "_examples"),
|
||||||
// shredded files get copied here with same subdir structure.
|
// shredded files get copied here with same subdir structure.
|
||||||
fragmentsDir: "./docs/_fragments",
|
fragmentsDir: path.join(DOCS_FOLDER, "_fragments"),
|
||||||
// whether to include subdirectories when shredding.
|
// whether to include subdirectories when shredding.
|
||||||
includeSubdirs: true
|
includeSubdirs: true
|
||||||
});
|
});
|
|
@ -1,13 +1,13 @@
|
||||||
var regionExtractor = require('./regionExtractor');
|
var regionExtractor = require('../regionExtractor');
|
||||||
var buildRegionDocs = regionExtractor.buildRegionDocs;
|
var buildRegionDocs = regionExtractor.buildRegionDocs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dgService htmlFileShredder
|
* @dgService
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
module.exports = function fileShredder(log ) {
|
module.exports = function regionFileReader(log ) {
|
||||||
return {
|
return {
|
||||||
name: 'fileShredder',
|
name: 'regionFileReader',
|
||||||
|
|
||||||
getDocs: function (fileInfo) {
|
getDocs: function (fileInfo) {
|
||||||
// log.info("fileShredder processing: " + fileInfo.relativePath);
|
// log.info("fileShredder processing: " + fileInfo.relativePath);
|
|
@ -1,9 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* dgProcessor shredderProcessor
|
* dgProcessor
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
module.exports = function mdWrapperProcessor(log) {
|
module.exports = function renderAsMarkdownProcessor() {
|
||||||
return {
|
return {
|
||||||
$runAfter: ['readFilesProcessor'],
|
$runAfter: ['readFilesProcessor'],
|
||||||
$runBefore: ['writing-files'],
|
$runBefore: ['writing-files'],
|
Loading…
Reference in New Issue