123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- {
- "name": "grunt-execute",
- "description": "Execute code in node",
- "version": "0.2.2",
- "homepage": "https://github.com/Bartvds/grunt-execute",
- "author": {
- "name": "Bart van der Schoor",
- "email": "bartvanderschoor@gmail.com"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/Bartvds/grunt-execute.git"
- },
- "keywords": [
- "gruntplugin",
- "execute",
- "code",
- "node",
- "scripts",
- "spawn",
- "exec"
- ],
- "bugs": {
- "url": "https://github.com/Bartvds/grunt-execute/issues"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "https://github.com/Bartvds/grunt-execute/blob/master/LICENSE-MIT"
- }
- ],
- "main": "Gruntfile.js",
- "engines": {
- "node": ">= 0.8.0"
- },
- "scripts": {
- "test": "grunt test"
- },
- "devDependencies": {
- "grunt": "~0.4.1",
- "grunt-cli": "~0.1",
- "grunt-contrib-clean": "~0.5.0",
- "grunt-contrib-nodeunit": "~0.3.0",
- "grunt-contrib-jshint": "~0.10.0",
- "grunt-shell": "~0.7.0"
- },
- "peerDependencies": {
- "grunt": "~0.4.1"
- },
- "readme": "# grunt-execute \n\n[![Build Status](https://secure.travis-ci.org/Bartvds/grunt-execute.png?branch=master)](http://travis-ci.org/Bartvds/grunt-execute) [![Dependency Status](https://gemnasium.com/Bartvds/grunt-execute.png)](https://gemnasium.com/Bartvds/grunt-execute) [![NPM version](https://badge.fury.io/js/grunt-execute.png)](http://badge.fury.io/js/grunt-execute)\n\n> Grunt plugin to execute code in node\n\n## Getting Started\nThis plugin requires Grunt `~0.4.1`\n\nIf 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:\n\n```shell\nnpm install grunt-execute --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-execute');\n```\n\n## The \"execute\" task\n\nExecute javascript files and snippets to test application files, run loose bits development javascript or use basic files as a poor-mans grunt-tasks.\n\n* Run selected files in a node.js child process.\n* Run inline functions with grunt/options helpers and async support.\n* Run functions before/after looping the selected files.\n* Require() selected files as custom callback module.\n\nThe callback module file and inline functions all share the same signature with access to grunt, options and optional async callback.\n\n### Overview\n\nIn your project's Gruntfile, add a section named `execute` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n\texecute: {\n\t\ttarget: {\n\t\t\tsrc: ['script.js']\n\t\t}\n\t}\n})\n```\n\n### Options\n\nAlso see the Gruntfile.js for real usage examples.\n\n```js\ngrunt.initConfig({\n\texecute: {\n\t\tsimple_target: {\n\t\t\t// execute javascript files in a node child_process\n\t\t\tsrc: ['script.js']\n\t\t},\n\t\tsimple_target_with_args: {\n\t\t\toptions: {\n\t\t\t\t// execute node with additional arguments\n\t\t\t\targs: ['arg1', 'arg2']\n\t\t\t},\n\t\t\tsrc: ['script.js']\n\t\t},\n\t\tsimple_target_with_harmony: {\n\t\t\toptions: {\n\t\t\t\t// pass arguments to node itself (eg: before script parameter)\n\t\t\t\tnodeargs: ['--harmony']\n\t\t\t},\n\t\t\tsrc: ['script.js']\n\t\t},\n\t\tcwd_target: {\n\t\t\toptions: {\n\t\t\t\t// overide code cwd (defaults to '.' for project main)\n\t\t\t\tcwd: '.'\n\t\t\t},\n\t\t\tsrc: ['script.js']\n\t\t},\n\t\tglob_target: {\n\t\t\t// supports grunt glob and filter features\n\t\t\tsrc: ['apps/**/*.js', 'lib/**/index.js']\n\t\t},\n\t\tmodule_target: {\n\t\t\toptions: {\n\t\t\t\t// use require() instead of a child_process\n\t\t\t\t// the scripts must be a module exporting a function\n\t\t\t\t// use a signature like the inline call-option (see below)\n\n\t\t\t\tmodule: true\n\t\t\t},\n\t\t\tsrc: ['script.js']\n\t\t},\n\t\tcallback_sync: {\n\t\t\t// simple inline function call\n\t\t\tcall: function(grunt, options){\n\t\t\t\tgrunt.log.writeln('Hello!');\n\t\t\t}\n\t\t},\n\t\tcallback_async: {\n\t\t\t// function call also supports async callback\n\t\t\tcall: function(grunt, options, async){\n\t\t\t\t// get the callback\n\t\t\t\tvar done = async();\n\t\t\t\t\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tgrunt.log.writeln('Done!')\n\t\t\t\t\tdone(err);\n\t\t\t\t}, 1000);\n\t\t\t}\n\t\t}\n\t\tbefore_after: {\n\t\t\toptions: {\n\t\t\t\t// like call but executed before/after looping the files\n\t\t\t\tbefore: function(grunt, options){\n\t\t\t\t\tconsole.log('Hello!');\n\t\t\t\t},\n\t\t\t\tafter: function(grunt, options){\n\t\t\t\t\tconsole.log('Bye!');\n\t\t\t\t}\n\t\t\t},\n\t\t\t// can also be used outside the options\n\t\t\tbefore: function(grunt, options){\n\t\t\t\tconsole.log('Hello!');\n\t\t\t},\n\t\t\tafter: function(grunt, options){\n\t\t\t\tconsole.log('Bye!');\n\t\t\t}\n\t\t\tsrc: ['script.js'],\n\t\t},\n\t}\n});\n```\n\n\n## Versions\n\n* 0.2.2 - Add support for node arguments, via `nodeargs` (like `--harmony`)\n* 0.2.1 - Non-zero exit code will fail grunt, add support for commandline arguments\n* 0.1.5 - Added callback module & inline function support\n* 0.1.4 - Ditched stdio option, show errors inline (even in webstorm)\n* 0.1.3 - Basic version, colors disabled\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n_(Nothing yet)_\n",
- "readmeFilename": "README.md",
- "_id": "grunt-execute@0.2.2",
- "_from": "grunt-execute@^0.2.2"
- }
|