Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-command-run

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-command-run - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

3

Gruntfile.js

@@ -52,3 +52,4 @@ /*

}
}
},
quiet: true
},

@@ -55,0 +56,0 @@ files: [{

{
"name": "grunt-command-run",
"description": "Grunt plugin for easily run command line tools for your files",
"version": "0.1.0",
"description": "Grunt plugin for easily run command line (CLI) tools for your files",
"version": "0.1.1",
"homepage": "https://github.com/Kreozot/grunt-command-run",

@@ -40,4 +40,8 @@ "author": {

"keywords": [
"gruntplugin"
"gruntplugin",
"grunt",
"cli",
"command",
"command-line"
]
}
# grunt-command-run
> Grunt plugin for easily run command line tools for your files
Grunt plugin for easily run command line tools for your files.
Have an external tool and want to process your source file with it? Use this plugin!
## Getting Started

@@ -25,13 +27,30 @@ This plugin requires Grunt `~0.4.5`

### Usage Example
XSLT templates compilation:
```js
grunt.initConfig({
// The task
command_run: {
your_target: {
// Your target
compile_xslt: {
options: {
getCommand: function(file, dest) {
var commandLine = 'tool ' + file + ' ' + dest;
return commandLine;
}
// Callback function that returns command for processing one of your files
getCommand: function(filepath, dest) {
// Do some stuff, e.g. take just filename from relative filepath
var fileName = filepath.split("/").pop();
// Return command line for processing the file
return './tools/msxsl.exe ' + file + ' schema.xsl -o ' + dest + fileName;
},
// Output only errors
quiet: true
},
files: ['./path/file'],
// Standart files declaration
files: [{
expand: false,
src: ['templates/*.*'],
dest: 'build/'
}],
},

@@ -50,4 +69,4 @@ },

##### Parameters:
* **file**: Path to the file that processing now
* **dest**: Destination for the file
* **filepath**: Path to the file that processing now
* **dest**: Destination for the file (Depends on "expand" parameter in your files declaration, see below)

@@ -58,31 +77,10 @@ #### files

### Usage Examples
#### XSLT templates compilation
```js
grunt.initConfig({
command_run: {
your_target: {
options: {
getCommand: function(file, dest) {
var fileName = file.split("/").pop();
return './tools/msxsl.exe ' + file + ' schema.xsl -o ' + dest + fileName;
}
},
files: [{
expand: false,
src: ['templates/*.*'],
dest: 'build/'
}],
},
},
});
```
## Contributing
In 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/).
If you see any textual errors, please feel free to correct.
## Release History
_(Nothing yet)_
* **0.1.1** Quiet mode
* **0.1.0** First version

@@ -15,7 +15,10 @@ /*

grunt.log.writeln('Processing started...');
var exec = require('child_process').exec;
var done = this.async();
var getCommand = this.options().getCommand;
var options = this.options();
if (!options.quiet) {
grunt.log.writeln('Processing started...');
}
var fileGroupsCount = this.files.length;

@@ -36,5 +39,5 @@ var processedGroupsCount = 0;

files.forEach(function(filepath) {
exec(getCommand(filepath, fileGroup.dest),
exec(options.getCommand(filepath, fileGroup.dest),
function(error, stdout, stderr) {
if (stdout && (stdout.length > 0)) {
if (stdout && (stdout.length > 0) && !options.quiet) {
grunt.log.writeln('stdout: ' + stdout);

@@ -41,0 +44,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc