Permalink
Browse files

[fix] #55 package.write after filling out package.json was forcing a …

…2nd analyze. Since no deps can be added during filling, don't do that.
  • Loading branch information...
bmeck committed Aug 9, 2011
1 parent bc9e08f commit 30b329ce36796fd9e544fe1a88d8aa5494876a40
Showing with 11 additions and 6 deletions.
  1. +11 −6 lib/jitsu/package.js
View
@@ -107,9 +107,12 @@ package.tryRead = function (dir, callback, success) {
function tryAnalyze (target, dir, callback) {
+ if(target.analyzed) {
+ return callback(false, target);
+ }
var resolve = jitsu.config.get('resolveDependencies'),
analyze = (resolve === undefined ? !optimist.argv.noanalyze : !resolve);
-
+
if(!analyze) {
winston.info('skipping require-analyzer because ' + '--noanalyze'.magenta + ' option is set');
return callback(null, pkg);
@@ -121,6 +124,7 @@ function tryAnalyze (target, dir, callback) {
return callback(err);
}
+ target.analyzed = true;
return updates ? package.write(addedDeps, dir, true, callback) : callback(null, addedDeps);
});
}
@@ -264,12 +268,12 @@ package.validate = function (pkg, dir, options, callback) {
fillPackage(pkg, dir, function(err, pkg) {
if(err) {
return callback(err);
- }
- package.write(pkg, dir, true, function(err, pkg) {
- if (err) {
- return callback(err);
}
- tryAnalyze(pkg, dir, callback);
+ package.write(pkg, dir, true, function(err, pkg) {
+ if (err) {
+ return callback(err);
+ }
+ return tryAnalyze(pkg, dir, callback);
});
});
}
@@ -293,6 +297,7 @@ package.write = function (pkg, dir, create, callback) {
callback = create;
create = null;
}
+ delete pkg.analyzed;
winston.warn('About to write ' + path.join(dir, 'package.json').magenta);
jitsu.log.putObject(pkg, 2);

0 comments on commit 30b329c

Please sign in to comment.