Socket
Socket
Sign inDemoInstall

grunt-hub

Package Overview
Dependencies
6
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0 to 0.6.0

22

Gruntfile.js
module.exports = function(grunt) {
'use strict';
grunt.initConfig({

@@ -8,23 +6,13 @@ hub: {

src: ['../*/Gruntfile.js'],
tasks: ['jshint']
}
tasks: ['jshint'],
},
},
watch: {
all: {
files: '<%= hub.all.src %>'
}
jshint: {
files: ['Gruntfile.js', 'tasks/**/*js'],
options: { jshintrc: '.jshintrc' },
},
jshint: {
files: ['Gruntfile.js', 'tasks/*.js'],
options: { jshintrc: '.jshintrc' }
}
});
// Load external tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
// Load watch and hub tasks
grunt.loadTasks('tasks');
grunt.registerTask('default', ['jshint']);
};
{
"name": "grunt-hub",
"description": "A Grunt task to watch and run tasks on multiple Grunt projects",
"version": "0.5.0",
"version": "0.6.0",
"homepage": "https://github.com/shama/grunt-hub",

@@ -24,3 +24,2 @@ "author": {

],
"main": "Gruntfile.js",
"engines": {

@@ -33,6 +32,8 @@ "node": ">= 0.8.0"

"dependencies": {
"gaze": "~0.3.3"
"chalk": "~0.4.0",
"async": "~0.2.10",
"lodash": "~2.4.1"
},
"devDependencies": {
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-jshint": "~0.8.0",
"grunt": "~0.4.0"

@@ -39,0 +40,0 @@ },

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

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

@@ -46,3 +46,3 @@ ### Integrate With an Existing Grunt Project

DIR=`dirname $0`
/usr/bin/nohup /usr/local/bin/grunt --base $DIR watch --no-color &
/usr/bin/nohup /usr/local/bin/grunt --base $DIR hub --no-color &
echo "Grunt Hub Started"

@@ -55,3 +55,3 @@ ```

#!/bin/sh
ps -ef | sed -n '/grunt/{/grep/!p;}' | awk '{print$2}' | xargs -i kill {}
ps -ef | sed -n '/grunt/{/grep/!p;}' | awk '{print$2}' | xargs -I kill {}
echo "Grunt Hub Stopped"

@@ -63,2 +63,21 @@ ```

### Using [forever](https://npmjs.org/package/forever)
`forever` is a another great way to watch multiple grunt projects forever.
* Install `npm install forever grunt grunt-cli grunt-hub --save-dev`
* Add a start script to your `package.json`:
```json
{
"name": "my-grunt-hub",
"version": "0.1.0",
"scripts": {
"start": "forever ./node_modules/.bin/grunt hub"
}
}
```
* Now you can start your hub with `npm start`.
## Configuring

@@ -87,2 +106,4 @@

You can override tasks on the cli with args: `grunt hub:all:watch` will run the `watch` task on all projects instead of `jshint, nodeunit`.
#### options

@@ -95,33 +116,26 @@

### `watch` task
##### `allowSelf`
Default: `false`
The watch task is for watching multiple Grunt projects and triggering tasks on
the respective Grunt project as files are edited. This watch task will read each
project's Gruntfile. If you specify `tasks` it will run only those tasks
otherwise if no `tasks` are specified it will run all and each of the project's
watch targets.
By default, hub will skip its own Gruntfile. Set to `true` to allow hub to
include itself.
To specify which Gruntfiles this watch task should read use:
**Note:** Only set this for tasks which are not part of the `default`
task of their respective Gruntfile, or an infinite loop will occur.
```javascript
grunt.initConfig({
watch: {
all: {
files: ['../*/Gruntfile.js'],
tasks: ['jshint', 'nodeunit'],
```
hub: {
all: {
options: {
allowSelf: true
},
src: ['./Gruntfile.js', '../client1/Gruntfile.js', '../client2/Gruntfile.js'],
},
});
},
```
or if you're using the above `hub` config and would like to run all the watch
targets of the projects, use:
```javascript
grunt.initConfig({
watch: {
files: '<%= hub.all.src %>',
},
});
```
## Where did the `watch` task go?
It isn't necessary. Just `npm install grunt-contrib-watch --save-dev` into your project folders. Then either add the `watch` task to your tasks list in your hub task config. Or run with `grunt hub:target:watch`.
## Contributing

@@ -133,2 +147,3 @@

* 0.6.0 Removed unneeded watch task. Fix issue with Gruntfiles not named Gruntfile. Removed deprecated grunt.util libs. Ability to override tasks via the cli.
* 0.5.0 Run hub tasks in parallel. Add concurrent option to hub. Better error handling/printing. Thanks @plestik!

@@ -149,3 +164,3 @@ * 0.4.0 Support for Grunt v0.4.

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

@@ -152,0 +167,0 @@

@@ -13,2 +13,5 @@ /*

var path = require('path');
var chalk = require('chalk');
var async = require('async');
var _ = require('lodash')

@@ -18,4 +21,5 @@ grunt.registerMultiTask('hub', 'Run multiple grunt projects', function() {

concurrent: 3,
allowSelf: false
});
grunt.verbose.writeflags(options, 'Options');
var args = (this.args.length < 1) ? false : this.args;

@@ -25,3 +29,3 @@ var done = this.async();

// Get process.argv options without grunt.cli.tasks to pass to child processes
var cliArgs = grunt.util._.without.apply(null, [[].slice.call(process.argv, 2)].concat(grunt.cli.tasks));
var cliArgs = _.without.apply(null, [[].slice.call(process.argv, 2)].concat(grunt.cli.tasks));
// Get it's own gruntfile

@@ -33,4 +37,8 @@ var ownGruntfile = grunt.option('gruntfile') || grunt.file.expand({filter: 'isFile'}, '{G,g}runtfile.{js,coffee}')[0];

function write(gruntfile, buf, isError) {
var id = gruntfile === lastGruntFileWritten ? ' ' : ('>> '.cyan + gruntfile + ':\n');
grunt.log[(isError) ? 'error' : 'writeln'](id + buf);
if (gruntfile !== lastGruntFileWritten) {
grunt.log.writeln('');
grunt.log.writeln('');
grunt.log.writeln(chalk.cyan('>> ') + gruntfile + ':\n');
}
grunt.log[(isError) ? 'error' : 'write'](buf);
lastGruntFileWritten = gruntfile;

@@ -40,3 +48,3 @@ }

// our queue for concurrently ran tasks
var queue = grunt.util.async.queue(function(run, next) {
var queue = async.queue(function(run, next) {
grunt.log.ok('Running [' + run.tasks + '] on ' + run.gruntfile);

@@ -49,3 +57,3 @@ var child = grunt.util.spawn({

// Run task to be run and any cli options
args: run.tasks.concat(cliArgs || [])
args: run.tasks.concat(cliArgs || [], '--gruntfile=' + run.gruntfile)
}, function(err, res, code) {

@@ -74,7 +82,7 @@ if (err) { errorCount++; }

// Skip it's own gruntfile. Prevents infinite loops.
if (gruntfile === ownGruntfile) { return; }
if (!options.allowSelf && gruntfile === ownGruntfile) { return; }
queue.push({
gruntfile: gruntfile,
tasks: files.tasks || ['default']
tasks: args || files.tasks || ['default']
});

@@ -81,0 +89,0 @@ });

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

* Edit the hub.all.src to point to your Gruntfile locations.
* Then run `grunt` or `grunt watch`.
* Then run `grunt`.
*/

@@ -15,11 +15,5 @@ module.exports = function(grunt) {

src: ['../*/Gruntfile.js'],
tasks: ['jshint']
}
tasks: ['jshint'],
},
},
watch: {
all: {
files: ['<%= hub.all.files %>'],
tasks: ['jshint']
}
}
});

@@ -26,0 +20,0 @@

{
"name": "my-grunt-hub",
"version": "0.1.0",
"description": "A grunt hub",
"repository": {
"type": "git",
"url": "git://github.com/user/repo.git"
},
"devDependencies": {

@@ -5,0 +10,0 @@ "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