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

fix easy jshint errors #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Browser.downloadCordovaCrosswalkEngine = function downloadCordovaCrosswalkEngine
}, function(error) {
logging.logger.error('Failed to download cordova-crosswalk-engine - %s', error, {});
q.reject();
})
});

return q.promise;
};
Expand Down Expand Up @@ -244,7 +244,7 @@ Browser.downloadCrosswalkWebviews = function downloadCrosswalkWebviews(appDirect
// logging.logger.debug('xwalk', xwalkVersion)

if (!xwalkVersion) {
logging.logger.error('\nYou must specify a valid version from crosswalk. Run `ionic browser list` to see versions')
logging.logger.error('\nYou must specify a valid version from crosswalk. Run `ionic browser list` to see versions');
// q.reject('You must specify a valid version from crosswalk. Run `ionic browser list` to see versions')
throw new Error('Invalid version of Crosswalk specified');
}
Expand Down Expand Up @@ -293,7 +293,7 @@ Browser.downloadCordova40x = function downloadCordova40x(appDirectory) {
}, function(error) {
logging.logger.error('Failed to download cordova-android v4.0.x - %s', error, {});
q.reject();
})
});

return q.promise;
};
Expand All @@ -316,7 +316,7 @@ Browser.removeAndroidProject = function removeAndroidProject(appDirectory, saveT
return Cordova.removePlatform(appDirectory, 'android', saveToPackageJson)
.then(function() {
logging.logger.info('\nRemoved old Cordova Android platform');
})
});
};

Browser.addCordova40xProject = function addCordova40xProject(appDirectory, saveToPackageJson) {
Expand Down Expand Up @@ -408,7 +408,7 @@ Browser.downloadFiles = function downloadFiles(appDirectory, version, isLiteVers
});

// return q.promise;
}
};

Browser.removeCrosswalk = function removeCrosswalk(appDirectory) {
var cwd = shelljs.pwd();
Expand Down Expand Up @@ -451,7 +451,7 @@ Browser.installCrosswalk = function installCrosswalk(appDirectory, version, save
return Q(cordovaMessage);
} else if (semver.satisfies(info.cordova, '>=5.0.0')) {
return Browser.installCordovaCrosswalk(appDirectory);
}
}

logging.logger.info(('You are running Cordova CLI ' + info.cordova + ' - installing Cordova Android and Crosswalk manually').yellow.bold);

Expand Down Expand Up @@ -503,12 +503,12 @@ Browser.upgradeCrosswalk = function upgradeCrosswalk(appDirectory) {
Browser.revertBrowser = function revertBrowser(appDirectory, platform) {
if (!platform) {
logging.logger.info('You did not specify a platform to revert the browser');
return
return;
}

if(platforms.indexOf(platform) == -1) {
logging.logger.info('You did not specify a valid platform.');
return
return;
}

logging.logger.info('Reverting', platform, 'browser');
Expand Down Expand Up @@ -570,7 +570,7 @@ Browser.saveBrowserInstallation = function saveBrowserInstallation(platform, bro

Browser.addBrowser = function addBrowser(appDirectory, browserToInstall, saveToPackageJson) {

if (!appDirectory) {
if (!appDirectory) {
throw 'You must pass a directory to run this command';
}

Expand Down Expand Up @@ -653,6 +653,7 @@ var printBrowsers = function printBrowsers(browsers) {
var browser = browsers[x];
var avail = browser.available ? 'Yes' : 'No';
var installCommand = browser.command ? browser.command : '';
var version;

if (browser.available) {
logging.logger.info('\nAvailable'.green.bold, '-', browser.name.green, '-', installCommand);
Expand All @@ -663,9 +664,9 @@ var printBrowsers = function printBrowsers(browsers) {
var betaCanaryMessage = null;

if (ver.beta) {
betaCanaryMessage = '(beta)\t'
betaCanaryMessage = '(beta)\t';
} else if (ver.canary) {
betaCanaryMessage = '(canary)'
betaCanaryMessage = '(canary)';
} else {
betaCanaryMessage = '\t';
}
Expand Down Expand Up @@ -695,6 +696,7 @@ Browser.listInstalledBrowsers = function listInstalledBrowsers(appDirectory) {
var project = IonicProject.load();

var browsers = project.get('browsers');
var browserIndex;

logging.logger.info('\nInstalled browsers:\n'.green);

Expand Down
2 changes: 1 addition & 1 deletion lib/config-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ ConfigXml.setConfigXml = function setConfigXml(appDirectory, options) {
configString = xmlBuilder.buildObject(configJson);
fs.writeFileSync(configXmlPath, configString);
}
})
});
};
8 changes: 4 additions & 4 deletions lib/cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ Cordova.setupLiveReload = function() {
})
.catch(function(error) {

})
});

return d.promise;
};


Cordova.addPlatform = function addPlatform(projectRoot, platform, savePlatform) {
logging.logger.debug('Cordova.addPlatform: ', projectRoot, platform, savePlatform);
// var opts = {
// var opts = {
// searchpath : args.searchpath
// , noregistry : args.noregistry
// , usegit : args.usegit
Expand All @@ -198,7 +198,7 @@ Cordova.addPlatform = function addPlatform(projectRoot, platform, savePlatform)
var options = {
stdio: 'pipe'
};

var originalPwd = process.env.PWD;
process.env.PWD = projectRoot;

Expand Down Expand Up @@ -256,7 +256,7 @@ Cordova.addPlugin = function addPlugin(projectRoot, pluginId, pluginVariables, s
var originalPwd = process.env.PWD;
process.env.PWD = projectRoot;

// If you need to pass variables,
// If you need to pass variables,
//target should be an array of [plugin_id, '--variable', 'VARNAME=value']
//require('cordova-lib').cordova.raw.plugin('add', target)
return cordova.plugin('add', pluginId, {stdio: 'pipe'})
Expand Down
8 changes: 4 additions & 4 deletions lib/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ Hooks.add = function add(appDirectory) {
}
});

logging.logger.info('Added default Ionic Cordova hooks'.green.bold)
logging.logger.info('Added default Ionic Cordova hooks'.green.bold);

};

Hooks.remove = function remove(appDirectory) {
logging.logger.info('Removing the Ionic Cordova plugin hooks'.blue.bold)
logging.logger.info('Removing the Ionic Cordova plugin hooks'.blue.bold);
var oldPluginHooks = [
'after_platform_add/010_install_plugins.js',
'after_plugin_add/010_register_plugin.js',
Expand All @@ -99,7 +99,7 @@ Hooks.remove = function remove(appDirectory) {
var hookPath = path.join(appDirectory, 'hooks', hook);
fs.unlinkSync(hookPath);
} catch(ex) { }
})
});

logging.logger.info('Removed the Ionic Cordova hooks'.green.bold);

Expand Down Expand Up @@ -131,7 +131,7 @@ Hooks.setHooksPermission = function setHooksPermission(appDirectory) {
} catch(e) {
logging.logger.error('Hooks.setHooksPermission fs.chmodSync: %s'.error, e, {});
}
})
});
});
} catch (ex) {
logging.logger.error('Error: %s', ex);
Expand Down
4 changes: 2 additions & 2 deletions lib/hooks/after_platform_add/010_install_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ var packageJSON = null;
try {
packageJSON = require('../../package.json');
} catch(ex) {
console.log('\nThere was an error fetching your package.json file.')
console.log('\nPlease ensure a valid package.json is in the root of this project\n')
console.log('\nThere was an error fetching your package.json file.');
console.log('\nPlease ensure a valid package.json is in the root of this project\n');
return;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/hooks/after_plugin_add/010_register_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {

configString = fs.readFileSync(pluginXmlPath,{encoding: 'utf8'});
idRegEx = new RegExp('<plugin[^>]*id="(.*)"', 'i');
id = idRegEx.exec(configString)[1]
id = idRegEx.exec(configString)[1];
pluginToAdd = {id: id, locator: plugin};
} catch(ex) {
console.log('There was an error retrieving the plugin.xml filr from the 010_register_plugin.js hook', ex);
Expand All @@ -47,7 +47,7 @@ process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {
if(typeof checkPlugin == 'object' && checkPlugin.id == pluginToAdd.id) {
pluginExists = true;
}
})
});
if(!pluginExists) {
packageJSON.cordovaPlugins.push(pluginToAdd);
}
Expand Down
40 changes: 21 additions & 19 deletions lib/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Info = module.exports;
var requirements = {
node: '>=0.12.x',
cordova: '>=4.2.0'
}
};

