Socket
Socket
Sign inDemoInstall

grunt-tar-passthru

Package Overview
Dependencies
100
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grunt-tar-passthru

Pass-through interface for tar commands in Grunt.


Version published
Weekly downloads
10
increased by900%
Maintainers
1
Install size
10.1 kB
Created
Weekly downloads
 

Readme

Source

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(){

            //A FORMATTED TIMESTAMP STRING FOR BACKUP NAMING
            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 : [

//this example translates to: 
//tar -zcvf /path/to/archive.01.01.2001.1234.tar.gz -P /path/to/somedir --directory=/path/to/somedir --exclude=someotherdirname
        [
            //z:gzip, c:create archive, v:verbose, 
            //f:next argument is name of archive file 
            "-zcvf"

            //archive path
            ,"/path/to/archive.<%= tar_passthru.options.timestamp %>.tar.gz"

            //allow absolute path
            ,"-P"

            //Files or Directories to tar
            ,[
                '/path/to/somedir'
            ]

            //Sets present working directory, makes sure archive 
            //top level is same as target[s]
            ,"--directory=/path/to/somedir"

            //Excludes directory from archive
            ,"--exclude=someotherdirname"
         
        ]
    ]
  }
});

Keywords

FAQs

Last updated on 07 Mar 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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