nake v0.2.2
Welcome!
Nake is a Ruby Rake like tasks manager for
NodeJS
Usage Basics
Nake provides you with some options how you can hook it up. First of all you
can install Nake with npm
npm install nakeAnd after that create a Nakefile inside of your project
var Nake = require('nake');
Nake.task('taskname'[, 'description',] function() {
// the task code in here
});Then run nake command in the terminal
nake tasknameCall -h for the command line options
nake -hUsing Without NPM
If you don't have npm or want to use Nake as a standalone
library, then just call Nake.start() the following way
var Nake = require('nake');
Nake.task(...);
Nake.task(...);
Nake.start(); // <- kicking inAfter that just run your file with NodeJS
node ./myfileNamespaces
You also can create namespaces for tasks by using the Nake.namespace call
Nake.namespace('boo', function() {
Nake.task('task1', 'task1 description', function() {
// task 2 code
});
Nake.task('task2', 'task2 description', function() {
// task 2 code
})
});After that you'll have those tasks registered within the boo: namespace
nake boo:task1
nake boo:task2Default Task
To specify a default task that should be executed if the nake tool was
called without any options, specify the task name with the Nake.Default
attribute
Nake.Default = 'task_name';Invoking Other Tasks
You can invoke any tasks by name via the Nake.run call
Nake.run('taskname');
Nake.run('taskname', true); // <- quiet runOr you can save your tasks into local variables and run them directly
var task1 = Nake.task('name1', function() {});
var task2 = new Nake.Task('name2', function() {});
task1.run();
task2.run(true); // <- quiet runAdditionally you can run another task in the quiet mode but specify a step text
Nake.task('taskname', 'Doing something');
task.run('Doing something');In this case 'nake' will run the task in quiet mode but will print out specified text as a step in the log of the currently working task.
Logging The Steps
And you also can report the steps that your task is currently working on
Nake.task('task', 'Task Description', function() {
this.step('Doing something 1');
// ....
this.step('Doing something 2');
// ....
this.step('Doing something 3');
// ....
});This will result the following log in the console
== Task Description =======================================
- Doing something 1
- Doing something 2
- Doing something 3
DONELicense
This project is released under the terms of the MIT license.
Copyright (C) 2011 Nikolay Nemshilov