No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib expose 3 functions (), mkdir(), recurMkdir(). v0.9.0 Nov 14, 2013
tasks expose 3 functions (), mkdir(), recurMkdir(). v0.9.0 Nov 14, 2013
test
.gitignore first commit, v0.1.0 Nov 13, 2013
.travis.yml fix Nov 13, 2013
Gruntfile.js first commit, v0.1.0 Nov 13, 2013
LICENSE first commit, v0.1.0 Nov 13, 2013
README.md
package.json republish. v0.9.1 Nov 14, 2013

README.md

grunt-tree-prepare

Build status

Make directory trees.
Clean option can be provided. You can use this both as gruntjs plugin and as a library for nodejs.

Install

Install with npm:

npm install grunt-tree-prepare --save-dev

Usage

- as JavaScript library.

var emitter = require('grunt-tree-prepare')(tree, options)
emitter.on('error', ... ).on('end', ... );

- Use in your Gruntfile.js task with tree object.

module.exports = function(grunt) {
  // make directory tree below:
  // process.cwd()
  //  |- foo  -       <= create if not exist
  //  |       |- var  <= create if not exist
  //  |- hoge -       <= create if not exist
  //          |- fuga <= cleanup and create new
  grunt.config.set('tree-prepare', {
    tree: {
      'foo': ['var'],
      'hoge': { branch: 'fuga', clean: true }
    }
  });
  grunt.loadNpmTasks('grunt-tree-prepare');
  grunt.registerTask('default', ['tree-prepare']);
};

Configuration

  • options(Object)
    "clean"(Boolean) default: false
    Setup clean default for directory.
    (not truely/falsy)
    "autoDone"(Boolean) default: true
    Flag for task end signal auto call.
    If specified false, "tree-prepare.end" event leads "done" argument as an first argument to grunt.event. See test/basic.js.

  • tree(Object)
    "(Object key)(String)"
    Relative path from parent directory. Parent of tree is process.cwd().
    "branch"(Array|String)"
    Create directories with the same status included in the object that belongs.
    "chmod(Number|String)" default: 777 //TODO
    Set directory mode. String representation (e.g. "rw-rw-rw-" as 666) can be given.
    "clean(Boolean)" default: false | options.clean
    Crean up ( use rimraf ) directory contents and itself, create new.