Permalink
Browse files

Fix js-doc-parse running on Windows without msys/cygwin.

  • Loading branch information...
1 parent f2d072a commit e916db3b76c67fed67574d35dba4c181d683824e @csnover committed Mar 3, 2013
Showing with 13 additions and 11 deletions.
  1. +3 −2 config.js
  2. +9 −8 lib/File.js
  3. +1 −1 parse.bat
View
@@ -42,7 +42,7 @@ define({
},
// The base path for all the packages being processed.
- basePath: '../dojo-trunk/183',
+ basePath: '../dojo-trunk',
// The packages to be processed by the parser. The key is the name of the package, and the value is the
// location of the package relative to basePath.
@@ -53,7 +53,8 @@ define({
doh: 'util/doh'
},
- // An array of regular expressions that match file paths that should be skipped.
+ // An array of regular expressions that match file paths that should be skipped. Note that since these are file
+ // paths, not module IDs, if you are using Windows, you need to use backslashes!
excludePaths: [
// Non-API code
/\/(?:tests|nls|demos)\//,
View
@@ -14,13 +14,10 @@ define([ './env', './node!fs', './node!path' ], function (env, fs, pathUtil) {
var packageLocation = typeof packages[packageName] === 'string' ?
packages[packageName] :
packages[packageName].location,
- pathPrefix = pathUtil.normalize(basePath + packageLocation);
- // Avoid accidental matching of partial paths in cases, i.e. "/foo/bar" incorrectly matching
- // "/foo/barbaz"
- if (pathPrefix.charAt(pathPrefix.length - 1) !== '/') {
- pathPrefix += '/';
- }
+ // Slash at end of prefix avoids accidental matching of partial paths in cases, i.e. "/foo/bar"
+ // incorrectly matching "/foo/barbaz"
+ pathPrefix = pathUtil.join(basePath, packageLocation, '/');
if (path.indexOf(pathPrefix) === 0) {
moduleId = packageName + '/' + path.substr(pathPrefix.length);
@@ -41,7 +38,11 @@ define([ './env', './node!fs', './node!path' ], function (env, fs, pathUtil) {
path + ' is inside the defined basePath or is defined explicitly as a package in config.js.');
}
- return moduleId.replace(/\.js$/g, '').replace(/\\/g, '/');
+ return moduleId
+ // File to module id
+ .replace(/\.js$/g, '')
+ // Windows path to module id
+ .replace(/\\/g, '/');
}
function File(/**string*/ filename) {
@@ -96,7 +97,7 @@ define([ './env', './node!fs', './node!path' ], function (env, fs, pathUtil) {
moduleId = this.moduleId.replace(/\/[^\/]+$/, '/') + moduleId;
}
- moduleId = pathUtil.normalize(moduleId);
+ moduleId = pathUtil.normalize(moduleId).replace(/\\/g, '/');
var packageInfo;
if (moduleId.indexOf('/') === -1 && (packageInfo = env.config.packages[moduleId])) {
View
@@ -1 +1 @@
-node dojo/dojo.js load=parse %1
+node parse.js %1

0 comments on commit e916db3

Please sign in to comment.