grunt-tar-passthru
- Pass-through interface for tar commands in Grunt.
- Requires tar already installed and accessible from terminal.
- Syntactically similar to entering a tar command in the terminal. Each
array value in a job essentially represents a single command line parameter.
- You can do anything with this that you can do with tar.
Getting Started
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-tar-passthru --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-tar-passthru');
The "tar_passthru" task
Overview
In your project's Gruntfile, add a section named tar_passthru
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
tar_passthru: {
}
});
Options
Here you can add string properties that you can reference using: <%= tar_passthru.options.xxxxxx %>.
Jobs
An array of jobs you wish to tar.
Usage Example
grunt.initConfig({
tar_passthru: {
options : {
cwd : (function(){
return process.cwd()
}())
,timestamp : (function(){
var d = new Date(),dstr = '';
return ('0' + (d.getMonth()+1)).slice(-2)
+ '.' + ('0' + d.getDate()).slice(-2)
+ '.' + d.getFullYear()
+ '.' + ('0' + d.getHours()).slice(-2)
+ '' + ('0' + d.getMinutes()).slice(-2);
}())
}
,jobs : [
[
"-zcvf"
,"/path/to/archive.<%= tar_passthru.options.timestamp %>.tar.gz"
,"-P"
,[
'/path/to/somedir'
]
,"--directory=/path/to/somedir"
,"--exclude=someotherdirname"
]
]
}
});