samples/cordova/video_chat/platforms/ios/cordova/lib/check_reqs.js
function checkTool (tool, minVersion, message, toolFriendlyName) {
    toolFriendlyName = toolFriendlyName || tool;

    // Check whether tool command is available at all
    var tool_command = shell.which(tool);
    if (!tool_command) {
        return Q.reject(toolFriendlyName + ' was not found. ' + (message || ''));
    }
    // check if tool version is greater than specified one
    return versions.get_tool_version(tool).then(function (version) {
        version = version.trim();
        return versions.compareVersions(version, minVersion) >= 0 ?
            Q.resolve(version) :
            Q.reject('Cordova needs ' + toolFriendlyName + ' version ' + minVersion +
              ' or greater, you have version ' + version + '. ' + (message || ''));
    });
}
function checkTool (tool, minVersion, message, toolFriendlyName) {
    toolFriendlyName = toolFriendlyName || tool;

    // Check whether tool command is available at all
    var tool_command = shell.which(tool);
    if (!tool_command) {
        return Q.reject(toolFriendlyName + ' was not found. ' + (message || ''));
    }
    // check if tool version is greater than specified one
    return versions.get_tool_version(tool).then(function (version) {
        version = version.trim();
        return versions.compareVersions(version, minVersion) >= 0 ?
            Q.resolve(version) :
            Q.reject('Cordova needs ' + toolFriendlyName + ' version ' + minVersion +
              ' or greater, you have version ' + version + '. ' + (message || ''));
    });
}
function checkTool ( tool , minVersion , message , toolFriendlyName ) { toolFriendlyName = toolFriendlyName || tool ; // Check whether tool command is available at all var tool_command = shell . which ( tool ) ; if ( ! tool_command ) { return Q . reject ( toolFriendlyName + ' was not found. ' + ( message || '' ) ) ; } // check if tool version is greater than specified one return versions . get_tool_version ( tool ) . then ( function ( version ) { version = version . trim ( ) ; return versions . compareVersions ( version , minVersion ) >= 0 ? Q . resolve ( version ) : Q . reject ( 'Cordova needs ' + toolFriendlyName + ' version ' + minVersion + ' or greater, you have version ' + version + '. ' + ( message || '' ) ) ; } ) ; }
Checks if specific tool is available.
@param  {String} tool       Tool name to check. Known tools are 'xcodebuild' and 'ios-deploy'
@param  {Number} minVersion Min allowed tool version.
@param  {String} message    Message that will be used to reject promise.
@param  {String} toolFriendlyName  Friendly name of the tool, to report to the user. Optional.
@return {Promise}           Returns a promise either resolved with tool version or rejected
Checks if specific tool is available .