Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Wildcard excluding works now, to exclude entire directories

  • Loading branch information...
commit 128635c7000036edd0acf236cba0252508e89198 1 parent 0cf1362
Diogenes Brito authored
Showing with 25 additions and 5 deletions.
  1. +25 −5 lib/yuidoc.js
View
30 lib/yuidoc.js
@@ -109,6 +109,14 @@ YUI.add('yuidoc', function(Y) {
_processConfig: function() {
this.options.extensions = Y.Array.hash(this.options.extension.split(','));
this.options.excludes = Y.Array.hash(this.options.exclude.split(','));
+ this.options.wildcardExcludes = {};
+ var excludesArray = Y.Object.keys(this.options.excludes);
+ for (var i = 0; i < excludesArray.length; i++) {
+ var exclude = excludesArray[i];
+ if (exclude.charAt(exclude.length - 1) === "*") {
+ this.options.wildcardExcludes[exclude.substring(0, exclude.length - 1)] = true;
+ }
+ }
},
/**
* Walks the paths and parses the directory contents
@@ -131,12 +139,24 @@ YUI.add('yuidoc', function(Y) {
throw('Can not find directory: ' + dir);
}
var allfiles = fs.readdirSync(dir), stats,
- files = [], fullpath, self = this;
-
+ files = [], fullpath, excluded, self = this;
+
Y.each(allfiles, function(filename) {
- if (!(filename in self.options.excludes)) {
- fullpath = path.join(dir, filename);
-
+ fullpath = path.join(dir, filename);
+
+ // check if file is excluded
+ excluded = false;
+ if (filename in self.options.excludes) {
+ excluded = true;
+ } else {
+ for (var exclude in self.options.wildcardExcludes) {
+ if (fullpath.indexOf(exclude) === 0) {
+ excluded = true;
+ }
+ }
+ }
+
+ if (!excluded) {
stats = fs.statSync(fullpath);
if (stats.isDirectory() && !self.options.norecurse) {
Please sign in to comment.
Something went wrong with that request. Please try again.