Info.getMacInfo = function getMacInfo() {
//Need to get:
Expand Down Expand Up @@ -53,7 +53,7 @@ Info.getMacInfo = function getMacInfo() {
Info.getCordovaInfo = function getCordovaInfo(info) {
var command = 'cordova -v';
var result = shelljs.exec(command, { silent: true });
if(result.code != 0) {
if(result.code !== 0) {
info.cordova = 'Not installed';
return;
}
Expand All @@ -63,28 +63,28 @@ Info.getCordovaInfo = function getCordovaInfo(info) {

Info.getXcodeInfo = function getXcodeInfo() {
var result = shelljs.exec('/usr/bin/xcodebuild -version', { silent: true });
if(result.code != 0) {
if(result.code !== 0) {
return 'Not installed';
}
var version = result.output.replace(/\n/g, ' ')
var version = result.output.replace(/\n/g, ' ');
return version;
};

Info.getIosSimInfo = function getIosSimInfo() {
var result = shelljs.exec('ios-sim --version', { silent: true });
if(result.code != 0) {
if(result.code !== 0) {
return 'Not installed';
}
var version = result.output.replace(/\n/g, ' ')
var version = result.output.replace(/\n/g, ' ');
return version;
};

Info.getIosDeployInfo = function getIosDeployInfo() {
var result = shelljs.exec('ios-deploy --version', { silent: true });
if(result.code != 0) {
if(result.code !== 0) {
return 'Not installed';
}
var version = result.output.replace(/\n/g, ' ')
var version = result.output.replace(/\n/g, ' ');
return version;
};

Expand All @@ -106,16 +106,18 @@ Info.getIonicLibVersion = function getIonicLibVersion(info) {
};

Info.getIonicVersion = function getIonicVersion(info, appDirectory) {
var ionicVersion;

try {
var ionicVersionFile = require(path.join(appDirectory, 'www/lib/ionic/version.json'));
var ionicVersion = ionicVersionFile.version;
ionicVersion = ionicVersionFile.version;
info.ionic = ionicVersion;
} catch (ex) { }

try {
var bowerJsonPath = path.join(appDirectory, 'www', 'lib', 'ionic', 'bower.json');
var ionicPackageJson = require(bowerJsonPath);
var ionicVersion = ionicPackageJson.version;
ionicVersion = ionicPackageJson.version;
info.ionic = ionicVersion;
} catch (ex) { }

Expand Down Expand Up @@ -170,7 +172,7 @@ Info.getWindowsEnvironmentInfo = function getWindowsEnvironmentInfo() {

Info.getLinuxEnvironmentInfo = function getLinuxEnvironmentInfo() {
var result = shelljs.exec('lsb_release -id', { silent: true });
return result.output.replace(/\n/g, ' ')
return result.output.replace(/\n/g, ' ');
};

//http://stackoverflow.com/questions/6551006/get-my-os-from-the-node-js-shell
Expand Down Expand Up @@ -202,7 +204,7 @@ Info.gatherGulpInfo = function gatherGulpInfo(info) {
var result = shelljs.exec('gulp -v', { silent: true });

try {
if (result.code == 0) {
if (result.code === 0) {
// console.log(result.output);
var gulpVersions = result.output.replace(/(\[.*\])/g, '').split('\n');
if (gulpVersions.length > 0) {
Expand Down Expand Up @@ -272,7 +274,7 @@ Info.printInfo = function printInfo(info) {
}

if (info.ios_deploy) {
logging.logger.info('ios-deploy version:', info.ios_deploy)
logging.logger.info('ios-deploy version:', info.ios_deploy);
}

if(info.ios_sim) {
Expand All @@ -299,11 +301,11 @@ Info.checkRuntime = function checkRuntime() {
validRuntime = true;

try {
nodeUpgrade = !semver.satisfies(info.node, requirements.node);
nodeUpgrade = !semver.satisfies(info.node, requirements.node);
cordovaUpgrade = !semver.satisfies(info.cordova, requirements.cordova);
cordovaInstalled = true; //if it throws above, we know cordova is not installed
} catch (ex) {
}
} catch (ex) {
}

logging.logger.debug('System Info:', info);

Expand All @@ -328,14 +330,14 @@ Info.checkRuntime = function checkRuntime() {
logging.logger.info('');

if(nodeUpgrade) {
var updateMessage = [' Please update your Node runtime to version ', requirements.node].join(' ');
logging.logger.info(updateMessage.red.bold);
var updateNodeMessage = [' Please update your Node runtime to version ', requirements.node].join(' ');
logging.logger.info(updateNodeMessage.red.bold);
validRuntime = false;
}

if(!cordovaInstalled || cordovaUpgrade) {
var action = cordovaInstalled ? 'update' : 'install';
var updateMessage = [' Please', action, 'your Cordova CLI to version ', requirements.cordova, '`npm install -g cordova`'].join(' ')
var updateMessage = [' Please', action, 'your Cordova CLI to version ', requirements.cordova, '`npm install -g cordova`'].join(' ');
logging.logger.info(updateMessage.red.bold);
validRuntime = false;
}
Expand Down
Loading