Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 1cd07e5

Browse files
author
Lucas Rojas
committed
Clean comments from packagetools.js
1 parent afec264 commit 1cd07e5

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

lib/packageTools.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ var packageJson = 'package.json';
1919
var installTask;
2020
var installQueue = [];
2121

22-
// downloads a file
2322
function downloadFile (inputUri, callback) {
2423

2524
var uri = url.parse(inputUri);
@@ -44,7 +43,6 @@ function downloadFile (inputUri, callback) {
4443
return deferred.resolve({ 'statusCode': res.statusCode, 'statusMessage': res.statusMessage, 'contentType': res.headers['content-type'], 'data': buffer });
4544
}
4645

47-
// If status is Moved Permanently or Found, redirect to new URL
4846
if ([301, 302].indexOf(res.statusCode) > -1) {
4947
return downloadFile(res.headers.location)
5048
.then(function (result) { deferred.resolve(result); })
@@ -62,7 +60,6 @@ function downloadFile (inputUri, callback) {
6260
return deferred.promise.nodeify(callback);
6361
}
6462

65-
// returns package information (package.json) given a package name
6663
function getPackageInformation (packageName, parentPackagePath) {
6764

6865
try {
@@ -94,7 +91,6 @@ function getPackageInformation (packageName, parentPackagePath) {
9491
throw new Error('Error retrieving information for module: \'' + (packageName || 'main') + '\'.');
9592
}
9693

97-
// returns package information (package.json) given a file or directory
9894
function getModuleInformation (dir) {
9995

10096
try {
@@ -124,7 +120,6 @@ function getModuleInformation (dir) {
124120
throw new Error('Error retrieving information for module: \'' + (dir || 'main') + '\'.');
125121
}
126122

127-
// get package information from the npm registry
128123
function getNpmPackageInfo (packageName, callback) {
129124
var deferred = Q.defer();
130125
http.get('http://registry.npmjs.org/' + packageName + '/latest', function (res) {
@@ -155,7 +150,6 @@ function getNpmPackageInfo (packageName, callback) {
155150
return deferred.promise.nodeify(callback);
156151
}
157152

158-
// get package information from a GitHub repository
159153
function getGitHubPackageInformation (repositoryUrl, callback) {
160154

161155
var src = url.parse(repositoryUrl);
@@ -187,15 +181,13 @@ function getGitHubPackageInformation (repositoryUrl, callback) {
187181
});
188182
}
189183

190-
// get the latest version for an npm package
191184
function getNpmPackageLatestVersion (packageName, callback) {
192185
return getNpmPackageInfo(packageName).then(function (packageJson) {
193186
return packageJson.version;
194187
})
195188
.nodeify(callback);
196189
}
197190

198-
// checks for updates to the application
199191
function checkForUpdate (callback) {
200192

201193
var mainModule = getPackageInformation();
@@ -206,12 +198,10 @@ function checkForUpdate (callback) {
206198
.nodeify(callback);
207199
}
208200

209-
// installs an npm package
210201
function installPackage (packageName, source, callback) {
211202

212203
log.info('Installing new module: ' + packageName);
213204

214-
// npm command in Windows is a batch file and needs to include extension to be resolved by spawn call
215205
var npm = (process.platform === 'win32' ? 'npm.cmd' : 'npm');
216206
var appRoot = path.dirname(utils.getRootPackagePath());
217207
return exec(npm, ['install', source], { cwd: appRoot, statusMessage: 'Installing package ' }).then(function () {
@@ -240,7 +230,6 @@ function queuePackageInstallation (packageName, source, callback) {
240230
return installTask.promise.nodeify(callback);
241231
}
242232

243-
// Triggers the installation of all queued npm packages.
244233
function installQueuedPackages () {
245234

246235
if (installQueue.length === 0) {
@@ -251,25 +240,20 @@ function installQueuedPackages () {
251240

252241
log.info('Installing the following module(s): \'' + moduleList + '\'...');
253242

254-
// npm command in Windows is a batch file and needs to include extension to be resolved by spawn call
255243
var npm = (process.platform === 'win32' ? 'npm.cmd' : 'npm');
256244
var appRoot = path.dirname(utils.getRootPackagePath());
257245

258-
// build package list
259246
var sources = installQueue.map(function (item) {
260247
return item.source;
261248
});
262249

263-
// launch npm
264250
return exec(npm, ['install'].concat(sources), { cwd: appRoot, statusMessage: 'Installing packages ' }).then(function () {
265-
// signal completion
266251
installTask.resolve(installQueue);
267252
})
268253
.catch(function (err) {
269254
return installTask.reject(new CustomError('Failed to install the following module(s): \'' + moduleList + '\'.', err));
270255
})
271256
.finally(function () {
272-
// clear queue
273257
installTask = undefined;
274258
installQueue = [];
275259
});

0 commit comments

Comments
 (0)