Created
November 23, 2015 18:53
-
-
Save jimschubert/3f9ce0122a0165eaf789 to your computer and use it in GitHub Desktop.
Gulp build for dotnet tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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