summaryrefslogtreecommitdiffstats
path: root/lib/generate
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generate')
-rw-r--r--lib/generate/index.js44
1 files changed, 39 insertions, 5 deletions
diff --git a/lib/generate/index.js b/lib/generate/index.js
index a06aa8b..4b81d8f 100644
--- a/lib/generate/index.js
+++ b/lib/generate/index.js
@@ -1,11 +1,48 @@
var Q = require("q");
var _ = require("lodash");
+
var path = require("path");
-var glob = require("glob");
+var Ignore = require("fstream-ignore");
+
var fs = require("./fs");
var parse = require("../parse");
var template = require("./template");
+
+
+function getFiles(path) {
+ var d = Q.defer();
+
+ // Our list of files
+ var files = [];
+
+ var ig = Ignore({
+ path: path,
+ ignoreFiles: ['.ignore', '.gitignore']
+ });
+
+ // Add extra rules to ignore common folders
+ ig.addIgnoreRules([
+ '.git/'
+ ], '__custom_stuff');
+
+ // Push each file to our list
+ ig.on('child', function (c) {
+ files.push(
+ c.path.substr(c.root.path.length + 1) + (c.props.Directory === true ? '/' : '')
+ );
+ });
+
+ ig.on('end', function() {
+ d.resolve(files);
+ });
+
+ ig.on('error', d.reject);
+
+ return d.promise;
+}
+
+
var generate = function(root, output, options) {
var files, summary, navigation, tpl;
@@ -29,10 +66,7 @@ var generate = function(root, output, options) {
// List all files in the repository
.then(function() {
- return Q.nfcall(glob, "**/*", {
- cwd: root,
- mark: true
- });
+ return getFiles(root);
})
// Check repository is valid