bodhi-scripts

Collection of scripts for everyday use. Run simple unit test, generate MAC address, object caching, logging or server files with a simple server.

    TODO
    cd bodhi-scripts
    ./run-tests.sh

Super simple cli arguments.

Supports flags like: -m -O2 --long --no-error Every detected flag is set true:

    var arguments = require('bodhi-args.js').initialize();
    arguments['m'] === true
    arguments['no-error'] === true

Supports parameters like: -x 123 --message "Hello World!" Every detected parameter is set to its value:

    var arguments = require('bodhi-args.js')
        .setValueFlag('x', '')
        .setValueFlag('message', '')
        .initialize();
    arguments['x'] === '123'
    arguments['message'] === 'Hello World!'

Unused arguments are added to the 'unbound' array.

Generate random MAC addresses.

There are four log levels as strings: 'debug', 'info', 'warning' and 'error'. For disabling logging use: 'none'

Usage

var logger = require('bodhi-logger.js');
var options = {
    filePath: '/tmp',           // where to save log files 
    filename: 'bodhi-logger',   // name of the log 
    fileSeparator: ';',
    fileExtension: 'log',       // file extension of the log file 
    fileLogLevel: 'warning',    // minumum log level for log files, use 'none' for no logging 
    fileColor: false,
 
    consoleSeparator: '\t',
    consoleLogLevel: 'debug',   // minimum log level for console 
    consoleTimestamp: true,     // enable time stamp for console logs 
    consoleColor: true         // enable colors in console log 
};
logger.init(options);
 
logger.logDebug('This is a debug message.');
logger.logInfo('This is some information.')
logger.logWarning('This is a warning message.')
logger.logError('This is really bad!');

Simple unit test framework.

Simple file server to instantly share folders.

Execute JSON remote procedure calls and implement JSON RPC services.