-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
So the basic idea here is that instead of binding a hidden `grunt.even.on('watch)` event, we could register a multiTask directly, and loop over the supplied filenames. The problem seems to be that grunt-contrib-watch doesn't expect to hand off to a multiTask, so things don't work correctly. There seems to be an approach for handling this kind of case laid out here though: https://www.npmjs.com/package/grunt-contrib-watch#compiling-files-as-needed Needs more experimentation.
- Loading branch information
Showing
2 changed files
with
35 additions
and
40 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
var fs = require('fs'); | ||
|
||
module.exports = function(grunt) { | ||
grunt.event.on('watch', function(action, filepath) { | ||
var CakeTestRunner, regex = /\.php$/; | ||
if (regex.test(filepath)) { | ||
CakeTestRunner = require('../cake_test_runner'), | ||
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(); }); | ||
} | ||
}); | ||
}; | ||
// module.exports = function(grunt) { | ||
// grunt.event.on('watch', function(action, filepath) { | ||
// var CakeTestRunner, regex = /\.php$/; | ||
// if (regex.test(filepath)) { | ||
// CakeTestRunner = require('../cake_test_runner'), | ||
// 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(); }); | ||
// } | ||
// }); | ||
// }; |
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