grunt-particles
Advanced tools
Comparing version
@@ -24,3 +24,3 @@ /* | ||
options: { | ||
runServices: ['svc|pipeline!testService'], | ||
runServices: ['svc|pipeline!testService', 'svc|pipeline!testService2'], | ||
config: { | ||
@@ -27,0 +27,0 @@ appRoot: __dirname, |
{ | ||
"name": "grunt-particles", | ||
"description": "Invoke Scatter services from Grunt (and dynamically control its configuration)", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/particles/grunt-particles", | ||
@@ -30,3 +30,3 @@ "author": { | ||
"dependencies": { | ||
"particles": "~0.1.3" | ||
"particles": "~0.2.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
# grunt-particles | ||
Invoke Scatter/Particles services from Grunt (and dynamically control its configuration) | ||
Invoke Scatter/Particles services from Grunt | ||
@@ -10,97 +10,4 @@ [](https://nodei.co/npm/grunt-particles/) | ||
## Getting Started | ||
This plugin requires Grunt `~0.4.1` | ||
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
```shell | ||
npm install grunt-particles --save-dev | ||
``` | ||
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: | ||
```js | ||
grunt.loadNpmTasks('grunt-particles'); | ||
``` | ||
## The "particles" task | ||
### Overview | ||
In your project's Gruntfile, add a section named `scatter` to the data object passed into `grunt.initConfig()`. | ||
```js | ||
grunt.initConfig({ | ||
particles: { | ||
options: { | ||
// Task-specific options go here. | ||
} | ||
}, | ||
}) | ||
``` | ||
### Options | ||
#### options.runServices | ||
Type: `Array` | ||
Default value: None (Option Required) | ||
#### options.appRoot | ||
Type: `String` | ||
Default value: None (Option Required) | ||
#### options.configDir | ||
Type: `String` | ||
Default value: `'config'` | ||
#### options.configNamespace | ||
Type: `String` | ||
Default value: `'particles:app'` | ||
## Config parameters | ||
In the context of `options.configNamespace`: | ||
#### particles | ||
Type: `Array` | ||
Default value: `[]` | ||
#### nodeModulesDir | ||
Type: `String` | ||
Default value: `''` | ||
## Usage Examples | ||
```js | ||
grunt.initConfig({ | ||
scatter: { | ||
options: { | ||
runServices: "svc|sequence!aService/toRun", | ||
appRoot: __dirname, | ||
configDir: __dirname + "/test/config" | ||
} | ||
} | ||
}) | ||
``` | ||
```js | ||
{ | ||
"particles": { | ||
"app": { | ||
"particles": ["${appRoot}/aParticle/root"] | ||
} | ||
} | ||
} | ||
``` | ||
# License | ||
MIT | ||
----- | ||
[](https://bitdeli.com/free "Bitdeli Badge") |
@@ -5,3 +5,3 @@ | ||
var path = require('path'), | ||
particles = require('particles'); | ||
Particles = require('particles'); | ||
@@ -19,6 +19,4 @@ module.exports = function(grunt) { | ||
var options = this.options({ | ||
scatterOptions: {}, | ||
config: {}, | ||
runServices: null, | ||
configNamespace: null | ||
runServices: null | ||
}); | ||
@@ -28,3 +26,2 @@ | ||
runServices: options.runServices, | ||
configNamespace: options.configNamespace, | ||
config: options.config, | ||
@@ -34,3 +31,4 @@ serviceArgs: [{grunt: grunt}] | ||
particles.run(particlesOptions).then(function() { | ||
var app = new Particles(particlesOptions); | ||
app.run().then(function() { | ||
done(); | ||
@@ -37,0 +35,0 @@ }).otherwise(done); |
@@ -9,4 +9,4 @@ { | ||
}, | ||
"particles": { | ||
"app": { | ||
"containers": { | ||
"default": { | ||
"particles": ["${appRoot}/test/root"] | ||
@@ -13,0 +13,0 @@ } |
var self = module.exports = { | ||
__module: { | ||
provides: ["testService"] | ||
provides: ["testService", "testService2"] | ||
}, | ||
@@ -9,3 +9,7 @@ | ||
self.input = input; | ||
}, | ||
testService2: function(input) { | ||
self.input2 = input; | ||
} | ||
}; |
@@ -34,7 +34,9 @@ 'use strict'; | ||
testServiceInvocation: function(test) { | ||
test.expect(2); | ||
test.expect(4); | ||
var input = require('./root/testModule').input; | ||
test.ok(input); | ||
test.ok(input.grunt); | ||
var testModule = require('./root/testModule'); | ||
test.ok(testModule.input); | ||
test.ok(testModule.input.grunt); | ||
test.ok(testModule.input2); | ||
test.ok(testModule.input2.grunt); | ||
@@ -41,0 +43,0 @@ test.done(); |
126
2.44%6559
-19.79%13
-87.74%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated