Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Fix jshint errors
  • Loading branch information
bryanhiggins committed Dec 10, 2013
1 parent ce7df99 commit 363f611c019a88c3a0fc57b4fd5e46655acd6093
Showing 25 changed files with 201 additions and 96 deletions.
@@ -1 +1,7 @@
framework/lib/jnext.js
bin/test/cordova/unit/params-bad.json
bin/templates/project/cordova/lib/xml-helpers.js
bin/templates/project/cordova/third_party/*
bin/templates/project/lib/*
bin/templates/project/cordova/lib/utils.js
bin/templates/project/cordova/lib/signing-utils.js
@@ -0,0 +1,73 @@
{
"predef": [
"escape",
"unescape",
//Jasmine
"jasmine",
"it",
"describe",
"xit",
"xdescribe",
"beforeEach",
"afterEach",
"runs",
"waits",
"waitsFor",
"spyOn",
"expect",
"global",
//Webworks
"qnx",
"chrome",
"blackberry",
"internal",
"JNEXT",
"frameworkModules",
//Node
"__dirname",
"GLOBAL",
"process",
"exports",
"module",
"NamedNodeMap",
"require",
"Node",
"JSZip",
//UI Components
"x$",
"iris",
//Browser
"DOMElement",
"atob",
//automated tests
"showOverlay",
"hideOverlay"
],

"node" : false,
"browser" : true,

"boss" : false,
"curly": false,
"bitwise" : false,
"white": true,
"indent": 4,
"evil": false,
"devel": true,
"debug": false,
"eqeqeq": true,
"forin": true,
"immed": true,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": true,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false
}
@@ -88,9 +88,17 @@ task('hint', ['complainwhitespace'], function () {
return wut;
};

childProcess.exec("jshint framework/lib bin/lib bin/test bin/templates/project/cordova bin/templates/project/project.json --config .jshint --extra-ext .json",function(err,stdout,stderr) {
childProcess.exec("jshint framework/lib bin/lib bin/test bin/templates/project/cordova bin/templates/project/project.json --config .jshintrc --extra-ext .json",function(err,stdout,stderr) {
var exs = stdout.split('\n');
console.log(exs.filter(filterKnownWarnings).join('\n'));
if (err) {
console.log(err);
}
if (exs.length > 1) {
console.log("EXITING: " + exs.length);
process.exit(exs.length - 1);
}
console.log("jshint SUCCESS");
complete();
});
}, true);
@@ -24,7 +24,7 @@ var path = require('path'),
ERROR_VALUE = 2,
NOTIMPLEMENTED_VALUE = 1,
command,
name,
targetName,
ip,
type,
password,
@@ -101,7 +101,7 @@ commander
console.log(commander.helpInformation());
exit(ERROR_VALUE);
}
name = commander.args[0];
targetName = commander.args[0];
ip = commander.args[1];
type = commander.type ? commander.type : "device";
if (commander.password && typeof commander.password === 'string') {
@@ -125,10 +125,10 @@ commander
console.log(commander.helpInformation());
exit(ERROR_VALUE);
}
if (properties.targets.hasOwnProperty(name)) {
console.log("Overwriting target: " + name);
if (properties.targets.hasOwnProperty(targetName)) {
console.log("Overwriting target: " + targetName);
}
properties.targets[name] = {"ip": ip, "type": type, "password": password, "pin": pin};
properties.targets[targetName] = {"ip": ip, "type": type, "password": password, "pin": pin};
});

commander
@@ -140,13 +140,13 @@ commander
console.log(commander.helpInformation());
exit(ERROR_VALUE);
}
name = commander.args[0];
if (!properties.targets.hasOwnProperty(name)) {
console.log("Target: '" + name + "' not found");
targetName = commander.args[0];
if (!properties.targets.hasOwnProperty(targetName)) {
console.log("Target: '" + targetName + "' not found");
console.log(commander.helpInformation());
exit(ERROR_VALUE);
}
delete properties.targets[name];
delete properties.targets[targetName];
});

commander
@@ -164,7 +164,8 @@ try {
if (commander.args.length === 0) {
Object.keys(properties.targets).forEach(function (target) {
console.log(target);
});
}
);
exit();
}

@@ -34,47 +34,47 @@ function setShellFatal(value, func) {


function updateNativeDir(projectpath) {
shell.cp('-rf', path.join(ROOT,'bin','templates','project','native'), path.join(projectpath,'native'));
shell.cp('-rf', path.join(ROOT, 'bin', 'templates', 'project', 'native'), path.join(projectpath, 'native'));
}

function updateProjectJson(projectpath) {
var projectJson = require(path.resolve(path.join(projectpath, "project.json")));
projectJson.globalFetchDir = path.join(ROOT,'plugins');
projectJson.globalFetchDir = path.join(ROOT, 'plugins');
fs.writeFileSync(path.join(projectpath, "project.json"), JSON.stringify(projectJson, null, 4) + "\n", "utf-8");
}

function updateCordovaJS(projectpath,version) {
var jspath = path.join(projectpath,'lib','cordova'+version,'javascript');
function updateCordovaJS(projectpath, version) {
var jspath = path.join(projectpath, 'lib', 'cordova' + version, 'javascript');
shell.rm('-rf', path.join(projectpath, 'lib')); //remove old lib tree
shell.mkdir('-p', jspath); // remake lib dir tree with updated version
shell.cp('-f', path.join(ROOT,'javascript','cordova.blackberry10.js'), path.join(jspath,'cordova.js')); // copy new js
shell.cp('-f', path.join(ROOT,'javascript','cordova.blackberry10.js'), path.join('www','cordova.js'));
shell.cp('-f', path.join(ROOT, 'javascript', 'cordova.blackberry10.js'), path.join(jspath, 'cordova.js')); // copy new js
shell.cp('-f', path.join(ROOT, 'javascript', 'cordova.blackberry10.js'), path.join('www', 'cordova.js'));
}

function updateCordovaTools(projectpath) {
// update cordova scripts from template
shell.cp('-rf', path.join(ROOT,'bin','templates','project','cordova'), path.join(projectpath,'cordova'));
shell.cp('-rf', path.join(ROOT, 'bin', 'templates', 'project', 'cordova'), path.join(projectpath, 'cordova'));
// update repo level scripts
updateTargetTool(projectpath);
updateInitTool(projectpath);
}

function updateTargetTool(projectpath) {
shell.cp('-f', path.join(ROOT,'bin','target'), path.join(projectpath,'cordova'));
shell.cp('-f', path.join(ROOT,'bin','target.bat'), path.join(projectpath,'cordova'));
shell.cp('-f', path.join(ROOT,'bin','lib','target.js'), path.join(projectpath,'cordova','lib'));
shell.cp('-f', path.join(ROOT,'bin','lib','utils.js'), path.join(projectpath,'cordova','lib'));
shell.cp('-f', path.join(ROOT, 'bin', 'target'), path.join(projectpath, 'cordova'));
shell.cp('-f', path.join(ROOT, 'bin', 'target.bat'), path.join(projectpath, 'cordova'));
shell.cp('-f', path.join(ROOT, 'bin', 'lib', 'target.js'), path.join(projectpath, 'cordova', 'lib'));
shell.cp('-f', path.join(ROOT, 'bin', 'lib', 'utils.js'), path.join(projectpath, 'cordova', 'lib'));
}

function updateInitTool(projectpath) {
shell.cp('-f', path.join(ROOT,'bin','init.bat'), path.join(projectpath, 'cordova'));
shell.cp('-f', path.join(ROOT,'bin','init'), path.join(projectpath, 'cordova'));
shell.cp('-f', path.join(ROOT, 'bin', 'init.bat'), path.join(projectpath, 'cordova'));
shell.cp('-f', path.join(ROOT, 'bin', 'init'), path.join(projectpath, 'cordova'));
}

exports.updateProject = function(projectpath) {
exports.updateProject = function (projectpath) {
var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
setShellFatal(true, function() {
updateCordovaJS(projectpath,version);
setShellFatal(true, function () {
updateCordovaJS(projectpath, version);
updateCordovaTools(projectpath);
updateNativeDir(projectpath);
updateProjectJson(projectpath);
@@ -83,9 +83,9 @@ exports.updateProject = function(projectpath) {
};

if (require.main === module) {
(function() {
(function () {
var args = process.argv;
if (args.length < 3 || (args[2] == '--help' || args[2] == '-h')) {
if (args.length < 3 || (args[2] === '--help' || args[2] === '-h')) {
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' <path_to_project>');
exit(1);
} else {
@@ -14,6 +14,8 @@
* limitations under the License.
*/

