Skip to content
Browse files

Support symlinks as input directories.

  • Loading branch information...
1 parent ca0e5c2 commit 4d7e83f0ba7eb99696ff9668824d39980fd168dc @rgrove committed Jul 29, 2011
Showing with 9 additions and 8 deletions.
  1. +1 −0 HISTORY.md
  2. +3 −3 lib/fileutils.js
  3. +5 −5 lib/selleck.js
View
1 HISTORY.md
@@ -11,6 +11,7 @@ Selleck History
of the partially-merged metadata that was included before.
* Views for non-component and non-example pages now have a boolean `page`
property that's set to `true` (examples similarly have an `example` property).
+* Fixed a bug that prevented symlinked input directories from being recognized.
0.1.4 (2011-06-28)
View
6 lib/fileutils.js
@@ -34,7 +34,7 @@ function copyDirectory(source, dest, overwrite, callback) {
if (err && err.code !== 'ENOENT') { return callback(err); }
if (stats) {
- // If the destination is a file or a link, either delete it or
+ // If the destination is a file or a link, either delete it or
// bubble an error if overwrite isn't true.
if (stats.isFile() || stats.isSymbolicLink()) {
if (overwrite) {
@@ -187,8 +187,8 @@ exports.deletePath = deletePath;
/**
@method isDirectory
**/
-function isDirectory(path) {
- var stats = lstatSync(path);
+function isDirectory(path, allowSymLink) {
+ var stats = (allowSymLink ? statSync : lstatSync)(path);
return stats ? stats.isDirectory() : false;
}
exports.isDirectory = isDirectory;
View
10 lib/selleck.js
@@ -49,7 +49,7 @@ function copyAssets() {
to = args.shift(),
deleteFirst = args.shift();
- if (fileutils.isDirectory(from)) {
+ if (fileutils.isDirectory(from, true)) {
if (deleteFirst && fileutils.isDirectory(to)) {
fileutils.deletePath(to);
}
@@ -68,7 +68,7 @@ Creates the specified output directory if it doesn't already exist.
@param {String} outDir Output directory.
**/
function createOutputDir(outDir) {
- var stats = fileutils.lstatSync(outDir);
+ var stats = fileutils.statSync(outDir);
if (stats) {
if (!stats.isDirectory()) {
@@ -88,7 +88,7 @@ exports.createOutputDir = createOutputDir;
function findDocs(dir, docs) {
docs || (docs = {components: []});
- if (!fileutils.isDirectory(dir)) {
+ if (!fileutils.isDirectory(dir, true)) {
log('Not a directory: ' + dir, 'error');
return docs;
}
@@ -108,7 +108,7 @@ function findDocs(dir, docs) {
// Skip hidden files and directories.
if (filename.indexOf('.') === 0) { return; }
- if (fileutils.isDirectory(filePath)) {
+ if (fileutils.isDirectory(filePath, true)) {
findDocs(filePath, docs);
}
});
@@ -208,7 +208,7 @@ preceding the .mustache extension) to page content.
function getPages(dir) {
var pages = {};
- if (!fileutils.isDirectory(dir)) { return pages; }
+ if (!fileutils.isDirectory(dir, true)) { return pages; }
fs.readdirSync(dir).forEach(function (filename) {
var filePath = path.join(dir, filename);

0 comments on commit 4d7e83f

Please sign in to comment.
Something went wrong with that request. Please try again.