Skip to content

Instantly share code, notes, and snippets.

@RootUp
Created November 15, 2018 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RootUp/189645808a9e8a51fa36af7bdfde70af to your computer and use it in GitHub Desktop.
Save RootUp/189645808a9e8a51fa36af7bdfde70af to your computer and use it in GitHub Desktop.
Mozilla PDF.js
gulp.task('baseline', function (done) {
console.log();
console.log('### Creating baseline environment');
var baselineCommit = process.env['BASELINE'];
if (!baselineCommit) {
done(new Error('Missing baseline commit. Specify the BASELINE variable.'));
return;
}
var initializeCommand = 'git fetch origin';
if (!checkDir(BASELINE_DIR)) {
mkdirp.sync(BASELINE_DIR);
initializeCommand = 'git clone ../../ .';
}
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
exec(initializeCommand, { cwd: workingDirectory, }, function (error) {
if (error) {
done(new Error('Baseline clone/fetch failed.'));
return;
}
exec('git checkout ' + baselineCommit, { cwd: workingDirectory, },
function (error) {
if (error) {
done(new Error('Baseline commit checkout failed.'));
return;
}
console.log('Baseline commit "' + baselineCommit + '" checked out.');
done();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment