You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2014/01/07 23:59:13 UTC
[2/2] git commit: White space & style fixes.
White space & style fixes.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/9abd3d87
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/9abd3d87
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/9abd3d87
Branch: refs/heads/master
Commit: 9abd3d87d801fa30573fd42b24b97a032b691099
Parents: 6d8c1c7
Author: Mark Koudritsky <ka...@chromium.org>
Authored: Mon Jan 6 22:57:43 2014 -0500
Committer: Braden Shepherdson <br...@chromium.org>
Committed: Tue Jan 7 17:58:30 2014 -0500
----------------------------------------------------------------------
plugman.js | 6 +++---
src/install.js | 37 +++++++++++++++++--------------------
2 files changed, 20 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9abd3d87/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index a7ff484..7f7ac5c 100755
--- a/plugman.js
+++ b/plugman.js
@@ -119,7 +119,7 @@ plugman.commands = {
if (err) throw err;
else {
for(var plugin in plugins) {
- console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
+ console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
}
}
});
@@ -140,7 +140,7 @@ plugman.commands = {
},
'publish' : function(cli_opts) {
- var plugin_path = cli_opts.argv.remain;
+ var plugin_path = cli_opts.argv.remain;
if(!plugin_path) {
return console.log(plugman.help());
}
@@ -151,7 +151,7 @@ plugman.commands = {
},
'unpublish': function(cli_opts) {
- var plugin = cli_opts.argv.remain;
+ var plugin = cli_opts.argv.remain;
if(!plugin) {
return console.log(plugman.help());
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9abd3d87/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 6b09434..37b78e1 100644
--- a/src/install.js
+++ b/src/install.js
@@ -1,9 +1,6 @@
var path = require('path'),
fs = require('fs'),
- fetch = require('./fetch'),
- et = require('elementtree'),
action_stack = require('./util/action-stack'),
- shell = require('shelljs'),
child_process = require('child_process'),
semver = require('semver'),
config_changes = require('./util/config-changes'),
@@ -65,7 +62,7 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options)
function checkEngines(engines) {
for(var i = 0; i < engines.length; i++) {
var engine = engines[i];
- if(semver.satisfies(engine.currentVersion, engine.minVersion) || engine.currentVersion == null){
+ if(semver.satisfies(engine.currentVersion, engine.minVersion) || engine.currentVersion === null){
// engine ok!
}else{
return Q.reject(new Error('Plugin doesn\'t support this project\'s '+engine.name+' version. '+engine.name+': ' + engine.currentVersion + ', failed version requirement: ' + engine.minVersion));
@@ -81,7 +78,7 @@ function cleanVersionOutput(version, name){
var dev_index = out.indexOf('dev');
if (rc_index > -1) {
out = out.substr(0, rc_index) + '-' + out.substr(rc_index);
- }
+ }
// strip out the -dev and put a warning about using the dev branch
if (dev_index > -1) {
@@ -92,22 +89,22 @@ function cleanVersionOutput(version, name){
out = out.substr(0, dev_index-1);
}
require('../plugman').emit('verbose', name+' has been detected as using a development branch. Attemping to install anyways.');
- }
-
+ }
+
// add extra period/digits to conform to semver - some version scripts will output
// just a major or major minor version number
var majorReg = /\d+/,
minorReg = /\d+\.\d+/,
patchReg = /\d+\.\d+\.\d+/;
-
+
if(patchReg.test(out)){
-
+
}else if(minorReg.test(out)){
out = out.match(minorReg)[0]+'.0';
}else if(majorReg.test(out)){
out = out.match(majorReg)[0]+'.0.0';
- }
-
+ }
+
return out;
}
@@ -120,7 +117,7 @@ function callEngineScripts(engines) {
engines.map(function(engine){
// CB-5192; on Windows scriptSrc doesn't have file extension so we shouldn't check whether the script exists
if(isWindows || fs.existsSync(engine.scriptSrc)){
-
+
if(!isWindows) { // not required on Windows
fs.chmodSync(engine.scriptSrc, '755');
}
@@ -154,9 +151,9 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
var uncheckedEngines = [];
var cordovaEngineIndex, cordovaPlatformEngineIndex, theName, platformIndex, defaultPlatformIndex;
// load in known defaults and update when necessary
- engines.forEach(function(engine){
+ engines.forEach(function(engine){
theName = engine.attrib["name"];
-
+
// check to see if the engine is listed as a default engine
if(defaultEngines[theName]){
// make sure engine is for platform we are installing on
@@ -166,11 +163,11 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
defaultEngines[theName].currentVersion = defaultEngines[theName].currentVersion ? defaultEngines[theName].currentVersion : null;
defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? defaultEngines[theName].scriptSrc : null;
defaultEngines[theName].name = theName;
-
+
// set the indices so we can pop the cordova engine when needed
if(theName==='cordova') cordovaEngineIndex = uncheckedEngines.length;
if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
-
+
uncheckedEngines.push(defaultEngines[theName]);
}
// check for other engines
@@ -181,7 +178,7 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
}
}
});
-
+
// make sure we check for platform req's and not just cordova reqs
if(cordovaEngineIndex && cordovaPlatformEngineIndex) uncheckedEngines.pop(cordovaEngineIndex);
return uncheckedEngines;
@@ -222,13 +219,13 @@ var runInstall = module.exports.runInstall = function runInstall(actions, platfo
.then(checkEngines)
.then(function() {
// checking preferences, if certain variables are not provided, we should throw.
- prefs = plugin_et.findall('./preference') || [];
+ var prefs = plugin_et.findall('./preference') || [];
prefs = prefs.concat(plugin_et.findall('./platform[@name="'+platform+'"]/preference'));
var missing_vars = [];
prefs.forEach(function (pref) {
var key = pref.attrib["name"].toUpperCase();
options.cli_variables = options.cli_variables || {};
- if (options.cli_variables[key] == undefined)
+ if (options.cli_variables[key] === undefined)
missing_vars.push(key)
else
filtered_variables[key] = options.cli_variables[key]
@@ -360,7 +357,7 @@ function handleInstall(actions, plugin_id, plugin_et, platform, project_dir, plu
resourceFiles && resourceFiles.forEach(function(resource) {
actions.push(actions.createAction(handler["resource-file"].install, [resource, plugin_dir, project_dir], handler["resource-file"].uninstall, [resource, project_dir]));
});
- // CB-5238 custom frameworks only
+ // CB-5238 custom frameworks only
frameworkFiles && frameworkFiles.forEach(function(framework) {
actions.push(actions.createAction(handler["framework"].install, [framework, plugin_dir, project_dir, plugin_id], handler["framework"].uninstall, [framework, project_dir]));
});