Skip to content
Browse files

Fixed handling of bad input for mojito jslint mojit command, modified…

… the help/usage message
  • Loading branch information...
1 parent a482e5e commit bfc26171edd0b65f88a81425803a4db8fe28d76a @dmitris committed
Showing with 22 additions and 4 deletions.
  1. +22 −4 lib/app/commands/jslint.js
View
26 lib/app/commands/jslint.js
@@ -12,7 +12,15 @@ var fs = require('fs'),
path = require('path'),
existsSync = fs.existsSync || path.existsSync,
utils = require(path.join(__dirname, '../../management/utils')),
- usage = 'mojito jslint [app | mojit] [<name>] {options}\n' +
+ usage = 'mojito jslint [app | mojit] [<path>] {options}\n' +
+ '\t- target: app or mojit\n' +
+ '\t- path (required for a mojit target): the path to the mojit to run jslint on\n\n' +
+ 'Run jslint on the app in the current directory:\n' +
+ '\tmojito jslint app .\n' +
+ 'Run jslint on mojits/Bar:\n' +
+ '\tmojito jslint mojit ./mojits/Bar\n' +
+ 'Run jslint on the mojito framework itself!\n' +
+ '\tmojito jslint\n' +
'\nOPTIONS: \n' +
'\t --print : print results to stdout \n' +
'\t -p : short for --print\n',
@@ -409,6 +417,7 @@ function run(params, options) {
outDir,
failures,
errors,
+ mojit_path,
print = options && options.print;
// Process params to determine input and output locations.
@@ -442,13 +451,22 @@ function run(params, options) {
];
} else if (params[0] === 'mojit') {
// mojit
- inDir = getMojitDir(params[1]);
+ mojit_path = params[1];
+ if (!mojit_path) {
+ utils.error('Please specify mojit name', exports.usage);
+ return;
+ }
+ inDir = getMojitDir(mojit_path);
+ if (!existsSync(inDir)) {
+ utils.error('Mojit ' + mojit_path + ' not found.', usage);
+ return;
+ }
if (!inDir) {
- utils.error('Mojit not found.', usage);
+ utils.error('Mojit ' + mojit_path + ' not found.', usage);
return;
}
outDir = path.join(inDir, 'artifacts/jslint/mojits',
- getMojitName(params[1]));
+ getMojitName(mojit_path));
excludes = [
/\/tests$/,
/\/artifacts$/,

0 comments on commit bfc2617

Please sign in to comment.
Something went wrong with that request. Please try again.