Socket
Socket
Sign inDemoInstall

grunt-hub

Package Overview
Dependencies
7
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.5.0

tasks/init/hub/Gruntfile.js

2

package.json
{
"name": "grunt-hub",
"description": "A Grunt task to watch and run tasks on multiple Grunt projects",
"version": "0.4.0",
"version": "0.5.0",
"homepage": "https://github.com/shama/grunt-hub",

@@ -6,0 +6,0 @@ "author": {

@@ -16,3 +16,3 @@ # grunt-hub

Then edit the grunt.js file to point to your other Grunt projects and run:
Then edit the Gruntfile file to point to your other Grunt projects and run:
`grunt` or `grunt watch`.

@@ -76,5 +76,5 @@

src: ['../*/Gruntfile.js'],
tasks: ['jshint', 'nodeunit']
}
}
tasks: ['jshint', 'nodeunit'],
},
},
});

@@ -85,2 +85,9 @@ ```

#### options
##### `concurrent`
Default: `3`
Set to the number of concurrent task runs to spawn.
### `watch` task

@@ -101,5 +108,5 @@

files: ['../*/Gruntfile.js'],
tasks: ['jshint', 'nodeunit']
}
}
tasks: ['jshint', 'nodeunit'],
},
},
});

@@ -113,4 +120,4 @@ ```

watch: {
files: '<%= hub.all.src %>'
}
files: '<%= hub.all.src %>',
},
});

@@ -125,2 +132,3 @@ ```

* 0.5.0 Run hub tasks in parallel. Add concurrent option to hub. Better error handling/printing. Thanks @plestik!
* 0.4.0 Support for Grunt v0.4.

@@ -140,3 +148,3 @@ * 0.3.6 Propagate exit codes. Thanks @wachunga!

Copyright (c) 2012 Kyle Robinson Young
Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.

@@ -143,0 +151,0 @@

@@ -15,3 +15,5 @@ /*

grunt.registerMultiTask('hub', 'Run multiple grunt projects', function() {
var options = this.options();
var options = this.options({
concurrent: 3,
});
grunt.verbose.writeflags(options, 'Options');

@@ -21,3 +23,2 @@

var errorCount = 0;
var tasks = this.data.tasks || 'default';
// Get process.argv options without grunt.cli.tasks to pass to child processes

@@ -29,5 +30,39 @@ var cliArgs = grunt.util._.without.apply(null, [[].slice.call(process.argv, 2)].concat(grunt.cli.tasks));

grunt.util.async.forEachSeries(this.files, function(files, next) {
var lastGruntFileWritten;
function write(gruntfile, buf, isError) {
var id = gruntfile === lastGruntFileWritten ? ' ' : ('>> '.cyan + gruntfile + ':\n');
grunt.log[(isError) ? 'error' : 'writeln'](id + buf);
lastGruntFileWritten = gruntfile;
}
// our queue for concurrently ran tasks
var queue = grunt.util.async.queue(function(run, next) {
grunt.log.ok('Running [' + run.tasks + '] on ' + run.gruntfile);
var child = grunt.util.spawn({
// Use grunt to run the tasks
grunt: true,
// Run from dirname of gruntfile
opts: {cwd: path.dirname(run.gruntfile)},
// Run task to be run and any cli options
args: run.tasks.concat(cliArgs || [])
}, function(err, res, code) {
if (err) { errorCount++; }
next();
});
child.stdout.on('data', function(buf) {
write(run.gruntfile, buf);
});
child.stderr.on('data', function(buf) {
write(run.gruntfile, buf, true);
});
}, options.concurrent);
// When the queue is all done
queue.drain = function() {
done((errorCount === 0));
};
this.files.forEach(function(files) {
var gruntfiles = grunt.file.expand({filter: 'isFile'}, files.src);
grunt.util.async.forEachSeries(gruntfiles, function(gruntfile, n) {
gruntfiles.forEach(function(gruntfile) {
gruntfile = path.resolve(process.cwd(), gruntfile);

@@ -38,24 +73,7 @@

grunt.log.ok('Running [' + tasks + '] on ' + gruntfile);
// Spawn the tasks
grunt.util.spawn({
// Use the node that spawned this process
cmd: process.argv[0],
// Run from dirname of gruntfile
opts: {cwd: path.dirname(gruntfile)},
// Run grunt this process uses, append the task to be run and any cli options
args: grunt.util._.union([process.argv[1]].concat(tasks), cliArgs)
}, function(err, res, code) {
if (code !== 0) {
errorCount++;
grunt.log.error(res.stderr);
}
grunt.log.writeln(res.stdout).writeln('');
n();
queue.push({
gruntfile: gruntfile,
tasks: files.tasks || ['default']
});
}, next);
}, function () {
var withoutErrors = (errorCount === 0);
done(withoutErrors);
});
});

@@ -62,0 +80,0 @@

@@ -5,3 +5,3 @@ /*

*
* Copyright (c) 2012 Kyle Robinson Young
* Copyright (c) 2013 Kyle Robinson Young
* Licensed under the MIT license.

@@ -8,0 +8,0 @@ */

@@ -5,4 +5,4 @@ {

"devDependencies": {
"grunt": "~0.4.0a"
"grunt": "~0.4.1"
}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc