Skip to content

Commit

Permalink
WIP gruntfile tests.
Browse files Browse the repository at this point in the history
The PHP test runner should really be a MultiTask so it fires tests sequentially (they clobber each other inside the VM otherwise.) This would also allow us to have the individual filenames available in the Gruntfile.
  • Loading branch information
beporter committed Oct 22, 2014
1 parent c5ac4af commit c2fca2f
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var fs = require('fs');

module.exports = function(grunt) {
var changedFiles = {};
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');

Expand Down Expand Up @@ -29,7 +30,11 @@ module.exports = function(grunt) {
'!.git/**/*.php',
'**/*.php'
],
tasks: 'null'
tasks: 'null',
// tasks: 'phptestfile',
options: {
spawn: false
}
},
less: {
files: [
Expand All @@ -40,7 +45,14 @@ module.exports = function(grunt) {
}
});

grunt.registerTask('null', function() {});
grunt.registerTask('default', ['watch']);

grunt.event.on('watch', function(action, filepath) {
// console.log(action, filepath, this);
// if (this.name != 'watch:php') {
// return false;
// }
var CakeTestRunner = require('./Console/node/cake_test_runner'),
file = new CakeTestRunner(filepath);

Expand All @@ -51,6 +63,28 @@ module.exports = function(grunt) {
file.exists(function() { file.run(); });
});

grunt.registerTask('null', function() {});
grunt.registerTask('default', ['watch']);




// grunt.event.on('watch', function(action, filepath) {
// if (this.name === 'watch:php') {
// changedFiles[filepath] = action;
// }
// });
//
// grunt.registerMultiTask('phptestfile', function() {
// console.log(changedFiles);
// return true;
//
// var filepath = '?';
// var CakeTestRunner = require('./Console/node/cake_test_runner');
// var file = new CakeTestRunner(filepath);
//
// if (fs.existsSync('.vagrant')) { //@TODO: This doesn't work because the folder shows up inside the VM too.
// file.vagrantHost = true;
// }
//
// file.exists(function() { file.run(); });
// });
};

0 comments on commit c2fca2f

Please sign in to comment.