Skip to content

Instantly share code, notes, and snippets.

@jimschubert
Created November 23, 2015 18:53
Show Gist options
  • Save jimschubert/3f9ce0122a0165eaf789 to your computer and use it in GitHub Desktop.
Save jimschubert/3f9ce0122a0165eaf789 to your computer and use it in GitHub Desktop.
Gulp build for dotnet tasks
'use strict';
import gulp from 'gulp';
import gutil from 'gulp-util';
import { spawn } from 'child_process';
function runner(cmd, args){
return function(callback) {
let command = spawn(cmd, args);
command.stdout.pipe(process.stdout);
command.stderr.pipe(process.stderr);
command.on('close', function (code) {
if (code !== 0) {
throw new gutil.PluginError('dotnet', `Exited with code ${code}: ${cmd} ${args}.`);
}
callback();
});
}
}
gulp.task('dotnet-build', runner('dnu', ['build']));
gulp.task('dotnet-restore', runner('dnu', ['restore']));
gulp.task('dotnet-run', runner('dnx', ['web']));
gulp.task('dotnet-test', runner('dnx', ['test']));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment