Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added filter option to allow filtering of submodules using config. #1

Merged
merged 3 commits into from
Nov 4, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tasks/submodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ module.exports = function (grunt) {
var options = this.options({
base: '.',
gruntfile: 'Gruntfile.js',
filter: undefined,
tasks: arguments.length > 1 ? [].slice.call(arguments, 1) : ['default']
});
var data = grunt.config(this.name) || {};
var done = this.async();
var filter = arguments[0] ? minimatch.filter(arguments[0]) : function () { return true; };
var filter = options.filter ? minimatch.filter(options.filter) : function () { return true; };

function getOptions(submodule) {
var sources = [];
Expand Down Expand Up @@ -85,7 +86,7 @@ module.exports = function (grunt) {
var err;
var args = [
options.base,
submodule,
'.',
options.gruntfile
].concat(options.tasks).concat(grunt.option.flags());

Expand All @@ -94,7 +95,7 @@ module.exports = function (grunt) {
grunt.verbose.writeln('Arguments:', grunt.log.wordlist(args));
grunt.log.writeln();

var cp = fork(__dirname + '/lib/grunt', args, {silent: true});
var cp = fork(__dirname + '/lib/grunt', args, {silent: true, cwd: submodule});
cp.stdout.pipe(grunt.log.options.outStream, {end: false});
cp.on('message', function (msg) {
if (msg.event) {
Expand Down