Brocfile.js
function getSourceTrees(pathsToSearch) {
	return {
		read: function(readTree) {
			var promises = _.map(pathsToSearch, function(path) {
				return new Promise(function(resolve) {
					fs.exists(path, function(exists) {
						resolve((exists) ? path : null);
					});
				});
			});

			return Promise.all(promises)
				.then(function(paths) {
					paths = _.filter(paths);
					if (paths.length === 0) throw new Error('No source paths found');
					return paths;
				})
				.then(function(paths) {
					console.log('Found source paths: ' + paths.join(', '));

					var pathTrees = _.map(paths, function(path) {
						return new Funnel(path, { srcDir: '.', destDir: path });
					});

					return readTree(mergeTrees(pathTrees));
				});
		},

		cleanup: function() {}
	};
}
function getSourceTrees(pathsToSearch) {
	return {
		read: function(readTree) {
			var promises = _.map(pathsToSearch, function(path) {
				return new Promise(function(resolve) {
					fs.exists(path, function(exists) {
						resolve((exists) ? path : null);
					});
				});
			});

			return Promise.all(promises)
				.then(function(paths) {
					paths = _.filter(paths);
					if (paths.length === 0) throw new Error('No source paths found');
					return paths;
				})
				.then(function(paths) {
					console.log('Found source paths: ' + paths.join(', '));

					var pathTrees = _.map(paths, function(path) {
						return new Funnel(path, { srcDir: '.', destDir: path });
					});

					return readTree(mergeTrees(pathTrees));
				});
		},

		cleanup: function() {}
	};
}
function getSourceTrees ( pathsToSearch ) { return { read : function ( readTree ) { var promises = _ . map ( pathsToSearch , function ( path ) { return new Promise ( function ( resolve ) { fs . exists ( path , function ( exists ) { resolve ( ( exists ) ? path : null ) ; } ) ; } ) ; } ) ; return Promise . all ( promises ) . then ( function ( paths ) { paths = _ . filter ( paths ) ; if ( paths . length === 0 ) throw new Error ( 'No source paths found' ) ; return paths ; } ) . then ( function ( paths ) { console . log ( 'Found source paths: ' + paths . join ( ', ' ) ) ; var pathTrees = _ . map ( paths , function ( path ) { return new Funnel ( path , { srcDir : '.' , destDir : path } ) ; } ) ; return readTree ( mergeTrees ( pathTrees ) ) ; } ) ; } , cleanup : function ( ) { } } ; }
Returns a broc tree corresponding to the original source files
Returns a broc tree corresponding to the original source files