0.2.0 • Published 12 years ago

grun v0.2.0

Weekly downloads
97
License
-
Repository
-
Last release
12 years ago

grunt-runner, grun

Support for executing grunt tasks.
This module is not required CLI.

Install

Install with npm:

    npm install grun

API - runs grunt tasks under "tasks" directory which is just below __dirname

    require('grun')(__dirname)

,or use alias

    require('grun').run(__dirname)

- example for running configuration

Default: package.json

    {
      "name": "grunt-runner-test",
      "version": "0.1.0",
      "taskList": ["run"],
      "configure": {
      }
    }

####before example for Gruntfile.js, attention that underscore is included. This object is extended for running tasks.
see: lib/task-utin.js

var _ = require('grunt-runner')._;

- example for Gruntfile.js

in this case deploy in "tasks/run" directory

module.exports = function(grunt) {
  grunt.registerTask('run', 'test for grunt-runner', function() {
          ...
  });
};

- if you want add tasks more easily, use utilities

var path = require('path'), fs = require('fs'), _ = require('grunt-runner')._;
var taskname = __dirname.split('/').pop(); // run

function gruntRunnerTest(grunt, conf, gtask) {

  var line = [], done = gtask.async(), stop = function(e) {
    grunt.fail.fatal(e);
  }, log = function(m) {
    _.util.log('[' + gtask.name + '] ' + m);
  };

  line.push(function() {
    log('done.'), done();
    grunt.runner.emit('end');
  });

  _.micropipe(line);

}