Last active
August 29, 2015 14:24
-
-
Save bonsi/8950e0820ec88eb5d87f to your computer and use it in GitHub Desktop.
Gulpfile with remote GNTP notifications (currently using localhost + ssh tunnel back to host + Growl for Windows)
This file contains hidden or 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
| var gulp = require('gulp'); | |
| var phpspec = require('gulp-phpspec'); | |
| var run = require('gulp-run'); | |
| var notify = require('gulp-notify'); | |
| var nn = require('node-notifier'); | |
| var customNotifier = notify.withReporter(function (options, callback) { | |
| new nn.Growl().notify(options, callback); | |
| }); | |
| gulp.task('test', function() { | |
| gulp.src('spec/**/*.php') | |
| .pipe(run('clear').exec()) | |
| .pipe(phpspec('', { notify: true })) | |
| .on('error', customNotifier.onError(getOptions('fail'))) | |
| .pipe(customNotifier(getOptions('pass'))); | |
| // .on('error', notify.onError({ | |
| // title: 'Dangit', | |
| // message: 'Your tests failed!', | |
| // icon: __dirname + '/fail.png' | |
| // })) | |
| // .pipe(notify({ | |
| // title: 'Success', | |
| // message: 'All tests have returned green!' | |
| // })); | |
| }); | |
| function getOptions(status) { | |
| options = { | |
| title: ( status === 'pass' ) ? 'Tests Passed' : 'Tests Failed', | |
| message: ( status === 'pass' ) ? '\n\nAll tests have passed!\n\n' : '\n\nOne or more tests failed...\n\n', | |
| // icon: __dirname + '/node_modules/gulp-' + pluginName +'/assets/test-' + status + '.png', | |
| // icon: ( status === 'pass') ? path.join(__dirname, "success.png") : path.join(__dirname, "error.png"), | |
| // icon: __dirname + '/node_modules/gulp-codeception/assets/test-' + status + '.png', | |
| sticky: false | |
| }; | |
| // console.log('getOptions: '+JSON.stringify(options)); | |
| return options; | |
| } | |
| gulp.task('watch', function() { | |
| gulp.watch(['spec/**/*.php', 'src/**/*.php'], ['test']); | |
| }); | |
| gulp.task('default', ['test', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment