Skip to content

Commit

Permalink
Revert "fix path resolution"
Browse files Browse the repository at this point in the history
This reverts commit 7df91ce.
  • Loading branch information
possibilities committed Sep 8, 2012
1 parent 205940a commit d91cad4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Config = function(root) {
if (this.packages)
_.each(this.packages, function(pkgConfig) {
if (pkgConfig.path)
pkgConfig.resolvedPath = path.resolve(root, pkgConfig.path);
pkgConfig.path = path.resolve(root, pkgConfig.path);
});
}
};
Expand Down
22 changes: 10 additions & 12 deletions lib/dependencies/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ Package.prototype.installInto = function(project, fn) {

// Make link if it doesn't exist, inform caller
if (! linkedTo) {
var libPath = path.resolve(self.root, self.libPath());
fs.symlinkSync(libPath, packagePath);
fs.symlinkSync(self.libPath(), packagePath);
fn(true);
} else {
fn(false);
Expand Down Expand Up @@ -166,24 +165,23 @@ Package.prototype.overrides = function(otherPkg) {

// FIXME: this assumes that we have fetched, which in general may not be the case.
Package.prototype.libPath = function() {
var self = this;

var libPath;

// TODO: consider using wrench.readdirRecursive for this? (just a suggestion)

// Go spelunking until we find a package.js so
// we know where the root of the package lib is
var findPackage = function(packageRoot) {
var rootPath = path.resolve(self.source.config.resolvedPath, packageRoot);

_.each(fs.readdirSync(rootPath), function(fileName) {
var filePath = path.join(rootPath, fileName);

if (fs.lstatSync(filePath).isDirectory())
var findPackage = function(root) {
var rootStat = fs.lstatSync(root);
_.each(fs.readdirSync(root), function(fileName) {
var filePath = path.join(root, fileName);
var fileStat = fs.lstatSync(filePath);
if (fileStat.isDirectory()) {
findPackage(filePath);
else if (fileName === 'package.js')
} else if (fileName === 'package.js') {
libPath = path.dirname(filePath);

}
});
};

Expand Down
5 changes: 2 additions & 3 deletions lib/sources/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var fs = require('fs');

// NOTE: config.path MUST be absolute. Otherwise behaviour is undefined
LocalSource = function(basePath, config) {
this.config = config;
this.path = config.path;
};

Expand All @@ -20,8 +19,8 @@ LocalSource.prototype.equals = function(otherSource) {
};

LocalSource.prototype.fetch = function(fn) {
if (!fs.existsSync(this.config.resolvedPath))
throw 'Path does not exist: ' + this.config.resolvedPath;
if (!fs.existsSync(this.path))
throw 'Path does not exist: ' + this.path;

fn();
};
Expand Down

0 comments on commit d91cad4

Please sign in to comment.