Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Jul 10, 2014
1 parent 48633be commit 13b2806
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Compiler.prototype.compile = function() {


Compiler.prototype._render = function(path, template, callback) {
this._gather_info(function (err, pkg, tree) {
this._gather_info(function (err, pkg, tree, shrinkwrap) {
if (err) {
return callback(err);
}
Expand All @@ -62,6 +62,7 @@ Compiler.prototype._render = function(path, template, callback) {
pkg: pkg,
tree: tree,
cwd: this.cwd,
shrinkwrap: shrinkwrap,
path: path,
href_root: this.href_root
}).compile(template);
Expand All @@ -78,8 +79,8 @@ Compiler.prototype._render = function(path, template, callback) {


Compiler.prototype._gather_info = function(callback) {
if (this.pkg || this.tree) {
return callback(null, this.pkg, this.tree);
if (this.pkg && this.tree && this.shrinkwrap) {
return callback(null, this.pkg, this.tree, this.shrinkwrap);
}

var self = this;
Expand All @@ -88,14 +89,15 @@ Compiler.prototype._gather_info = function(callback) {
return callback(err);
}

self._read_tree(pkg, function (err, tree) {
self._read_tree(pkg, function (err, tree, shrinkwrap) {
if (err) {
return callback(err);
}

self.pkg = pkg;
self.tree = tree;
callback(null, self.pkg, self.tree);
self.shrinkwrap = shrinkwrap;
callback(null, self.pkg, tree, shrinkwrap);
});
});
};
Expand Down

0 comments on commit 13b2806

Please sign in to comment.