Repository: cordova-lib
Updated Branches:
refs/heads/master bf2745e7d -> f9a81e4f3
CB-6973: Fix JSHint errors in src/plugman/*.js
Add JSHint config comment in all the files (sometimes with tweaks)
/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
indent:4, unused:vars, latedef:nofunc
*/
JSHint is now happy for both src/cordova/*.js and src/plugman/*.js
not including subdirs.
Use
npm run jshint
to run jshint on all the files that have been fixed so far.
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/f9a81e4f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/f9a81e4f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/f9a81e4f
Branch: refs/heads/master
Commit: f9a81e4f38a70be50c1133d335553f4841ba98f4
Parents: bf2745e
Author: Mark Koudritsky <[email protected]>
Authored: Wed Jun 18 15:14:26 2014 -0400
Committer: Mark Koudritsky <[email protected]>
Committed: Wed Jun 18 15:14:26 2014 -0400
----------------------------------------------------------------------
cordova-lib/package.json | 2 +-
cordova-lib/src/plugman/adduser.js | 9 +++-
cordova-lib/src/plugman/config.js | 11 +++--
cordova-lib/src/plugman/create.js | 20 +++++----
cordova-lib/src/plugman/fetch.js | 11 +++--
cordova-lib/src/plugman/info.js | 9 +++-
cordova-lib/src/plugman/install.js | 4 +-
cordova-lib/src/plugman/owner.js | 5 +++
cordova-lib/src/plugman/platform.js | 8 +++-
cordova-lib/src/plugman/platform_operation.js | 5 +++
cordova-lib/src/plugman/platforms.js | 5 +++
cordova-lib/src/plugman/plugman.js | 28 ++++++------
cordova-lib/src/plugman/prepare-browserify.js | 29 +++++++------
cordova-lib/src/plugman/publish.js | 9 +++-
cordova-lib/src/plugman/search.js | 9 +++-
cordova-lib/src/plugman/uninstall.js | 50 ++++++++++++----------
cordova-lib/src/plugman/unpublish.js | 9 +++-
17 files changed, 147 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index 7da791c..bb2744d 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -43,7 +43,7 @@
},
"scripts": {
"test": "npm run jasmine && npm run jshint",
- "jshint": "jshint src/cordova/*.js",
+ "jshint": "jshint src/cordova/*.js src/plugman/*.js",
"jasmine": "jasmine-node --color spec-plugman spec-cordova"
},
"contributors": [
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/adduser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/adduser.js
b/cordova-lib/src/plugman/adduser.js
index b6267c5..474edc6 100644
--- a/cordova-lib/src/plugman/adduser.js
+++ b/cordova-lib/src/plugman/adduser.js
@@ -16,8 +16,13 @@
specific language governing permissions and limitations
under the License.
*/
-var registry = require('./registry/registry')
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
+var registry = require('./registry/registry');
module.exports = function() {
return registry.adduser(null);
-}
+};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/config.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/config.js
b/cordova-lib/src/plugman/config.js
index 678bfd3..7e68207 100644
--- a/cordova-lib/src/plugman/config.js
+++ b/cordova-lib/src/plugman/config.js
@@ -16,8 +16,13 @@
specific language governing permissions and limitations
under the License.
*/
-var registry = require('./registry/registry')
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
+var registry = require('./registry/registry');
module.exports = function(params) {
- return registry.config(params)
-}
+ return registry.config(params);
+};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/create.js
b/cordova-lib/src/plugman/create.js
index 919f5e2..684b126 100644
--- a/cordova-lib/src/plugman/create.js
+++ b/cordova-lib/src/plugman/create.js
@@ -16,6 +16,11 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
var Q = require('q'),
fs = require('fs'),
path = require('path'),
@@ -24,14 +29,13 @@ var Q = require('q'),
CordovaError = require('../CordovaError');
module.exports = function create( name, id, version, pluginPath, options ) {
- var cwd = pluginPath + "/" + name + "/",
+ var cwd = pluginPath + '/' + name + '/',
templatesDir = path.join(__dirname, '..', '..', 'templates/'),
baseJS,
root,
pluginName,
clobber,
- jsMod,
- pluginxml;
+ jsMod;
//check we are not already in a plugin
if( fs.existsSync( cwd + 'plugin.xml' ) ) {
@@ -46,20 +50,20 @@ module.exports = function create( name, id, version,
pluginPath, options ) {
root.set( 'version', version );
//Add the name tag
- pluginName = et.XML( "<name>" );
+ pluginName = et.XML( '<name>' );
pluginName.text = name;
root.append( pluginName );
//loop through the options( variables ) for other tags
for( var key in options ) {
- var temp = et.XML( "<" + key + ">");
+ var temp = et.XML( '<' + key + '>');
temp.text = options[ key ];
root.append( temp );
}
//setup the directory structure
- shell.mkdir( '-p', cwd + "www" );
- shell.mkdir( '-p', cwd + "src" );
+ shell.mkdir( '-p', cwd + 'www' );
+ shell.mkdir( '-p', cwd + 'src' );
//create a base plugin.js file
baseJS = fs.readFileSync( templatesDir + 'base.js', 'utf-8').replace(
/%pluginName%/g, name );
@@ -76,7 +80,7 @@ module.exports = function create( name, id, version,
pluginPath, options ) {
root.append( jsMod );
//Write out the plugin.xml file
- fs.writeFileSync( cwd + "plugin.xml", new et.ElementTree( root ).write(
{indent: 4} ), 'utf-8' );
+ fs.writeFileSync( cwd + 'plugin.xml', new et.ElementTree( root ).write(
{indent: 4} ), 'utf-8' );
return Q();
};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index a3d095c..0292ad1 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -16,6 +16,11 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
var shell = require('shelljs'),
fs = require('fs'),
url = require('url'),
@@ -127,7 +132,7 @@ module.exports = function fetchPlugin(plugin_src,
plugins_dir, options) {
function readId(dir) {
var xml_path = path.join(dir, 'plugin.xml');
- var et = xml_helpers.parseElementtreeSync(path.join(dir, 'plugin.xml'));
+ var et = xml_helpers.parseElementtreeSync(xml_path);
var plugin_id = et.getroot().attrib.id;
return plugin_id;
}
@@ -190,8 +195,8 @@ function copyPlugin(plugin_dir, plugins_dir, link) {
var data = {
source: {
- type: 'local',
- path: plugin_dir
+ type: 'local',
+ path: plugin_dir
}
};
metadata.save_fetch_metadata(dest, data);
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/info.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/info.js b/cordova-lib/src/plugman/info.js
index 8594c55..90bf40c 100644
--- a/cordova-lib/src/plugman/info.js
+++ b/cordova-lib/src/plugman/info.js
@@ -16,9 +16,14 @@
specific language governing permissions and limitations
under the License.
*/
-var registry = require('./registry/registry')
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
+var registry = require('./registry/registry');
// Returns a promise.
module.exports = function(plugin) {
return registry.info(plugin);
-}
+};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js
b/cordova-lib/src/plugman/install.js
index edd5932..2948130 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -453,7 +453,7 @@ function tryFetchDependency(dep, install, options) {
relativePath = path.resolve(install.top_plugin_dir, '../' + dep.url);
if( fs.existsSync(relativePath) ) {
- dep.url = relativePath;
+ dep.url = relativePath;
}
}
@@ -478,7 +478,7 @@ function installDependency(dep, install, options) {
is_top_level: false
});
- return runInstall(install.actions, install.platform,
install.project_dir, dep.install_dir, install.plugins_dir, opts);
+ return runInstall(install.actions, install.platform,
install.project_dir, dep.install_dir, install.plugins_dir, opts);
} else {
events.emit('verbose', 'Dependent plugin "' + dep.id + '" not fetched,
retrieving then installing.');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/owner.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/owner.js b/cordova-lib/src/plugman/owner.js
index 542d0a3..f059c54 100644
--- a/cordova-lib/src/plugman/owner.js
+++ b/cordova-lib/src/plugman/owner.js
@@ -16,6 +16,11 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
var registry = require('./registry/registry');
// Returns a promise.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platform.js
b/cordova-lib/src/plugman/platform.js
index d37e054..414e975 100644
--- a/cordova-lib/src/plugman/platform.js
+++ b/cordova-lib/src/plugman/platform.js
@@ -16,6 +16,12 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ quotmark:false
+*/
+
var Q = require('q'),
et = require('elementtree'),
fs = require('fs'),
@@ -60,7 +66,7 @@ module.exports = {
}
//Get the current plugin.xml file
- pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
+ var pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
//Check if this platform exists
if( !pluginxml.find("./platform/[@name='"+ platformName +"']") ) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/platform_operation.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platform_operation.js
b/cordova-lib/src/plugman/platform_operation.js
index 91acf2d..01a1303 100644
--- a/cordova-lib/src/plugman/platform_operation.js
+++ b/cordova-lib/src/plugman/platform_operation.js
@@ -16,6 +16,11 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
var platform = require('./platform');
module.exports = function( args ) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/platforms.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms.js
b/cordova-lib/src/plugman/platforms.js
index 72081e5..4ebdc49 100644
--- a/cordova-lib/src/plugman/platforms.js
+++ b/cordova-lib/src/plugman/platforms.js
@@ -16,6 +16,11 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
module.exports = {
'android': require('./platforms/android'),
'amazon-fireos': require('./platforms/amazon-fireos'),
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/plugman.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/plugman.js
b/cordova-lib/src/plugman/plugman.js
index 73d83cf..a7acb20 100644
--- a/cordova-lib/src/plugman/plugman.js
+++ b/cordova-lib/src/plugman/plugman.js
@@ -19,6 +19,10 @@
// copyright (c) 2013 Andrew Lunny, Adobe Systems
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
var events = require('../events');
var Q = require('q');
@@ -32,7 +36,7 @@ function addProperty(o, symbol, modulePath, doWrap) {
// If args exist and the last one is a function, it's the
callback.
var args = Array.prototype.slice.call(arguments);
var cb = args.pop();
- val.apply(o, args).done(function(result) {cb(undefined,
result)}, cb);
+ val.apply(o, args).done(function(result) {cb(undefined,
result);}, cb);
} else {
val.apply(o, arguments).done(null, function(err){ throw err;
});
}
@@ -41,7 +45,7 @@ function addProperty(o, symbol, modulePath, doWrap) {
// The top-level plugman.foo
Object.defineProperty(o, symbol, {
configurable: true,
- get : function() { return val = val || require(modulePath); },
+ get : function() { val = val || require(modulePath); return val; },
set : function(v) { val = v; }
});
}
@@ -49,12 +53,12 @@ function addProperty(o, symbol, modulePath, doWrap) {
// The plugman.raw.foo
Object.defineProperty(o.raw, symbol, {
configurable: true,
- get : function() { return val = val || require(modulePath); },
+ get : function() { val = val || require(modulePath); return val; },
set : function(v) { val = v; }
});
}
-plugman = {
+var plugman = {
on: events.on.bind(events),
off: events.removeListener.bind(events),
removeAllListeners: events.removeAllListeners.bind(events),
@@ -94,13 +98,13 @@ plugman.commands = {
if(cli_opts.browserify === true) {
plugman.prepare = require('./prepare-browserify');
}
- var cli_variables = {}
+ var cli_variables = {};
if (cli_opts.variable) {
cli_opts.variable.forEach(function (variable) {
var tokens = variable.split('=');
var key = tokens.shift().toUpperCase();
if (/^[\w-_]+$/.test(key)) cli_variables[key] =
tokens.join('=');
- });
+ });
}
var opts = {
subdir: '.',
@@ -113,16 +117,16 @@ plugman.commands = {
cli_opts.plugin.forEach(function (pluginSrc) {
p = p.then(function () {
return plugman.raw.install(cli_opts.platform,
cli_opts.project, pluginSrc, cli_opts.plugins_dir, opts);
- })
+ });
});
-
+
return p;
},
'uninstall': function(cli_opts) {
if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
return console.log(plugman.help());
}
-
+
if(cli_opts.browserify === true) {
plugman.prepare = require('./prepare-browserify');
}
@@ -199,12 +203,12 @@ plugman.commands = {
var tokens = variable.split('=');
var key = tokens.shift().toUpperCase();
if (/^[\w-_]+$/.test(key)) cli_variables[key] =
tokens.join('=');
- });
+ });
}
- plugman.create( cli_opts.name, cli_opts.plugin_id,
cli_opts.plugin_version, cli_opts.path || ".", cli_variables );
+ plugman.create( cli_opts.name, cli_opts.plugin_id,
cli_opts.plugin_version, cli_opts.path || '.', cli_variables );
},
'platform': function(cli_opts) {
- var operation = cli_opts.argv.remain[ 0 ] || "";
+ var operation = cli_opts.argv.remain[ 0 ] || '';
if( ( operation !== 'add' && operation !== 'remove' ) ||
!cli_opts.platform_name ) {
return console.log( plugman.help() );
}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/prepare-browserify.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare-browserify.js
b/cordova-lib/src/plugman/prepare-browserify.js
index 00e6128..1a1cdf9 100644
--- a/cordova-lib/src/plugman/prepare-browserify.js
+++ b/cordova-lib/src/plugman/prepare-browserify.js
@@ -17,7 +17,10 @@
under the License.
*/
-/* jshint node:true */
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ unused:false, expr:true
+*/
var platform_modules = require('./platforms'),
path = require('path'),
@@ -25,7 +28,7 @@ var platform_modules = require('./platforms'),
xml_helpers = require('../util/xml-helpers'),
wp8 = require('./platforms/wp8'),
windows8 = require('./platforms/windows8'),
- common = require('./platforms/common');
+ common = require('./platforms/common'),
fs = require('fs'),
shell = require('shelljs'),
util = require('util'),
@@ -63,21 +66,21 @@ function generateFinalBundle(platform, libraryRelease,
outReleaseFile) {
var time = new Date().valueOf();
writeLicenseHeader(outReleaseFileStream, platform, commitId);
-
- releaseBundle = libraryRelease.bundle();
+
+ var releaseBundle = libraryRelease.bundle();
releaseBundle.pipe(outReleaseFileStream);
outReleaseFileStream.on('finish', function() {
- var newtime = new Date().valueOf() - time;
- plugman.emit('verbose', 'generated cordova.' + platform + '.js @ ' +
commitId + ' in ' + newtime + 'ms');
- // TODO clean up all the *.browserify files
+ var newtime = new Date().valueOf() - time;
+ plugman.emit('verbose', 'generated cordova.' + platform + '.js @ ' +
commitId + ' in ' + newtime + 'ms');
+ // TODO clean up all the *.browserify files
});
outReleaseFileStream.on('error', function(err) {
- var newtime = new Date().valueOf() - time;
- console.log('error while generating cordova_b.js');
- plugman.emit('verbose', 'error while generating cordova.js');
+ var newtime = new Date().valueOf() - time;
+ console.log('error while generating cordova_b.js');
+ plugman.emit('verbose', 'error while generating cordova.js');
});
}
@@ -180,15 +183,15 @@ module.exports = function handlePrepare(project_dir,
platform, plugins_dir, www_
scripts.push(scriptPath);
});
});
-
+
libraryRelease.transform(requireTr.transform);
scripts.forEach(function(script) {
libraryRelease.add(script);
});
-
+
var outReleaseFile = path.join(wwwDir, 'cordova.js');
-
+
generateFinalBundle(platform, libraryRelease, outReleaseFile);
};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/publish.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/publish.js
b/cordova-lib/src/plugman/publish.js
index 55397fa..fc82125 100644
--- a/cordova-lib/src/plugman/publish.js
+++ b/cordova-lib/src/plugman/publish.js
@@ -16,9 +16,14 @@
specific language governing permissions and limitations
under the License.
*/
-var registry = require('./registry/registry')
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
+var registry = require('./registry/registry');
module.exports = function(plugin_path) {
// plugin_path is an array of paths
return registry.publish(plugin_path);
-}
+};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/search.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/search.js
b/cordova-lib/src/plugman/search.js
index 8cee646..f2cd3d8 100644
--- a/cordova-lib/src/plugman/search.js
+++ b/cordova-lib/src/plugman/search.js
@@ -16,8 +16,13 @@
specific language governing permissions and limitations
under the License.
*/
-var registry = require('./registry/registry')
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
+var registry = require('./registry/registry');
module.exports = function(search_opts) {
return registry.search(search_opts);
-}
+};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js
b/cordova-lib/src/plugman/uninstall.js
index 5cb9e28..69c70fc 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -1,4 +1,4 @@
-/**
+ /**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -17,9 +17,13 @@
under the License.
*/
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true, expr:true
+*/
+
var path = require('path'),
fs = require('fs'),
- et = require('elementtree'),
shell= require('shelljs'),
config_changes = require('./util/config-changes'),
xml_helpers = require('../util/xml-helpers'),
@@ -28,7 +32,6 @@ var path = require('path'),
CordovaError = require('../CordovaError'),
underscore = require('underscore'),
Q = require('q'),
- plugins = require('./util/plugins'),
underscore = require('underscore'),
events = require('../events'),
platform_modules = require('./platforms'),
@@ -36,7 +39,8 @@ var path = require('path'),
// possible options: cli_variables, www_dir
// Returns a promise.
-module.exports = function(platform, project_dir, id, plugins_dir, options) {
+module.exports = uninstall;
+function uninstall(platform, project_dir, id, plugins_dir, options) {
options = options || {};
options.is_top_level = true;
plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
@@ -44,7 +48,7 @@ module.exports = function(platform, project_dir, id,
plugins_dir, options) {
// Allow path to file to grab an ID
var xml_path = path.join(id, 'plugin.xml');
if ( fs.existsSync(xml_path) ) {
- var plugin_et = xml_helpers.parseElementtreeSync(xml_path),
+ var plugin_et = xml_helpers.parseElementtreeSync(xml_path);
id = plugin_et._root.attrib['id'];
}
@@ -61,7 +65,7 @@ module.exports.uninstallPlatform = function(platform,
project_dir, id, plugins_d
plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
if (!platform_modules[platform]) {
- return Q.reject(new CordovaError(platform + " not supported."));
+ return Q.reject(new CordovaError(platform + ' not supported.'));
}
var plugin_dir = path.join(plugins_dir, id);
@@ -126,8 +130,8 @@ module.exports.uninstallPlugin = function(id, plugins_dir,
options) {
var dependList = {};
platforms.forEach(function(platform) {
var depsInfo = dependencies.generate_dependency_info(plugins_dir,
platform);
- var tlps = depsInfo.top_level_plugins,
- deps, i;
+ var tlps = depsInfo.top_level_plugins;
+ var deps;
// Top-level deps must always be explicitely asked to remove by user
tlps.forEach(function(plugin_id){
@@ -144,7 +148,7 @@ module.exports.uninstallPlugin = function(id, plugins_dir,
options) {
var i = deps.indexOf(top_plugin_id);
if(i >= 0)
- deps.splice(i, 1); // remove current/top-level plugin as
blocking uninstall
+ deps.splice(i, 1); // remove current/top-level plugin as
blocking uninstall
if(deps.length) {
dependList[plugin] = deps.join(', ');
@@ -195,11 +199,11 @@ function runUninstallPlatform(actions, platform,
project_dir, plugin_dir, plugin
var dependents = dependencies.dependents(plugin_id, depsInfo, platform);
if(options.is_top_level && dependents && dependents.length > 0) {
- var msg = "The plugin '"+ plugin_id +"' is required by (" +
dependents.join(', ') + ")";
+ var msg = 'The plugin \'' + plugin_id + '\' is required by (' +
dependents.join(', ') + ')';
if(options.force) {
- events.emit("info", msg + " but forcing removal");
+ events.emit('info', msg + ' but forcing removal');
} else {
- return Q.reject( new CordovaError(msg + ", skipping
uninstallation.") );
+ return Q.reject( new CordovaError(msg + ', skipping
uninstallation.') );
}
}
@@ -246,44 +250,44 @@ function handleUninstall(actions, platform, plugin_id,
plugin_et, project_dir, w
var sourceFiles = platformTag.findall('./source-file'),
headerFiles = platformTag.findall('./header-file'),
libFiles = platformTag.findall('./lib-file'),
- resourceFiles = platformTag.findall('./resource-file');
+ resourceFiles = platformTag.findall('./resource-file'),
frameworkFiles =
platformTag.findall('./framework[@custom="true"]');
assets = assets.concat(platformTag.findall('./asset'));
// queue up native stuff
sourceFiles && sourceFiles.forEach(function(source) {
- actions.push(actions.createAction(handler["source-file"].uninstall,
+ actions.push(actions.createAction(handler['source-file'].uninstall,
[source, project_dir, plugin_id],
- handler["source-file"].install,
+ handler['source-file'].install,
[source, plugin_dir, project_dir,
plugin_id]));
});
headerFiles && headerFiles.forEach(function(header) {
- actions.push(actions.createAction(handler["header-file"].uninstall,
+ actions.push(actions.createAction(handler['header-file'].uninstall,
[header, project_dir, plugin_id],
- handler["header-file"].install,
+ handler['header-file'].install,
[header, plugin_dir, project_dir,
plugin_id]));
});
resourceFiles && resourceFiles.forEach(function(resource) {
-
actions.push(actions.createAction(handler["resource-file"].uninstall,
+
actions.push(actions.createAction(handler['resource-file'].uninstall,
[resource, project_dir,
plugin_id],
- handler["resource-file"].install,
+ handler['resource-file'].install,
[resource, plugin_dir,
project_dir]));
});
// CB-5238 custom frameworks only
frameworkFiles && frameworkFiles.forEach(function(framework) {
- actions.push(actions.createAction(handler["framework"].uninstall,
+ actions.push(actions.createAction(handler['framework'].uninstall,
[framework, project_dir,
plugin_id],
- handler["framework"].install,
+ handler['framework'].install,
[framework, plugin_dir,
project_dir]));
});
libFiles && libFiles.forEach(function(source) {
- actions.push(actions.createAction(handler["lib-file"].uninstall,
+ actions.push(actions.createAction(handler['lib-file'].uninstall,
[source, project_dir, plugin_id],
- handler["lib-file"].install,
+ handler['lib-file'].install,
[source, plugin_dir,
project_dir, plugin_id]));
});
}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9a81e4f/cordova-lib/src/plugman/unpublish.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/unpublish.js
b/cordova-lib/src/plugman/unpublish.js
index a7c5a8c..c66dc82 100644
--- a/cordova-lib/src/plugman/unpublish.js
+++ b/cordova-lib/src/plugman/unpublish.js
@@ -16,8 +16,13 @@
specific language governing permissions and limitations
under the License.
*/
-var registry = require('./registry/registry')
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
+var registry = require('./registry/registry');
module.exports = function(plugin) {
return registry.unpublish(plugin);
-}
+};