Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2015-06-17 05:31:40 +0300
committerRebecca Turner <me@re-becca.org>2015-06-26 03:27:19 +0300
commit404cbab4908bf41501ad7f9d7c7a28b6aca23056 (patch)
tree1b0e960291b1e5b627a89a7641af3319289c1543
parentb89d8d1507ac13ad0031aae2c14b864484dd5fa4 (diff)
install: Refactor tracker creation/destruction
Add logging of when they're first used and when they're completed.
-rw-r--r--lib/install.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/install.js b/lib/install.js
index 08a24e023..8d18d8dc5 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -198,24 +198,22 @@ Installer.prototype = {}
Installer.prototype.run = function (cb) {
validate('F', arguments)
- this.newTracker(log, 'loadCurrentTree', 4)
- this.newTracker(log, 'loadIdealTree', 12)
- this.newTracker(log, 'generateActionsToTake')
- this.newTracker(log, 'executeActions', 8)
- this.newTracker(log, 'runTopLevelLifecycles', 2)
var installSteps = []
var postInstallSteps = []
installSteps.push(
+ [this.newTracker(log, 'loadCurrentTree', 4)],
[this, this.loadCurrentTree],
[this, this.finishTracker, 'loadCurrentTree'],
+ [this.newTracker(log, 'loadIdealTree', 12)],
[this, this.loadIdealTree],
[this, this.finishTracker, 'loadIdealTree'],
[this, this.debugTree, 'currentTree', 'currentTree'],
[this, this.debugTree, 'idealTree', 'idealTree'],
+ [this.newTracker(log, 'generateActionsToTake')],
[this, this.generateActionsToTake],
[this, this.finishTracker, 'generateActionsToTake'],
@@ -223,12 +221,14 @@ Installer.prototype.run = function (cb) {
[this, this.debugActions, 'decomposeActions', 'todo'])
if (!this.dryrun) {
installSteps.push(
+ [this.newTracker(log, 'executeActions', 8)],
[this, this.executeActions],
[this, this.finishTracker, 'executeActions'],
[this, this.runTopLevelLifecycles])
var node_modules = path.resolve(this.where, 'node_modules')
var staging = path.resolve(node_modules, '.staging')
postInstallSteps.push(
+ [this.newTracker(log, 'runTopLevelLifecycles', 2)],
[this, this.rollbackFailedOptional, staging, this.todo],
[this, this.finishTracker, 'runTopLevelLifecycles'])
@@ -261,11 +261,17 @@ Installer.prototype.newTracker = function (tracker, name, size) {
validate('OS', [tracker, name])
if (size) validate('N', [size])
this.progress[name] = tracker.newGroup(name, size)
+ var self = this
+ return function (next) {
+ self.progress[name].silly(name, 'Starting')
+ next()
+ }
}
-Installer.prototype.finishTracker = function (tracker, cb) {
+Installer.prototype.finishTracker = function (name, cb) {
validate('SF', arguments)
- this.progress[tracker].finish()
+ this.progress[name].silly(name, 'Finishing')
+ this.progress[name].finish()
cb()
}
@@ -281,15 +287,20 @@ Installer.prototype.loadCurrentTree = function (cb) {
Installer.prototype.loadIdealTree = function (cb) {
validate('F', arguments)
log.silly('install', 'loadIdealTree')
- this.newTracker(this.progress.loadIdealTree, 'cloneCurrentTree')
- this.newTracker(this.progress.loadIdealTree, 'loadShrinkwrap')
- this.newTracker(this.progress.loadIdealTree, 'loadAllDepsIntoIdealTree', 10)
+
chain([
+ [this.newTracker(this.progress.loadIdealTree, 'cloneCurrentTree')],
[this, this.cloneCurrentTreeToIdealTree],
[this, this.finishTracker, 'cloneCurrentTree'],
+
+ [this.newTracker(this.progress.loadIdealTree, 'loadShrinkwrap')],
[this, this.loadShrinkwrap],
[this, this.finishTracker, 'loadShrinkwrap'],
+
+ [this.newTracker(this.progress.loadIdealTree, 'loadAllDepsIntoIdealTree', 10)],
[this, this.loadAllDepsIntoIdealTree],
+ [this, this.finishTracker, 'loadAllDepsIntoIdealTree'],
+
[this, function (next) { recalculateMetadata(this.idealTree, log, next) } ],
[this, this.debugTree, 'idealTree:prePrune', 'idealTree'],
[this, function (next) { next(pruneTree(this.idealTree)) } ]