/* globals Buffer */

var fs = require('fs'),
exit = require('exit'),
async = require('async'),
@@ -22,7 +24,7 @@ var fs = require('fs'),
wrench = require('wrench'),
localize = require("./localize"),
os = require('os'),
prompt = require("prompt"),
promptLib = require("prompt"),
DEFAULT_BAR_NAME = "bb10app",
PROPERTY_FILE_NAME = 'blackberry10.json',
CORDOVA_DIR = '.cordova',
@@ -220,15 +222,15 @@ _self = {

exec : function (command, args, options, callback) {
//Optional params handling [args, options]
if (typeof args === "Object" && !Array.isArray(args)) {
if (typeof args === "object" && !Array.isArray(args)) {
callback = options;
options = args;
args = [];
} else if (typeof args === "function"){
} else if (typeof args === "function") {
callback = args;
options = {};
args = [];
} else if (typeof options === "function"){
} else if (typeof options === "function") {
callback = options;
options = {};
}
@@ -251,7 +253,7 @@ _self = {
//put any args with spaces in quotes
args[i] = _self.inQuotes(args[i]);
}
};
}

//delete _customOptions from options object before sending to exec
delete options._customOptions;
@@ -271,7 +273,7 @@ _self = {
},

findHomePath : function () {
return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
return process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
},

getCordovaDir: function () {
@@ -314,15 +316,18 @@ _self = {
},

clone: function (original) {
var clone = {};
var clone = {},
prop;
if (typeof original !== "object") {
clone = original;
} else if (Array.isArray(original)) {
clone =original.slice();
clone = original.slice();
} else {
for (var prop in original) {
/* jshint ignore:start */
for (prop in original) {
clone[prop] = original[prop];
}
/* jshint ignore:end */
}

return clone;
@@ -333,11 +338,11 @@ _self = {
"property": options
}
};
prompt.start();
prompt.colors = false;
prompt.message = "";
prompt.delimiter = "";
prompt.get(promptSchema, function (err, results) {
promptLib.start();
promptLib.colors = false;
promptLib.message = "";
promptLib.delimiter = "";
promptLib.get(promptSchema, function (err, results) {
done(err, results.property);
});
},
@@ -17,12 +17,13 @@
// specific language governing permissions and limitations
// under the License.

var bbtools = process.env.CORDOVA_BBTOOLS;
var reg = /host_\d+_\d+/g;
var bbtools = process.env.CORDOVA_BBTOOLS,
reg = /host_\d+_\d+/g,
results;

if(reg.test(bbtools)){
var results = bbtools.match(reg);
console.log(results[0].split('host_')[1].replace('_','.'));
}else{
if (reg.test(bbtools)) {
results = bbtools.match(reg);
console.log(results[0].split('host_')[1].replace('_', '.'));
} else {
return new Error('Unable to find the blackberry ndk on your path.');
}
@@ -68,14 +68,14 @@ try {

utils.series(
[
function clean (done) {
function clean(done) {
var cmd = utils.isWindows() ? "clean" : "./clean",
args = [],
opts = { "cwd": path.normalize(__dirname + "/..") };

utils.exec(cmd, args, opts, done);
},
function releaseBuild (allDone) {
function releaseBuild(allDone) {
var childTasks = [],
keystorepass = session.getKeyStorePass(command),
err;
@@ -93,13 +93,13 @@ try {
done();
});
} else {
err = "No signing password provided. Please enter a value for 'keystorepass' in "+pkgrUtils.homedir()+"/.cordova/blackberry10.json or use --keystorepass via command-line";
err = "No signing password provided. Please enter a value for 'keystorepass' in " + pkgrUtils.homedir() + "/.cordova/blackberry10.json or use --keystorepass via command-line";
}
}

async.waterfall(childTasks, function (error) { allDone(error || err);});
async.waterfall(childTasks, function (error) { allDone(error || err); });
},
function build (done) {
function build(done) {
//enable webinspector in debug mode or if --webinspector was provided
if (!command.release || command.webInspector) {
bbwpArgv.push("-d");
@@ -20,5 +20,4 @@ var wrench = require('wrench'),
path = require("path"),
buildPath = path.normalize(__dirname + "/../../build/");

wrench.rmdirSyncRecursive(buildPath, true);

wrench.rmdirSyncRecursive(buildPath, true);

0 comments on commit 363f611

Please sign in to comment.