index.js
function runCodeBlock(codeBlock) {
  var dir = path.dirname(codeBlock.filename);
  return new Promise(function(fulfill, reject) {
    var filenameWithoutDir = codeBlock.filename.replace(dir + '/', '');
    var command = runner(codeBlock, filenameWithoutDir);
    if (command === null) {
      fulfill(codeBlock);
      return;
    }
    exec(command, {cwd: dir}, function(error, stdout, stderr) {
      if (error) {
        console.error(error);
        reject(error);
      } else {
        if (stdout) {
          console.log(stdout);
        }
        if (stderr) {
          console.error(stderr);
        }
        fulfill(codeBlock);
      }
    });
  });
}
function runCodeBlock(codeBlock) {
  var dir = path.dirname(codeBlock.filename);
  return new Promise(function(fulfill, reject) {
    var filenameWithoutDir = codeBlock.filename.replace(dir + '/', '');
    var command = runner(codeBlock, filenameWithoutDir);
    if (command === null) {
      fulfill(codeBlock);
      return;
    }
    exec(command, {cwd: dir}, function(error, stdout, stderr) {
      if (error) {
        console.error(error);
        reject(error);
      } else {
        if (stdout) {
          console.log(stdout);
        }
        if (stderr) {
          console.error(stderr);
        }
        fulfill(codeBlock);
      }
    });
  });
}
function runCodeBlock ( codeBlock ) { var dir = path . dirname ( codeBlock . filename ) ; return new Promise ( function ( fulfill , reject ) { var filenameWithoutDir = codeBlock . filename . replace ( dir + '/' , '' ) ; var command = runner ( codeBlock , filenameWithoutDir ) ; if ( command === null ) { fulfill ( codeBlock ) ; return ; } exec ( command , { cwd : dir } , function ( error , stdout , stderr ) { if ( error ) { console . error ( error ) ; reject ( error ) ; } else { if ( stdout ) { console . log ( stdout ) ; } if ( stderr ) { console . error ( stderr ) ; } fulfill ( codeBlock ) ; } } ) ; } ) ; }
Runs a code block. Uses specially runners for files like Gemfile and package.json. Returns codeBlock.
Runs a code block . Uses specially runners for files like Gemfile and package . json . Returns codeBlock .