{"size": 2008, "ext": "js", "max_stars_repo_path": "lib/xhi_12.js", "max_stars_repo_name": "dev-inst/sparx", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/xhi_12.js", "max_issues_repo_name": "dev-inst/sparx", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/xhi_12.js", "max_forks_repo_name": "dev-inst/sparx", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.873015873, "max_line_length": 73, "alphanum_fraction": 0.5139442231}
/*
 * lib/xhi_12.js
 * @author Michael S. Mikowski - mike.mikowski@gmail.com
 *
*/
// == BEGIN PUBLIC METHOD /commitFn/ ==================================
function coverFn () {
  // == BEGIN MODULE SCOPE VARIABLES ==================================
  'use strict';
  var
    xhiObj         = this,

    commandMap     = xhiObj.commandMap,
    logFn          = xhiObj.logFn,
    prefixStr      = xhiObj.makePrefixStr( commandMap ),
    stageStatusMap = xhiObj.stageStatusMap,
    stateMatrix    = xhiObj.stateMatrix,

    aliasStr       = commandMap.alias_str,
    childProcObj
    ;
  // == . END MODULE SCOPE VARIABLES ==================================

  // == BEGIN EVENT HANDLERS ==========================================
  function onCloseFn ( exit_int ) {
    // Store failure and finish
    if ( exit_int !== 0 ) {
      stageStatusMap[ aliasStr ] = false;
      return xhiObj.catchFn( prefixStr + 'Fail' );
    }

    // Increment build index, store success, and finish
    stateMatrix.build_idx++;
    stageStatusMap[ aliasStr ] = true;
    logFn( prefixStr + 'Success' );
    xhiObj.nextFn();
  }
  // == . END EVENT HANDLERS ==========================================

  // == BEGIN MAIN ====================================================
  // "cat build/latest/coverage/lcov.info | node_modules/.bin/coveralls",
  // See https://stackoverflow.com/questions/28968662
  function mainFn () {
    logFn( prefixStr + 'Start' );
    process.chdir( xhiObj.fqProjDirname );
    childProcObj = xhiObj.makeSpawnObj(
      'sh',
      [ '-c', 'cat build/latest/coverage/lcov.info '
        + '| node_modules/.bin/coveralls'
      ],
      { stdio : 'inherit'}
    );
    childProcObj.on( 'close', onCloseFn );
  }
  // childProcObj.stdout.on( 'data',  onStdoutFn );
  // childProcObj.stderr.on( 'data',  onStderrFn );
  // == . END MAIN ====================================================
  mainFn();
}
// == . END PUBLIC METHOD /commitFn/ ==================================
module.exports = coverFn;

