-
-
Save ysaito8015/42966e31dea0e8122887 to your computer and use it in GitHub Desktop.
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
var gulp = require('gulp'); | |
var connect = require('gulp-connect'); | |
var modRewrite = require('connect-modrewrite'); | |
var runSequence = require('run-sequence'); | |
var shell = require('gulp-shell'); | |
//proxy all requests to /api to localhost:3000 for rails api | |
gulp.task('connect', function(){ | |
connect.server({ | |
root: './app', | |
port: 8000, | |
middleware: function() { | |
return [ | |
modRewrite([ | |
'^/api/v1/(.*)$ http://localhost:3000/api/v1/$1 [P]' | |
]) | |
]; | |
} | |
}); | |
}); | |
//start rails server daemon | |
gulp.task('rails-start', shell.task([ | |
'rails s -d' | |
])); | |
gulp.task('rails-kill', shell.task([ | |
"kill `cat ../tmp/pids/server.pid`" | |
])); | |
//resets rails dev DB with seed.db data | |
gulp.task('db-setup', shell.task([ | |
'bundle exec rake db:setup' | |
])); | |
//runs e2e tests | |
gulp.task('protractor', shell.task([ | |
'protractor protractorConfig.js' | |
])); | |
gulp.task('e2e-test', function(){ | |
// start servers, setup test db, | |
// run e2e tests, | |
// reset db, kill rails daemon | |
runSequence('rails-start', 'connect', 'db-setup', 'protractor', | |
'db-setup', 'rails-kill') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment