You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/06/19 16:35:42 UTC
git commit: CB-6973: Fix JSHint errors in plugman/platforms/*
Repository: cordova-lib
Updated Branches:
refs/heads/master 8d1d70e27 -> a1da72b62
CB-6973: Fix JSHint errors in plugman/platforms/*
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/a1da72b6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/a1da72b6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/a1da72b6
Branch: refs/heads/master
Commit: a1da72b6274927df3666d34339f844eb8a270df0
Parents: 8d1d70e
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Thu Jun 19 10:35:02 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Thu Jun 19 10:35:02 2014 -0400
----------------------------------------------------------------------
.../src/plugman/platforms/amazon-fireos.js | 25 ++++++-----
cordova-lib/src/plugman/platforms/android.js | 35 ++++++++-------
.../src/plugman/platforms/blackberry10.js | 31 ++++++++------
cordova-lib/src/plugman/platforms/common.js | 7 ++-
cordova-lib/src/plugman/platforms/firefoxos.js | 23 +++++++---
cordova-lib/src/plugman/platforms/ios.js | 31 ++++++++------
cordova-lib/src/plugman/platforms/tizen.js | 19 ++++++---
cordova-lib/src/plugman/platforms/ubuntu.js | 41 ++++++++++--------
cordova-lib/src/plugman/platforms/windows8.js | 45 +++++++++++---------
cordova-lib/src/plugman/platforms/wp8.js | 20 +++++----
10 files changed, 165 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/amazon-fireos.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/amazon-fireos.js b/cordova-lib/src/plugman/platforms/amazon-fireos.js
index a834b87..952a5d2 100644
--- a/cordova-lib/src/plugman/platforms/amazon-fireos.js
+++ b/cordova-lib/src/plugman/platforms/amazon-fireos.js
@@ -17,11 +17,16 @@
*
*/
-var fs = require('fs') // use existsSync in 0.6.x
- , path = require('path')
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+*/
+
+var path = require('path')
, common = require('./common')
, events = require('../../events')
- , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'))
+ ;
module.exports = {
www_dir:function(project_dir) {
@@ -35,7 +40,7 @@ module.exports = {
return mDoc._root.attrib['package'];
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
@@ -45,7 +50,7 @@ module.exports = {
common.deleteJava(project_dir, dest);
}
},
- "header-file": {
+ 'header-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'header-fileinstall is not supported for amazon-fireos');
},
@@ -53,19 +58,19 @@ module.exports = {
events.emit('verbose', 'header-file.uninstall is not supported for amazon-fireos');
}
},
- "lib-file":{
+ 'lib-file':{
install:function(lib_el, plugin_dir, project_dir, plugin_id) {
var src = lib_el.attrib.src;
- var dest = path.join("libs", path.basename(src));
+ var dest = path.join('libs', path.basename(src));
common.copyFile(plugin_dir, src, project_dir, dest);
},
uninstall:function(lib_el, project_dir, plugin_id) {
var src = lib_el.attrib.src;
- var dest = path.join("libs", path.basename(src));
+ var dest = path.join('libs', path.basename(src));
common.removeFile(project_dir, dest);
}
},
- "resource-file":{
+ 'resource-file':{
install:function(el, plugin_dir, project_dir, plugin_id) {
var src = el.attrib.src;
var target = el.attrib.target;
@@ -77,7 +82,7 @@ module.exports = {
common.removeFile(project_dir, target);
}
},
- "framework": {
+ 'framework': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'framework.install is not supported for amazon-fireos');
},
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/android.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/android.js b/cordova-lib/src/plugman/platforms/android.js
index 20dd55e..2c2c6d9 100644
--- a/cordova-lib/src/plugman/platforms/android.js
+++ b/cordova-lib/src/plugman/platforms/android.js
@@ -17,13 +17,18 @@
*
*/
-var fs = require('fs') // use existsSync in 0.6.x
- , path = require('path')
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+*/
+
+var path = require('path')
, common = require('./common')
, events = require('../../events')
, xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'))
, properties_parser = require('properties-parser')
- , android_project = require('../util/android-project');
+ , android_project = require('../util/android-project')
+ ;
var projectFileCache = {};
@@ -39,7 +44,7 @@ module.exports = {
return mDoc._root.attrib['package'];
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
@@ -50,7 +55,7 @@ module.exports = {
common.deleteJava(project_dir, dest);
}
},
- "header-file": {
+ 'header-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'header-file.install is not supported for android');
},
@@ -58,19 +63,19 @@ module.exports = {
events.emit('verbose', 'header-file.uninstall is not supported for android');
}
},
- "lib-file":{
+ 'lib-file':{
install:function(lib_el, plugin_dir, project_dir, plugin_id) {
var src = lib_el.attrib.src;
- var dest = path.join("libs", path.basename(src));
+ var dest = path.join('libs', path.basename(src));
common.copyFile(plugin_dir, src, project_dir, dest);
},
uninstall:function(lib_el, project_dir, plugin_id) {
var src = lib_el.attrib.src;
- var dest = path.join("libs", path.basename(src));
+ var dest = path.join('libs', path.basename(src));
common.removeFile(project_dir, dest);
}
},
- "resource-file":{
+ 'resource-file':{
install:function(el, plugin_dir, project_dir, plugin_id) {
var src = el.attrib.src;
var target = el.attrib.target;
@@ -82,13 +87,13 @@ module.exports = {
common.removeFile(project_dir, path.normalize(target));
}
},
- "framework": {
+ 'framework': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var src = source_el.attrib.src;
var custom = source_el.attrib.custom;
if (!src) throw new Error('src not specified in framework element');
- events.emit('verbose', "Installing Android library: " + src);
+ events.emit('verbose', 'Installing Android library: ' + src);
var parent = source_el.attrib.parent;
var parentDir = parent ? path.resolve(project_dir, module.exports.getCustomSubprojectRelativeDir(plugin_id, parent)) : project_dir;
var subDir;
@@ -109,14 +114,14 @@ module.exports = {
var custom = source_el.attrib.custom;
if (!src) throw new Error('src not specified in framework element');
- events.emit('verbose', "Uninstalling Android library: " + src);
+ events.emit('verbose', 'Uninstalling Android library: ' + src);
var parent = source_el.attrib.parent;
var parentDir = parent ? path.resolve(project_dir, parent) : project_dir;
var subRelativeDir = path.join(plugin_id, path.basename(src));
var subDir;
if (custom) {
- var subRelativeDir = module.exports.getCustomSubprojectRelativeDir(plugin_id, src);
+ subRelativeDir = module.exports.getCustomSubprojectRelativeDir(plugin_id, src);
common.removeFile(project_dir, subRelativeDir);
subDir = path.resolve(project_dir, subRelativeDir);
} else {
@@ -139,8 +144,8 @@ module.exports = {
delete projectFileCache[project_dir];
},
getProjectSdkDir: function (project_dir) {
- var localProperties = properties_parser.createEditor(path.resolve(project_dir, "local.properties"));
- return localProperties.get("sdk.dir");
+ var localProperties = properties_parser.createEditor(path.resolve(project_dir, 'local.properties'));
+ return localProperties.get('sdk.dir');
},
getCustomSubprojectRelativeDir: function (plugin_id, src) {
var subRelativeDir = path.join(plugin_id, path.basename(src));
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/blackberry10.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/blackberry10.js b/cordova-lib/src/plugman/platforms/blackberry10.js
index a34e795..9411f9f 100644
--- a/cordova-lib/src/plugman/platforms/blackberry10.js
+++ b/cordova-lib/src/plugman/platforms/blackberry10.js
@@ -17,13 +17,18 @@
*
*/
-var fs = require('fs') // use existsSync in 0.6.x
- , path = require('path')
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+*/
+
+var path = require('path')
, common = require('./common')
, events = require('../../events')
- , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'))
+ ;
-var TARGETS = ["device", "simulator"];
+var TARGETS = ['device', 'simulator'];
module.exports = {
www_dir:function(project_dir) {
@@ -34,12 +39,12 @@ module.exports = {
var widget_doc = xml_helpers.parseElementtreeSync(config_path);
return widget_doc._root.attrib['id'];
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var src = source_el.attrib['src'];
var target = source_el.attrib['target-dir'] || plugin_id;
TARGETS.forEach(function(arch) {
- var dest = path.join("native", arch, "chrome", "plugin", target, path.basename(src));
+ var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
common.copyNewFile(plugin_dir, src, project_dir, dest);
});
@@ -48,12 +53,12 @@ module.exports = {
var src = source_el.attrib['src'];
var target = source_el.attrib['target-dir'] || plugin_id;
TARGETS.forEach(function(arch) {
- var dest = path.join("native", arch, "chrome", "plugin", target, path.basename(src));
+ var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
common.removeFile(project_dir, dest);
});
}
},
- "header-file": {
+ 'header-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'header-file.install is not supported for blackberry');
},
@@ -61,21 +66,21 @@ module.exports = {
events.emit('verbose', 'header-file.uninstall is not supported for blackberry');
}
},
- "lib-file":{
+ 'lib-file':{
install:function(lib_el, plugin_dir, project_dir, plugin_id) {
var src = lib_el.attrib.src;
var arch = lib_el.attrib.arch;
- var dest = path.join("native", arch, "plugins", "jnext", path.basename(src));
+ var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
common.copyFile(plugin_dir, src, project_dir, dest);
},
uninstall:function(lib_el, project_dir, plugin_id) {
var src = lib_el.attrib.src;
var arch = lib_el.attrib.arch;
- var dest = path.join("native", arch, "plugins", "jnext", path.basename(src));
+ var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
common.removeFile(project_dir, dest);
}
},
- "resource-file":{
+ 'resource-file':{
install:function(el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'resource-file.install is not supported for blackberry');
},
@@ -83,7 +88,7 @@ module.exports = {
events.emit('verbose', 'resource-file.uninstall is not supported for blackberry');
}
},
- "framework": {
+ 'framework': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'framework.install is not supported for blackberry');
},
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/common.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/common.js b/cordova-lib/src/plugman/platforms/common.js
index 347428d..994aade 100644
--- a/cordova-lib/src/plugman/platforms/common.js
+++ b/cordova-lib/src/plugman/platforms/common.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'),
path = require('path'),
fs = require('fs'),
@@ -74,7 +79,7 @@ module.exports = common = {
var curDir = path.dirname(file);
while(curDir !== path.resolve(project_dir, 'src')) {
- if(fs.existsSync(curDir) && fs.readdirSync(curDir) == 0) {
+ if(fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) {
fs.rmdirSync(curDir);
curDir = path.resolve(curDir, '..');
} else {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/firefoxos.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/firefoxos.js b/cordova-lib/src/plugman/platforms/firefoxos.js
index feb543f..7d8d8f6 100644
--- a/cordova-lib/src/plugman/platforms/firefoxos.js
+++ b/cordova-lib/src/plugman/platforms/firefoxos.js
@@ -16,11 +16,18 @@
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,
+ laxcomma:true, sub:true
+*/
+
var path = require('path')
, fs = require('fs')
, common = require('./common')
, events = require('../../events')
- , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
+ , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'))
+ ;
module.exports = {
www_dir: function(project_dir) {
@@ -29,9 +36,11 @@ module.exports = {
package_name:function(project_dir) {
// preferred location if cordova >= 3.4
var preferred_path = path.join(project_dir, 'config.xml');
+ var config_path;
+
if (!fs.existsSync(preferred_path)) {
// older location
- old_config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
+ var old_config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
if (!fs.existsSync(old_config_path)) {
// output newer location and fail reading
config_path = preferred_path;
@@ -45,7 +54,7 @@ module.exports = {
var widget_doc = xml_helpers.parseElementtreeSync(config_path);
return widget_doc._root.attrib['id'];
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
@@ -55,7 +64,7 @@ module.exports = {
common.removeFile(project_dir, dest);
}
},
- "header-file": {
+ 'header-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'header-fileinstall is not supported for firefoxos');
},
@@ -63,7 +72,7 @@ module.exports = {
events.emit('verbose', 'header-file.uninstall is not supported for firefoxos');
}
},
- "resource-file":{
+ 'resource-file':{
install:function(el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'resource-file.install is not supported for firefoxos');
},
@@ -71,7 +80,7 @@ module.exports = {
events.emit('verbose', 'resource-file.uninstall is not supported for firefoxos');
}
},
- "framework": {
+ 'framework': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'framework.install is not supported for firefoxos');
},
@@ -79,7 +88,7 @@ module.exports = {
events.emit('verbose', 'framework.uninstall is not supported for firefoxos');
}
},
- "lib-file": {
+ 'lib-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'lib-file.install is not supported for firefoxos');
},
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/ios.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ios.js b/cordova-lib/src/plugman/platforms/ios.js
index fec8f3f..29f5afa 100644
--- a/cordova-lib/src/plugman/platforms/ios.js
+++ b/cordova-lib/src/plugman/platforms/ios.js
@@ -17,6 +17,11 @@
*
*/
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+*/
+
var path = require('path')
, fs = require('fs')
, glob = require('glob')
@@ -24,7 +29,8 @@ var path = require('path')
, plist = require('plist-with-patches')
, shell = require('shelljs')
, events = require('../../events')
- , cachedProjectFiles = {};
+ , cachedProjectFiles = {}
+ ;
module.exports = {
www_dir:function(project_dir) {
@@ -34,13 +40,13 @@ module.exports = {
var plist_file = glob.sync(path.join(project_dir, '**', '*-Info.plist'))[0];
return plist.parseFileSync(plist_file).CFBundleIdentifier;
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id, project) {
var src = source_el.attrib['src'];
var srcFile = path.resolve(plugin_dir, src);
var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(source_el));
var destFile = path.resolve(targetDir, path.basename(src));
- var is_framework = source_el.attrib['framework'] && (source_el.attrib['framework'] == 'true' || source_el.attrib['framework'] == true);
+ var is_framework = source_el.attrib['framework'] && (source_el.attrib['framework'] == 'true' || source_el.attrib['framework'] === true);
var has_flags = source_el.attrib['compiler-flags'] && source_el.attrib['compiler-flags'].length ? true : false ;
if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <source-file>');
@@ -49,7 +55,7 @@ module.exports = {
if (is_framework) {
var weak = source_el.attrib['weak'];
- var opt = { weak: (weak == undefined || weak == null || weak != 'true' ? false : true ) };
+ var opt = { weak: (weak === weak == 'true') };
var project_relative = path.join(path.basename(project.xcode_path), project_ref);
project.xcode.addFramework(project_relative, opt);
project.xcode.addToLibrarySearchPaths({path:project_ref});
@@ -63,7 +69,7 @@ module.exports = {
var src = source_el.attrib['src'];
var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(source_el));
var destFile = path.resolve(targetDir, path.basename(src));
- var is_framework = source_el.attrib['framework'] && (source_el.attrib['framework'] == 'true' || source_el.attrib['framework'] == true);
+ var is_framework = source_el.attrib['framework'] && (source_el.attrib['framework'] == 'true' || source_el.attrib['framework'] === true);
var project_ref = path.join('Plugins', path.relative(project.plugins_dir, destFile));
project.xcode.removeSourceFile(project_ref);
@@ -79,7 +85,7 @@ module.exports = {
}
}
},
- "header-file":{
+ 'header-file':{
install:function(header_el, plugin_dir, project_dir, plugin_id, project) {
var src = header_el.attrib['src'];
var srcFile = path.resolve(plugin_dir, src);
@@ -102,7 +108,7 @@ module.exports = {
}
}
},
- "resource-file":{
+ 'resource-file':{
install:function(resource_el, plugin_dir, project_dir, plugin_id, project) {
var src = resource_el.attrib['src'],
srcFile = path.resolve(plugin_dir, src),
@@ -119,7 +125,7 @@ module.exports = {
shell.rm('-rf', destFile);
}
},
- "framework":{ // CB-5238 custom frameworks only
+ 'framework':{ // CB-5238 custom frameworks only
install:function(framework_el, plugin_dir, project_dir, plugin_id, project) {
var src = framework_el.attrib['src'],
custom = framework_el.attrib['custom'],
@@ -140,7 +146,7 @@ module.exports = {
shell.rm('-rf', targetDir);
}
},
- "lib-file": {
+ 'lib-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'lib-file.install is not supported for ios');
},
@@ -161,14 +167,14 @@ module.exports = {
var project_files = glob.sync(path.join(project_dir, '*.xcodeproj', 'project.pbxproj'));
if (project_files.length === 0) {
- throw new Error("does not appear to be an xcode project (no xcode project file)");
+ throw new Error('does not appear to be an xcode project (no xcode project file)');
}
var pbxPath = project_files[0];
var xcodeproj = xcode.project(pbxPath);
xcodeproj.parseSync();
// grab and parse plist file or config.xml
- var config_files = (glob.sync(path.join(project_dir, '**', '{PhoneGap,Cordova}.plist')).length == 0 ?
+ var config_files = (glob.sync(path.join(project_dir, '**', '{PhoneGap,Cordova}.plist')).length === 0 ?
glob.sync(path.join(project_dir, '**', 'config.xml')) :
glob.sync(path.join(project_dir, '**', '{PhoneGap,Cordova}.plist'))
);
@@ -178,11 +184,10 @@ module.exports = {
});
if (config_files.length === 0) {
- throw new Error("could not find PhoneGap/Cordova plist file, or config.xml file.");
+ throw new Error('could not find PhoneGap/Cordova plist file, or config.xml file.');
}
var config_file = config_files[0];
- var config_filename = path.basename(config_file);
var xcode_dir = path.dirname(config_file);
var pluginsDir = path.resolve(xcode_dir, 'Plugins');
var resourcesDir = path.resolve(xcode_dir, 'Resources');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/tizen.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/tizen.js b/cordova-lib/src/plugman/platforms/tizen.js
index feb543f..b346ecd 100644
--- a/cordova-lib/src/plugman/platforms/tizen.js
+++ b/cordova-lib/src/plugman/platforms/tizen.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,
+ laxcomma:true, sub:true
+*/
+
var path = require('path')
, fs = require('fs')
, common = require('./common')
@@ -29,9 +35,10 @@ module.exports = {
package_name:function(project_dir) {
// preferred location if cordova >= 3.4
var preferred_path = path.join(project_dir, 'config.xml');
+ var config_path;
if (!fs.existsSync(preferred_path)) {
// older location
- old_config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
+ var old_config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
if (!fs.existsSync(old_config_path)) {
// output newer location and fail reading
config_path = preferred_path;
@@ -45,7 +52,7 @@ module.exports = {
var widget_doc = xml_helpers.parseElementtreeSync(config_path);
return widget_doc._root.attrib['id'];
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
@@ -55,7 +62,7 @@ module.exports = {
common.removeFile(project_dir, dest);
}
},
- "header-file": {
+ 'header-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'header-fileinstall is not supported for firefoxos');
},
@@ -63,7 +70,7 @@ module.exports = {
events.emit('verbose', 'header-file.uninstall is not supported for firefoxos');
}
},
- "resource-file":{
+ 'resource-file':{
install:function(el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'resource-file.install is not supported for firefoxos');
},
@@ -71,7 +78,7 @@ module.exports = {
events.emit('verbose', 'resource-file.uninstall is not supported for firefoxos');
}
},
- "framework": {
+ 'framework': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'framework.install is not supported for firefoxos');
},
@@ -79,7 +86,7 @@ module.exports = {
events.emit('verbose', 'framework.uninstall is not supported for firefoxos');
}
},
- "lib-file": {
+ 'lib-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'lib-file.install is not supported for firefoxos');
},
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/ubuntu.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ubuntu.js b/cordova-lib/src/plugman/platforms/ubuntu.js
index 31c6e1e..c422d7c 100644
--- a/cordova-lib/src/plugman/platforms/ubuntu.js
+++ b/cordova-lib/src/plugman/platforms/ubuntu.js
@@ -17,6 +17,11 @@
*
*/
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+*/
+
function replaceAt(str, index, char) {
return str.substr(0, index) + char + str.substr(index + char.length);
}
@@ -42,33 +47,33 @@ module.exports = {
var widget_doc = xml_helpers.parseElementtreeSync(config_path);
return widget_doc._root.attrib['id'];
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var shell = require('shelljs');
- var dest = path.join(project_dir, "build", "src", "plugins", plugin_id);
+ var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
shell.mkdir(dest);
shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
- shell.exec('touch ' + path.join(project_dir, "CMakeLists.txt"))
+ shell.exec('touch ' + path.join(project_dir, 'CMakeLists.txt'));
},
uninstall:function(source_el, project_dir, plugin_id) {
var shell = require('shelljs');
- var dest = path.join(project_dir, "build", "src", "plugins", plugin_id);
+ var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
}
},
- "header-file":{
+ 'header-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var shell = require('shelljs');
- var dest = path.join(project_dir, "build", "src", "plugins", plugin_id);
+ var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
shell.mkdir(dest);
shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
- var plugins = path.join(project_dir, "build", "src", "coreplugins.cpp");
- src = String(fs.readFileSync(plugins));
+ var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
+ var src = String(fs.readFileSync(plugins));
- src = src.replace('INSERT_HEADER_HERE', '#include "plugins/' + plugin_id + "/" + path.basename(source_el.attrib.src) +'"\nINSERT_HEADER_HERE');
+ src = src.replace('INSERT_HEADER_HERE', '#include "plugins/' + plugin_id + '/' + path.basename(source_el.attrib.src) +'"\nINSERT_HEADER_HERE');
var class_name = plugin_id.match(/\.[^.]+$/)[0].substr(1);
class_name = toCamelCase(class_name);
src = src.replace('INSERT_PLUGIN_HERE', 'INIT_PLUGIN(' + class_name + ');INSERT_PLUGIN_HERE');
@@ -77,13 +82,13 @@ module.exports = {
},
uninstall:function(source_el, project_dir, plugin_id) {
var shell = require('shelljs');
- var dest = path.join(project_dir, "build", "src", "plugins", plugin_id);
+ var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
- var plugins = path.join(project_dir, "build", "src", "coreplugins.cpp");
- src = String(fs.readFileSync(plugins));
+ var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
+ var src = String(fs.readFileSync(plugins));
- src = src.replace('#include "plugins/' + plugin_id + "/" + path.basename(source_el.attrib.src) +'"', '');
+ src = src.replace('#include "plugins/' + plugin_id + '/' + path.basename(source_el.attrib.src) +'"', '');
var class_name = plugin_id.match(/\.[^.]+$/)[0].substr(1);
class_name = toCamelCase(class_name);
src = src.replace('INIT_PLUGIN(' + class_name + ');', '');
@@ -91,21 +96,21 @@ module.exports = {
fs.writeFileSync(plugins, src);
}
},
- "resource-file":{
+ 'resource-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id) {
var shell = require('shelljs');
- var dest = path.join(project_dir, "qml");
+ var dest = path.join(project_dir, 'qml');
shell.mkdir(dest);
shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
},
uninstall:function(source_el, project_dir, plugin_id) {
var shell = require('shelljs');
- var dest = path.join(project_dir, "qml");
+ var dest = path.join(project_dir, 'qml');
shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
}
},
- "framework": {
+ 'framework': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'framework.install is not supported for ubuntu');
},
@@ -113,7 +118,7 @@ module.exports = {
events.emit('verbose', 'framework.uninstall is not supported for ubuntu');
}
},
- "lib-file": {
+ 'lib-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'lib-file.install is not supported for ubuntu');
},
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/windows8.js b/cordova-lib/src/plugman/platforms/windows8.js
index 3f2a750..29b433c 100644
--- a/cordova-lib/src/plugman/platforms/windows8.js
+++ b/cordova-lib/src/plugman/platforms/windows8.js
@@ -17,33 +17,36 @@
*
*/
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+*/
+
var common = require('./common'),
path = require('path'),
glob = require('glob'),
- shell = require('shelljs'),
- fs = require('fs'),
jsproj = require('../../util/windows/jsproj'),
events = require('../../events'),
xml_helpers = require('../../util/xml-helpers');
module.exports = {
- platformName:"windows8",
- InvalidProjectPathError:'does not appear to be a Windows Store JS project (no .jsproj file)',
- www_dir:function(project_dir) {
+ platformName: 'windows8',
+ InvalidProjectPathError: 'does not appear to be a Windows Store JS project (no .jsproj file)',
+ www_dir: function(project_dir) {
return path.join(project_dir, 'www');
},
- package_name:function(project_dir) {
+ package_name: function(project_dir) {
var manifest = xml_helpers.parseElementtreeSync(path.join(project_dir, 'package.appxmanifest'));
- return manifest.find("Properties/DisplayName").text;
+ return manifest.find('Properties/DisplayName').text;
},
- parseProjectFile:function(project_dir) {
+ parseProjectFile: function(project_dir) {
var project_files = glob.sync('*.jsproj', { cwd:project_dir });
- if (project_files.length == 0) {
+ if (project_files.length === 0) {
throw new Error(this.InvalidProjectPathError);
}
return new jsproj(path.join(project_dir, project_files[0]));
},
- "source-file":{
+ 'source-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id, project_file) {
var targetDir = source_el.attrib['target-dir'] || '';
var dest = path.join('www', 'plugins', plugin_id, targetDir, path.basename(source_el.attrib['src']));
@@ -61,7 +64,7 @@ module.exports = {
project_file.removeSourceFile(dest);
}
},
- "header-file": {
+ 'header-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'header-fileinstall is not supported for Windows 8');
},
@@ -69,14 +72,14 @@ module.exports = {
events.emit('verbose', 'header-file.uninstall is not supported for Windows 8');
}
},
- "resource-file":{
+ 'resource-file':{
install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
events.emit('verbose', 'resource-file is not supported for Windows 8');
},
uninstall:function(el, project_dir, plugin_id, project_file) {
}
},
- "lib-file": {
+ 'lib-file': {
install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
var inc = el.attrib['Include'];
project_file.addSDKRef(inc);
@@ -87,17 +90,17 @@ module.exports = {
project_file.removeSDKRef(inc);
}
},
- "framework": {
+ 'framework': {
install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
events.emit('verbose', 'windows8 framework install :: ' + plugin_id);
var src = el.attrib['src'];
var dest = src; // if !isCustom, we will just add a reference to the file in place
// technically it is not possible to get here without isCustom == true -jm
- // var isCustom = el.attrib.custom == "true";
- var type = el.attrib["type"];
+ // var isCustom = el.attrib.custom == 'true';
+ var type = el.attrib['type'];
- if(type == "projectReference") {
+ if(type == 'projectReference') {
project_file.addProjectReference(path.join(plugin_dir,src));
}
else {
@@ -113,12 +116,12 @@ module.exports = {
var src = el.attrib['src'];
// technically it is not possible to get here without isCustom == true -jm
- // var isCustom = el.attrib.custom == "true";
- var type = el.attrib["type"];
+ // var isCustom = el.attrib.custom == 'true';
+ var type = el.attrib['type'];
// unfortunately we have to generate the plugin_dir path because it is not passed to uninstall
- var plugin_dir = path.join(project_dir,"cordova/plugins",plugin_id,src);
+ var plugin_dir = path.join(project_dir, 'cordova/plugins', plugin_id,src);
- if(type == "projectReference") {
+ if(type == 'projectReference') {
project_file.removeProjectReference(plugin_dir);
}
else {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a1da72b6/cordova-lib/src/plugman/platforms/wp8.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/wp8.js b/cordova-lib/src/plugman/platforms/wp8.js
index 185c048..2c6da4a 100644
--- a/cordova-lib/src/plugman/platforms/wp8.js
+++ b/cordova-lib/src/plugman/platforms/wp8.js
@@ -17,10 +17,14 @@
*
*/
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+*/
+
var common = require('./common'),
path = require('path'),
glob = require('glob'),
- fs = require('fs'),
csproj = require('../../util/windows/csproj'),
events = require('../../events'),
xml_helpers = require('../../util/xml-helpers');
@@ -41,7 +45,7 @@ module.exports = {
}
return new csproj(path.join(project_dir, project_files[0]));
},
- "source-file":{
+ 'source-file':{
install:function(source_el, plugin_dir, project_dir, plugin_id, project_file) {
var dest = path.join('Plugins', plugin_id, source_el.attrib['target-dir'] ? source_el.attrib['target-dir'] : '', path.basename(source_el.attrib['src']));
@@ -56,7 +60,7 @@ module.exports = {
project_file.removeSourceFile(dest);
}
},
- "header-file": {
+ 'header-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'header-file.install is not supported for wp8');
},
@@ -64,7 +68,7 @@ module.exports = {
events.emit('verbose', 'header-file.uninstall is not supported for wp8');
}
},
- "resource-file":{
+ 'resource-file':{
install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
events.emit('verbose', 'resource-file.install is not supported for wp8');
},
@@ -72,13 +76,13 @@ module.exports = {
events.emit('verbose', 'resource-file.uninstall is not supported for wp8');
}
},
- "framework":{
+ 'framework':{
install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
events.emit('verbose', 'wp8 framework install :: ' + plugin_id );
var src = el.attrib['src'];
var dest = src; // if !isCustom, we will just add a reference to the file in place
- var isCustom = el.attrib.custom == "true";
+ var isCustom = el.attrib.custom == 'true';
if(isCustom) {
dest = path.join('plugins', plugin_id, path.basename(src));
@@ -92,7 +96,7 @@ module.exports = {
events.emit('verbose', 'wp8 framework uninstall :: ' + plugin_id );
var src = el.attrib['src'];
- var isCustom = el.attrib.custom == "true";
+ var isCustom = el.attrib.custom == 'true';
if(isCustom) {
var dest = path.join('plugins', plugin_id);
@@ -102,7 +106,7 @@ module.exports = {
project_file.removeReference(src);
}
},
- "lib-file": {
+ 'lib-file': {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
events.emit('verbose', 'lib-file.install is not supported for wp8');
},