Mailspring/packages/client-app/build/tasks/task-helpers.js
Evan Morikawa 7b7318b220 [client-app] update Travis
Summary:
Also see:
3a33b0ad64
which was hot-pushed to master in order to get Travis building.

We now have two travis files:

1. /.travis.yml
2. /packages/client-app/travis.yml

The first one is alwas in the private repo and runs `npm install && npm
run build-client`. This decrypts our keys and signs, builds, and uploads
to S3.

The second one is designed to live in our yet-to-be public mirror. It will
basically just run `npm install && npm test`.

That way the public one should just about ALWAYS pass (YAY!) except of
course when you break the tests or something in the installer!

Test Plan: Run on new https://travis-ci.com/nylas/nylas-mail-all

Reviewers: jerm, spang, juan

Reviewed By: spang, juan

Differential Revision: https://phab.nylas.com/D3999
2017-02-22 16:19:45 -05:00

41 lines
1.3 KiB
JavaScript

const childProcess = require('child_process');
module.exports = (grunt) => {
function spawn(options, callback) {
const stdout = [];
const stderr = [];
let error = null;
const proc = childProcess.spawn(options.cmd, options.args, options.opts);
proc.stdout.on('data', data => stdout.push(data.toString()));
proc.stderr.on('data', data => stderr.push(data.toString()));
proc.on('error', (processError) => {
return error != null ? error : (error = processError)
});
proc.on('close', (exitCode, signal) => {
if (exitCode !== 0) { if (typeof error === 'undefined' || error === null) { error = new Error(signal); } }
const results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode};
if (exitCode !== 0) { grunt.log.error(results.stderr); }
return callback(error, results, exitCode);
});
}
function shouldPublishBuild() {
if (!process.env.PUBLISH_BUILD) {
grunt.log.writeln("Skipping because PUBLISH_BUILD env is not set");
return false;
}
return true;
}
function spawnP(options) {
return new Promise((resolve, reject) => {
spawn(options, (error) => {
if (error) return reject(error);
return resolve()
})
})
}
return {spawn, spawnP, shouldPublishBuild};
}