Added files
1
node_modules/forever/node_modules/.bin/flatiron
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../flatiron/bin/flatiron
|
||||
2
node_modules/forever/node_modules/cliff/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
19
node_modules/forever/node_modules/cliff/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010 Charlie Robbins & the Contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
227
node_modules/forever/node_modules/cliff/README.md
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
# cliff
|
||||
|
||||
CLI output formatting tools: "Your CLI Formatting Friend".
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing npm (node package manager)
|
||||
```
|
||||
curl http://npmjs.org/install.sh | sh
|
||||
```
|
||||
|
||||
### Installing cliff
|
||||
```
|
||||
[sudo] npm install cliff
|
||||
```
|
||||
|
||||
## Usage
|
||||
There are a number of methods available in Cliff for common logging tasks in command-line tools. If you're looking for more usage, checkout the [examples in this repository][3]:
|
||||
|
||||
1. Logging rows of data
|
||||
2. Inspecting Objects
|
||||
|
||||
### Logging rows of data
|
||||
|
||||
**cliff.stringifyRows(rows[, colors])**
|
||||
|
||||
Takes a set of Arrays and row headers and returns properly formatted and padded rows. Here's a sample:
|
||||
|
||||
``` js
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var rows = [
|
||||
['Name', 'Flavor', 'Dessert'],
|
||||
['Alice', 'cherry', 'yogurt'],
|
||||
['Bob', 'carmel', 'apples'],
|
||||
['Joe', 'chocolate', 'cake'],
|
||||
['Nick', 'vanilla', 'ice cream']
|
||||
];
|
||||
|
||||
console.log(cliff.stringifyRows(rows, ['red', 'blue', 'green']));
|
||||
```
|
||||
|
||||
![output from string-rows.js][string-rows]
|
||||
|
||||
**cliff.putRows(level, rows[, colors])**
|
||||
|
||||
The `putRows` method is a simple helper that takes a set of Arrays and row headers and logs properly formatted and padded rows (logs `stringifyRows` to [winston][0]). Here's a quick sample:
|
||||
|
||||
``` js
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var rows = [
|
||||
['Name', 'Flavor', 'Dessert'],
|
||||
['Alice', 'cherry', 'yogurt'],
|
||||
['Bob', 'carmel', 'apples'],
|
||||
['Joe', 'chocolate', 'cake'],
|
||||
['Nick', 'vanilla', 'ice cream']
|
||||
];
|
||||
|
||||
cliff.putRows('data', rows, ['red', 'blue', 'green']);
|
||||
```
|
||||
|
||||
The resulting output on the command-line would be:
|
||||
|
||||
![output from put-rows.js][put-rows]
|
||||
|
||||
**cliff.stringifyObjectRows(objs, properties[, colors])**
|
||||
*used to be: cliff.rowifyObjects(objs, properties, colors)*
|
||||
|
||||
Takes a set of Objects and the properties to extract from them and returns properly formatted and padded rows. Here's a sample:
|
||||
|
||||
``` js
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var objs = [], obj = {
|
||||
name: "bazz",
|
||||
address: "1234 Nowhere Dr.",
|
||||
};
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
objs.push({
|
||||
name: obj.name,
|
||||
address: obj.address,
|
||||
id: Math.random().toString()
|
||||
});
|
||||
}
|
||||
|
||||
console.log(cliff.stringifyObjectRows(objs, ['id', 'name', 'address'], ['red', 'blue', 'green']));
|
||||
```
|
||||
|
||||
![output from string-object-rows.js][string-object-rows]
|
||||
|
||||
**cliff.putObjectRows(level, objs, properties[, colors])**
|
||||
|
||||
Takes a set of Objects and the properties to extract from them and it will log to the console. (it prints `stringifyObjectRows` with [winston][0]). Here's a sample:
|
||||
|
||||
``` js
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var objs = [], obj = {
|
||||
name: "bazz",
|
||||
address: "1234 Nowhere Dr.",
|
||||
};
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
objs.push({
|
||||
name: obj.name,
|
||||
address: obj.address,
|
||||
id: Math.random().toString()
|
||||
});
|
||||
}
|
||||
|
||||
cliff.putObjectRows('data', objs, ['id', 'name', 'address']);
|
||||
```
|
||||
|
||||
![output from string-object-rows.js][string-object-rows]
|
||||
|
||||
**Colors Parameter**
|
||||
|
||||
The `colors` parameter is an array that colors the first row. It uses the [colors.js][2]. You can use any of those.
|
||||
|
||||
``` js
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var rows = [
|
||||
['Name', 'Flavor', 'Dessert'],
|
||||
['Alice'.grey, 'cherry'.cyan, 'yogurt'.yellow],
|
||||
['Bob'.magenta, 'carmel'.rainbow, 'apples'.white],
|
||||
['Joe'.italic, 'chocolate'.underline, 'cake'.inverse],
|
||||
['Nick'.bold, 'vanilla', 'ice cream']
|
||||
];
|
||||
|
||||
cliff.putRows('data', rows, ['red', 'blue', 'green']);
|
||||
```
|
||||
|
||||
The resulting output on the command-line would be:
|
||||
|
||||
![output from puts-rows-colors.js][put-rows-colors]
|
||||
|
||||
### Inspecting Objects
|
||||
|
||||
**cliff.inspect(obj)**
|
||||
|
||||
The `inspect` method is a lightweight wrapper to a pre-configured [eyes][1] inspector. If you wish to change the coloring of objects that are logged using `cliff` you only need to override `cliff.inspect` with a new [eyes][1] inspector. Here is how to use it:
|
||||
|
||||
``` js
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
console.log(cliff.inspect({
|
||||
literal: "bazz",
|
||||
arr: [
|
||||
"one",
|
||||
2,
|
||||
],
|
||||
obj: {
|
||||
host: "localhost",
|
||||
port: 5984,
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: "password"
|
||||
}
|
||||
}
|
||||
}));
|
||||
```
|
||||
|
||||
![output from inspect.js][inspect]
|
||||
|
||||
**cliff.putObject(obj, [rewriters, padding])**
|
||||
|
||||
The `putObject` method is a simple helper function for prefixing and styling inspected object output from [eyes][1]. Here's a quick sample:
|
||||
|
||||
``` js
|
||||
var cliff = require('cliff');
|
||||
|
||||
cliff.putObject({
|
||||
literal: "bazz",
|
||||
arr: [
|
||||
"one",
|
||||
2,
|
||||
],
|
||||
obj: {
|
||||
host: "localhost",
|
||||
port: 5984,
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: "password"
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
The resulting output on the command-line would be:
|
||||
|
||||
![output from put-object.js][put-object]
|
||||
|
||||
## Run Tests
|
||||
|
||||
All of the cliff tests are written in [vows][4], and cover all of the use cases described above.
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
||||
## Motivation
|
||||
|
||||
Cliff is the swiss army knife of CLI formatting tools. It is based on highly flexible and powerful libraries:
|
||||
|
||||
* [winston][0]: A multi-transport async logging library for node.js
|
||||
* [eyes][1]: A customizable value inspector for node.js
|
||||
* [colors][2]: Get colors in your node.js console like what
|
||||
|
||||
|
||||
#### Author: [Charlie Robbins](http://twitter.com/indexzero)
|
||||
|
||||
[0]: http://github.com/indexzero/winston
|
||||
[1]: http://github.com/cloudhead/eyes.js
|
||||
[2]: http://github.com/marak/colors.js
|
||||
[3]: http://github.com/flatiron/cliff/tree/master/examples
|
||||
[4]: http://vowsjs.org
|
||||
|
||||
[inspect]: https://github.com/flatiron/cliff/raw/master/assets/inspect.png
|
||||
[put-object-rows]: https://github.com/flatiron/cliff/raw/master/assets/put-object-rows.png
|
||||
[put-object]: https://github.com/flatiron/cliff/raw/master/assets/put-object.png
|
||||
[put-rows-colors]: https://github.com/flatiron/cliff/raw/master/assets/put-rows-colors.png
|
||||
[put-rows]: https://github.com/flatiron/cliff/raw/master/assets/put-rows.png
|
||||
[string-object-rows]: https://github.com/flatiron/cliff/raw/master/assets/string-object-rows.png
|
||||
[string-rows]: https://github.com/flatiron/cliff/raw/master/assets/string-rows.png
|
||||
BIN
node_modules/forever/node_modules/cliff/assets/inspect.png
generated
vendored
Executable file
|
After Width: | Height: | Size: 27 KiB |
BIN
node_modules/forever/node_modules/cliff/assets/put-object-rows.png
generated
vendored
Executable file
|
After Width: | Height: | Size: 54 KiB |
BIN
node_modules/forever/node_modules/cliff/assets/put-object.png
generated
vendored
Executable file
|
After Width: | Height: | Size: 32 KiB |
BIN
node_modules/forever/node_modules/cliff/assets/put-rows-colors.png
generated
vendored
Executable file
|
After Width: | Height: | Size: 23 KiB |
BIN
node_modules/forever/node_modules/cliff/assets/put-rows.png
generated
vendored
Executable file
|
After Width: | Height: | Size: 21 KiB |
BIN
node_modules/forever/node_modules/cliff/assets/string-object-rows.png
generated
vendored
Executable file
|
After Width: | Height: | Size: 52 KiB |
BIN
node_modules/forever/node_modules/cliff/assets/string-rows.png
generated
vendored
Executable file
|
After Width: | Height: | Size: 20 KiB |
24
node_modules/forever/node_modules/cliff/examples/inspect.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* put-object.js: Example usage for `cliff.putObject`.
|
||||
*
|
||||
* (C) 2010, Charlie Robbins & the Contributors
|
||||
*
|
||||
*/
|
||||
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
console.log(cliff.inspect({
|
||||
literal: "bazz",
|
||||
arr: [
|
||||
"one",
|
||||
2,
|
||||
],
|
||||
obj: {
|
||||
host: "localhost",
|
||||
port: 5984,
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: "password"
|
||||
}
|
||||
}
|
||||
}));
|
||||
23
node_modules/forever/node_modules/cliff/examples/put-object-rows.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* put-object-rows.js: Example usage for `cliff.putObjectRows`.
|
||||
*
|
||||
* (C) 2010, Charlie Robbins & the Contributors
|
||||
*
|
||||
*/
|
||||
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var objs = [], obj = {
|
||||
name: "bazz",
|
||||
address: "1234 Nowhere Dr.",
|
||||
};
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
objs.push({
|
||||
name: obj.name,
|
||||
address: obj.address,
|
||||
id: Math.random().toString()
|
||||
});
|
||||
}
|
||||
|
||||
cliff.putObjectRows('data', objs, ['id', 'name', 'address']);
|
||||
24
node_modules/forever/node_modules/cliff/examples/put-object.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* put-object.js: Example usage for `cliff.putObject`.
|
||||
*
|
||||
* (C) 2010, Charlie Robbins & the Contributors
|
||||
*
|
||||
*/
|
||||
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
cliff.putObject({
|
||||
literal: "bazz",
|
||||
arr: [
|
||||
"one",
|
||||
2,
|
||||
],
|
||||
obj: {
|
||||
host: "localhost",
|
||||
port: 5984,
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: "password"
|
||||
}
|
||||
}
|
||||
});
|
||||
12
node_modules/forever/node_modules/cliff/examples/put-rows-colors.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var rows = [
|
||||
['Name', 'Flavor', 'Dessert'],
|
||||
['Alice'.grey, 'cherry'.cyan, 'yogurt'.yellow],
|
||||
['Bob'.magenta, 'carmel'.rainbow, 'apples'.white],
|
||||
['Joe'.italic, 'chocolate'.underline, 'cake'.inverse],
|
||||
['Nick'.bold, 'vanilla', 'ice cream']
|
||||
];
|
||||
|
||||
cliff.putRows('data', rows, ['red', 'blue', 'green']);
|
||||
|
||||
11
node_modules/forever/node_modules/cliff/examples/put-rows.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var rows = [
|
||||
['Name', 'Flavor', 'Dessert'],
|
||||
['Alice', 'cherry', 'yogurt'],
|
||||
['Bob', 'carmel', 'apples'],
|
||||
['Joe', 'chocolate', 'cake'],
|
||||
['Nick', 'vanilla', 'ice cream']
|
||||
];
|
||||
|
||||
cliff.putRows('data', rows, ['red', 'blue', 'green']);
|
||||
23
node_modules/forever/node_modules/cliff/examples/string-object-rows.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* put-object-rows.js: Example usage for `cliff.putObjectRows`.
|
||||
*
|
||||
* (C) 2010, Charlie Robbins & the Contributors
|
||||
*
|
||||
*/
|
||||
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var objs = [], obj = {
|
||||
name: "bazz",
|
||||
address: "1234 Nowhere Dr.",
|
||||
};
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
objs.push({
|
||||
name: obj.name,
|
||||
address: obj.address,
|
||||
id: Math.random().toString()
|
||||
});
|
||||
}
|
||||
|
||||
console.log(cliff.stringifyObjectRows(objs, ['id', 'name', 'address'], ['red', 'blue', 'green']));
|
||||
11
node_modules/forever/node_modules/cliff/examples/string-rows.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var cliff = require('../lib/cliff');
|
||||
|
||||
var rows = [
|
||||
['Name', 'Flavor', 'Dessert'],
|
||||
['Alice', 'cherry', 'yogurt'],
|
||||
['Bob', 'carmel', 'apples'],
|
||||
['Joe', 'chocolate', 'cake'],
|
||||
['Nick', 'vanilla', 'ice cream']
|
||||
];
|
||||
|
||||
console.log(cliff.stringifyRows(rows, ['red', 'blue', 'green']));
|
||||
287
node_modules/forever/node_modules/cliff/lib/cliff.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* cliff.js: CLI output formatting tools: "Your CLI Formatting Friend".
|
||||
*
|
||||
* (C) 2010, Charlie Robbins & the Contributors
|
||||
*
|
||||
*/
|
||||
|
||||
var colors = require('colors'),
|
||||
eyes = require('eyes'),
|
||||
winston = require('winston');
|
||||
|
||||
var cliff = exports,
|
||||
logger;
|
||||
|
||||
cliff.__defineGetter__('logger', function () {
|
||||
delete cliff.logger;
|
||||
return cliff.logger = logger;
|
||||
});
|
||||
|
||||
cliff.__defineSetter__('logger', function (val) {
|
||||
logger = val;
|
||||
|
||||
//
|
||||
// Setup winston to use the `cli` formats
|
||||
//
|
||||
if (logger.cli) {
|
||||
logger.cli();
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
// Set the default logger for cliff.
|
||||
//
|
||||
cliff.logger = new winston.Logger({
|
||||
transports: [new winston.transports.Console()]
|
||||
});
|
||||
|
||||
//
|
||||
// Expose a default `eyes` inspector.
|
||||
//
|
||||
cliff.inspector = eyes.inspector;
|
||||
cliff.inspect = eyes.inspector({ stream: null,
|
||||
styles: { // Styles applied to stdout
|
||||
all: null, // Overall style applied to everything
|
||||
label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`
|
||||
other: 'inverted', // Objects which don't have a literal representation, such as functions
|
||||
key: 'grey', // The keys in object literals, like 'a' in `{a: 1}`
|
||||
special: 'grey', // null, undefined...
|
||||
number: 'blue', // 0, 1, 2...
|
||||
bool: 'magenta', // true false
|
||||
regexp: 'green' // /\d+/
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
// ### function extractFrom (obj, properties)
|
||||
// #### @obj {Object} Object to extract properties from.
|
||||
// #### @properties {Array} List of properties to output.
|
||||
// Creates an array representing the values for `properties` in `obj`.
|
||||
//
|
||||
cliff.extractFrom = function (obj, properties) {
|
||||
return properties.map(function (p) {
|
||||
return obj[p];
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// ### function columnMajor (rows)
|
||||
// #### @rows {ArrayxArray} Row-major Matrix to transpose
|
||||
// Transposes the row-major Matrix, represented as an array of rows,
|
||||
// into column major form (i.e. an array of columns).
|
||||
//
|
||||
cliff.columnMajor = function (rows) {
|
||||
var columns = [];
|
||||
|
||||
rows.forEach(function (row) {
|
||||
for (var i = 0; i < row.length; i += 1) {
|
||||
if (!columns[i]) {
|
||||
columns[i] = [];
|
||||
}
|
||||
|
||||
columns[i].push(row[i]);
|
||||
}
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
//
|
||||
// ### arrayLengths (arrs)
|
||||
// #### @arrs {ArrayxArray} Arrays to calculate lengths for
|
||||
// Creates an array with values each representing the length
|
||||
// of an array in the set provided.
|
||||
//
|
||||
cliff.arrayLengths = function (arrs) {
|
||||
var i, lengths = [];
|
||||
for (i = 0; i < arrs.length; i += 1) {
|
||||
lengths.push(longestElement(arrs[i].map(cliff.stringifyLiteral)));
|
||||
}
|
||||
return lengths;
|
||||
};
|
||||
|
||||
//
|
||||
// ### function stringifyRows (rows, colors)
|
||||
// #### @rows {ArrayxArray} Matrix of properties to output in row major form
|
||||
// #### @colors {Array} Set of colors to use for the headers
|
||||
// Outputs the specified `rows` as fixed-width columns, adding
|
||||
// colorized headers if `colors` are supplied.
|
||||
//
|
||||
cliff.stringifyRows = function (rows, colors, options) {
|
||||
var lengths, columns, output = [], headers;
|
||||
|
||||
options = options || {};
|
||||
options.columnSpacing = options.columnSpacing || 2;
|
||||
|
||||
columns = cliff.columnMajor(rows);
|
||||
lengths = cliff.arrayLengths(columns);
|
||||
|
||||
function stringifyRow(row, colorize) {
|
||||
var rowtext = '', padding, item, i, length;
|
||||
for (i = 0; i < row.length; i += 1) {
|
||||
item = cliff.stringifyLiteral(row[i]);
|
||||
|
||||
if(colorize) {
|
||||
item = item[colors[i]] || item[colors[colors.length -1]] || item;
|
||||
}
|
||||
|
||||
length = realLength(item);
|
||||
padding = length < lengths[i] ? lengths[i] - length + options.columnSpacing : options.columnSpacing ;
|
||||
rowtext += item + new Array(padding).join(' ');
|
||||
}
|
||||
|
||||
output.push(rowtext);
|
||||
}
|
||||
|
||||
// If we were passed colors, then assume the first row
|
||||
// is the headers for the rows
|
||||
if (colors) {
|
||||
headers = rows.splice(0, 1)[0];
|
||||
stringifyRow(headers, true);
|
||||
}
|
||||
|
||||
rows.forEach(function (row) {
|
||||
stringifyRow(row, false);
|
||||
});
|
||||
|
||||
return output.join('\n');
|
||||
};
|
||||
|
||||
//
|
||||
// ### function rowifyObjects (objs, properties, colors)
|
||||
// #### @objs {Array} List of objects to create output for
|
||||
// #### @properties {Array} List of properties to output
|
||||
// #### @colors {Array} Set of colors to use for the headers
|
||||
// Extracts the lists of `properties` from the specified `objs`
|
||||
// and formats them according to `cliff.stringifyRows`.
|
||||
//
|
||||
cliff.stringifyObjectRows = cliff.rowifyObjects = function (objs, properties, colors, options) {
|
||||
var rows = [properties].concat(objs.map(function (obj) {
|
||||
return cliff.extractFrom(obj, properties);
|
||||
}));
|
||||
|
||||
return cliff.stringifyRows(rows, colors, options);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function putRows (level, rows, colors)
|
||||
// #### @level {String} Log-level to use
|
||||
// #### @rows {Array} Array of rows to log at the specified level
|
||||
// #### @colors {Array} Set of colors to use for the specified row(s) headers.
|
||||
// Logs the stringified table result from `rows` at the appropriate `level` using
|
||||
// `cliff.logger`. If `colors` are supplied then use those when stringifying `rows`.
|
||||
//
|
||||
cliff.putRows = function (level, rows, colors) {
|
||||
cliff.stringifyRows(rows, colors).split('\n').forEach(function (str) {
|
||||
logger.log(level, str);
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// ### function putObjectRows (level, rows, colors)
|
||||
// #### @level {String} Log-level to use
|
||||
// #### @objs {Array} List of objects to create output for
|
||||
// #### @properties {Array} List of properties to output
|
||||
// #### @colors {Array} Set of colors to use for the headers
|
||||
// Logs the stringified table result from `objs` at the appropriate `level` using
|
||||
// `cliff.logger`. If `colors` are supplied then use those when stringifying `objs`.
|
||||
//
|
||||
cliff.putObjectRows = function (level, objs, properties, colors) {
|
||||
cliff.rowifyObjects(objs, properties, colors).split('\n').forEach(function (str) {
|
||||
logger.log(level, str);
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// ### function putObject (obj, [rewriters, padding])
|
||||
// #### @obj {Object} Object to log to the command line
|
||||
// #### @rewriters {Object} **Optional** Set of methods to rewrite certain object keys
|
||||
// #### @padding {Number} **Optional** Length of padding to put around the output.
|
||||
// Inspects the object `obj` on the command line rewriting any properties which match
|
||||
// keys in `rewriters` if any. Adds additional `padding` if supplied.
|
||||
//
|
||||
cliff.putObject = function (/*obj, [rewriters, padding] */) {
|
||||
var args = Array.prototype.slice.call(arguments),
|
||||
obj = args.shift(),
|
||||
padding = typeof args[args.length - 1] === 'number' && args.pop(),
|
||||
rewriters = typeof args[args.length -1] === 'object' && args.pop(),
|
||||
keys = Object.keys(obj).sort(),
|
||||
sorted = {},
|
||||
matchers = {},
|
||||
inspected;
|
||||
|
||||
padding = padding || 0;
|
||||
rewriters = rewriters || {};
|
||||
|
||||
function pad () {
|
||||
for (var i = 0; i < padding / 2; i++) {
|
||||
logger.data('');
|
||||
}
|
||||
}
|
||||
|
||||
keys.forEach(function (key) {
|
||||
sorted[key] = obj[key];
|
||||
});
|
||||
|
||||
inspected = cliff.inspect(sorted);
|
||||
|
||||
Object.keys(rewriters).forEach(function (key) {
|
||||
matchers[key] = new RegExp(key);
|
||||
});
|
||||
|
||||
pad();
|
||||
inspected.split('\n').forEach(function (line) {
|
||||
Object.keys(rewriters).forEach(function (key) {
|
||||
if (matchers[key].test(line)) {
|
||||
line = rewriters[key](line);
|
||||
}
|
||||
});
|
||||
logger.data(line);
|
||||
});
|
||||
pad();
|
||||
};
|
||||
|
||||
cliff.stringifyLiteral = function stringifyLiteral (literal) {
|
||||
switch (cliff.typeOf(literal)) {
|
||||
case 'number' : return literal + '';
|
||||
case 'null' : return 'null';
|
||||
case 'undefined': return 'undefined';
|
||||
case 'boolean' : return literal + '';
|
||||
default : return literal;
|
||||
}
|
||||
};
|
||||
|
||||
cliff.typeOf = function typeOf(value) {
|
||||
var s = typeof(value),
|
||||
types = [Object, Array, String, RegExp, Number, Function, Boolean, Date];
|
||||
|
||||
if (s === 'object' || s === 'function') {
|
||||
if (value) {
|
||||
types.forEach(function (t) {
|
||||
if (value instanceof t) {
|
||||
s = t.name.toLowerCase();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
s = 'null';
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
};
|
||||
|
||||
function realLength(str) {
|
||||
return ("" + str).replace(/\u001b\[\d+m/g,'').length;
|
||||
}
|
||||
|
||||
function longestElement(a) {
|
||||
var l = 0;
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
var new_l = realLength(a[i]);
|
||||
if (l < new_l) {
|
||||
l = new_l;
|
||||
}
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
6
node_modules/forever/node_modules/cliff/node_modules/colors/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
23
node_modules/forever/node_modules/cliff/node_modules/colors/MIT-LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional Functionality
|
||||
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
167
node_modules/forever/node_modules/cliff/node_modules/colors/ReadMe.md
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
# colors.js
|
||||
|
||||
## get color and style in your node.js console
|
||||
|
||||
<img src="https://github.com/Marak/colors.js/raw/master/screenshots/colors.png"/>
|
||||
|
||||
## Installation
|
||||
|
||||
npm install colors
|
||||
|
||||
## colors and styles!
|
||||
|
||||
### text colors
|
||||
|
||||
- black
|
||||
- red
|
||||
- green
|
||||
- yellow
|
||||
- blue
|
||||
- magenta
|
||||
- cyan
|
||||
- white
|
||||
- gray
|
||||
- grey
|
||||
|
||||
### background colors
|
||||
|
||||
|
||||
|
||||
- bgBlack
|
||||
- bgRed
|
||||
- bgGreen
|
||||
- bgYellow
|
||||
- bgBlue
|
||||
- bgMagenta
|
||||
- bgCyan
|
||||
- bgWhite
|
||||
|
||||
### styles
|
||||
|
||||
- reset
|
||||
- bold
|
||||
- dim
|
||||
- italic
|
||||
- underline
|
||||
- inverse
|
||||
- hidden
|
||||
- strikethrough
|
||||
|
||||
### extras
|
||||
|
||||
- rainbow
|
||||
- zebra
|
||||
- america
|
||||
- trap
|
||||
- random
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
By popular demand, `colors` now ships with two types of usages!
|
||||
|
||||
The super nifty way
|
||||
|
||||
```js
|
||||
var colors = require('colors');
|
||||
|
||||
console.log('hello'.green); // outputs green text
|
||||
console.log('i like cake and pies'.underline.red) // outputs red underlined text
|
||||
console.log('inverse the color'.inverse); // inverses the color
|
||||
console.log('OMG Rainbows!'.rainbow); // rainbow
|
||||
console.log('Run the trap'.trap); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
or a slightly less nifty way which doesn't extend `String.prototype`
|
||||
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
console.log(colors.green('hello')); // outputs green text
|
||||
console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
|
||||
console.log(colors.inverse('inverse the color')); // inverses the color
|
||||
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
||||
console.log(colors.trap('Run the trap')); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
||||
|
||||
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
|
||||
|
||||
## Disabling Colors
|
||||
|
||||
To disable colors you can pass the following arguments in the command line to your application:
|
||||
|
||||
```bash
|
||||
node myapp.js --no-color
|
||||
```
|
||||
|
||||
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
||||
|
||||
```js
|
||||
var name = 'Marak';
|
||||
console.log(colors.green('Hello %s'), name);
|
||||
// outputs -> 'Hello Marak'
|
||||
```
|
||||
|
||||
## Custom themes
|
||||
|
||||
### Using standard API
|
||||
|
||||
```js
|
||||
|
||||
var colors = require('colors');
|
||||
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
```
|
||||
|
||||
### Using string safe API
|
||||
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
// set single property
|
||||
var error = colors.red;
|
||||
error('this is red');
|
||||
|
||||
// set theme
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
```
|
||||
|
||||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
||||
74
node_modules/forever/node_modules/cliff/node_modules/colors/examples/normal-usage.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
var colors = require('../lib/index');
|
||||
|
||||
console.log("First some yellow text".yellow);
|
||||
|
||||
console.log("Underline that text".yellow.underline);
|
||||
|
||||
console.log("Make it bold and red".red.bold);
|
||||
|
||||
console.log(("Double Raindows All Day Long").rainbow)
|
||||
|
||||
console.log("Drop the bass".trap)
|
||||
|
||||
console.log("DROP THE RAINBOW BASS".trap.rainbow)
|
||||
|
||||
|
||||
console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||
|
||||
console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse + ' styles! '.yellow.bold); // styles not widely supported
|
||||
console.log("Zebras are so fun!".zebra);
|
||||
|
||||
//
|
||||
// Remark: .strikethrough may not work with Mac OS Terminal App
|
||||
//
|
||||
console.log("This is " + "not".strikethrough + " fun.");
|
||||
|
||||
console.log('Background color attack!'.black.bgWhite)
|
||||
console.log('Use random styles on everything!'.random)
|
||||
console.log('America, Heck Yeah!'.america)
|
||||
|
||||
|
||||
console.log('Setting themes is useful')
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme(__dirname + '/../themes/generic-logging.js');
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
//console.log("Don't summon".zalgo)
|
||||
76
node_modules/forever/node_modules/cliff/node_modules/colors/examples/safe-string.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
var colors = require('../safe');
|
||||
|
||||
console.log(colors.yellow("First some yellow text"));
|
||||
|
||||
console.log(colors.yellow.underline("Underline that text"));
|
||||
|
||||
console.log(colors.red.bold("Make it bold and red"));
|
||||
|
||||
console.log(colors.rainbow("Double Raindows All Day Long"))
|
||||
|
||||
console.log(colors.trap("Drop the bass"))
|
||||
|
||||
console.log(colors.rainbow(colors.trap("DROP THE RAINBOW BASS")));
|
||||
|
||||
console.log(colors.bold.italic.underline.red('Chains are also cool.')); // styles not widely supported
|
||||
|
||||
|
||||
console.log(colors.green('So ') + colors.underline('are') + ' ' + colors.inverse('inverse') + colors.yellow.bold(' styles! ')); // styles not widely supported
|
||||
|
||||
console.log(colors.zebra("Zebras are so fun!"));
|
||||
|
||||
console.log("This is " + colors.strikethrough("not") + " fun.");
|
||||
|
||||
|
||||
console.log(colors.black.bgWhite('Background color attack!'));
|
||||
console.log(colors.random('Use random styles on everything!'))
|
||||
console.log(colors.america('America, Heck Yeah!'));
|
||||
|
||||
console.log('Setting themes is useful')
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
//console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
// outputs grey text
|
||||
console.log(colors.input("this is an input"));
|
||||
|
||||
|
||||
// console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme(__dirname + '/../themes/generic-logging.js');
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
// outputs grey text
|
||||
console.log(colors.input("this is an input"));
|
||||
|
||||
// console.log(colors.zalgo("Don't summon him"))
|
||||
|
||||
|
||||
|
||||
176
node_modules/forever/node_modules/cliff/node_modules/colors/lib/colors.js
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional functionality
|
||||
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var colors = {};
|
||||
module['exports'] = colors;
|
||||
|
||||
colors.themes = {};
|
||||
|
||||
var ansiStyles = colors.styles = require('./styles');
|
||||
var defineProps = Object.defineProperties;
|
||||
|
||||
colors.supportsColor = require('./system/supports-colors');
|
||||
|
||||
if (typeof colors.enabled === "undefined") {
|
||||
colors.enabled = colors.supportsColor;
|
||||
}
|
||||
|
||||
colors.stripColors = colors.strip = function(str){
|
||||
return ("" + str).replace(/\x1B\[\d+m/g, '');
|
||||
};
|
||||
|
||||
|
||||
var stylize = colors.stylize = function stylize (str, style) {
|
||||
return ansiStyles[style].open + str + ansiStyles[style].close;
|
||||
}
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
var escapeStringRegexp = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
}
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function builder() {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
builder._styles = _styles;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
builder.__proto__ = proto;
|
||||
return builder;
|
||||
}
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
ansiStyles.grey = ansiStyles.gray;
|
||||
Object.keys(ansiStyles).forEach(function (key) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
return build(this._styles.concat(key));
|
||||
}
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function colors() {}, styles);
|
||||
|
||||
function applyStyle() {
|
||||
var args = arguments;
|
||||
var argsLen = args.length;
|
||||
var str = argsLen !== 0 && String(arguments[0]);
|
||||
if (argsLen > 1) {
|
||||
for (var a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!colors.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var nestedStyles = this._styles;
|
||||
|
||||
var i = nestedStyles.length;
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function applyTheme (theme) {
|
||||
for (var style in theme) {
|
||||
(function(style){
|
||||
colors[style] = function(str){
|
||||
return colors[theme[style]](str);
|
||||
};
|
||||
})(style)
|
||||
}
|
||||
}
|
||||
|
||||
colors.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
colors.themes[theme] = require(theme);
|
||||
applyTheme(colors.themes[theme]);
|
||||
return colors.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
Object.keys(styles).forEach(function (name) {
|
||||
ret[name] = {
|
||||
get: function () {
|
||||
return build([name]);
|
||||
}
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
var sequencer = function sequencer (map, str) {
|
||||
var exploded = str.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
};
|
||||
|
||||
// custom formatter methods
|
||||
colors.trap = require('./custom/trap');
|
||||
colors.zalgo = require('./custom/zalgo');
|
||||
|
||||
// maps
|
||||
colors.maps = {};
|
||||
colors.maps.america = require('./maps/america');
|
||||
colors.maps.zebra = require('./maps/zebra');
|
||||
colors.maps.rainbow = require('./maps/rainbow');
|
||||
colors.maps.random = require('./maps/random')
|
||||
|
||||
for (var map in colors.maps) {
|
||||
(function(map){
|
||||
colors[map] = function (str) {
|
||||
return sequencer(colors.maps[map], str);
|
||||
}
|
||||
})(map)
|
||||
}
|
||||
|
||||
defineProps(colors, init());
|
||||
45
node_modules/forever/node_modules/cliff/node_modules/colors/lib/custom/trap.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
module['exports'] = function runTheTrap (text, options) {
|
||||
var result = "";
|
||||
text = text || "Run the trap, drop the bass";
|
||||
text = text.split('');
|
||||
var trap = {
|
||||
a: ["\u0040", "\u0104", "\u023a", "\u0245", "\u0394", "\u039b", "\u0414"],
|
||||
b: ["\u00df", "\u0181", "\u0243", "\u026e", "\u03b2", "\u0e3f"],
|
||||
c: ["\u00a9", "\u023b", "\u03fe"],
|
||||
d: ["\u00d0", "\u018a", "\u0500" , "\u0501" ,"\u0502", "\u0503"],
|
||||
e: ["\u00cb", "\u0115", "\u018e", "\u0258", "\u03a3", "\u03be", "\u04bc", "\u0a6c"],
|
||||
f: ["\u04fa"],
|
||||
g: ["\u0262"],
|
||||
h: ["\u0126", "\u0195", "\u04a2", "\u04ba", "\u04c7", "\u050a"],
|
||||
i: ["\u0f0f"],
|
||||
j: ["\u0134"],
|
||||
k: ["\u0138", "\u04a0", "\u04c3", "\u051e"],
|
||||
l: ["\u0139"],
|
||||
m: ["\u028d", "\u04cd", "\u04ce", "\u0520", "\u0521", "\u0d69"],
|
||||
n: ["\u00d1", "\u014b", "\u019d", "\u0376", "\u03a0", "\u048a"],
|
||||
o: ["\u00d8", "\u00f5", "\u00f8", "\u01fe", "\u0298", "\u047a", "\u05dd", "\u06dd", "\u0e4f"],
|
||||
p: ["\u01f7", "\u048e"],
|
||||
q: ["\u09cd"],
|
||||
r: ["\u00ae", "\u01a6", "\u0210", "\u024c", "\u0280", "\u042f"],
|
||||
s: ["\u00a7", "\u03de", "\u03df", "\u03e8"],
|
||||
t: ["\u0141", "\u0166", "\u0373"],
|
||||
u: ["\u01b1", "\u054d"],
|
||||
v: ["\u05d8"],
|
||||
w: ["\u0428", "\u0460", "\u047c", "\u0d70"],
|
||||
x: ["\u04b2", "\u04fe", "\u04fc", "\u04fd"],
|
||||
y: ["\u00a5", "\u04b0", "\u04cb"],
|
||||
z: ["\u01b5", "\u0240"]
|
||||
}
|
||||
text.forEach(function(c){
|
||||
c = c.toLowerCase();
|
||||
var chars = trap[c] || [" "];
|
||||
var rand = Math.floor(Math.random() * chars.length);
|
||||
if (typeof trap[c] !== "undefined") {
|
||||
result += trap[c][rand];
|
||||
} else {
|
||||
result += c;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
104
node_modules/forever/node_modules/cliff/node_modules/colors/lib/custom/zalgo.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// please no
|
||||
module['exports'] = function zalgo(text, options) {
|
||||
text = text || " he is here ";
|
||||
var soul = {
|
||||
"up" : [
|
||||
'̍', '̎', '̄', '̅',
|
||||
'̿', '̑', '̆', '̐',
|
||||
'͒', '͗', '͑', '̇',
|
||||
'̈', '̊', '͂', '̓',
|
||||
'̈', '͊', '͋', '͌',
|
||||
'̃', '̂', '̌', '͐',
|
||||
'̀', '́', '̋', '̏',
|
||||
'̒', '̓', '̔', '̽',
|
||||
'̉', 'ͣ', 'ͤ', 'ͥ',
|
||||
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
||||
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
||||
'ͮ', 'ͯ', '̾', '͛',
|
||||
'͆', '̚'
|
||||
],
|
||||
"down" : [
|
||||
'̖', '̗', '̘', '̙',
|
||||
'̜', '̝', '̞', '̟',
|
||||
'̠', '̤', '̥', '̦',
|
||||
'̩', '̪', '̫', '̬',
|
||||
'̭', '̮', '̯', '̰',
|
||||
'̱', '̲', '̳', '̹',
|
||||
'̺', '̻', '̼', 'ͅ',
|
||||
'͇', '͈', '͉', '͍',
|
||||
'͎', '͓', '͔', '͕',
|
||||
'͖', '͙', '͚', '̣'
|
||||
],
|
||||
"mid" : [
|
||||
'̕', '̛', '̀', '́',
|
||||
'͘', '̡', '̢', '̧',
|
||||
'̨', '̴', '̵', '̶',
|
||||
'͜', '͝', '͞',
|
||||
'͟', '͠', '͢', '̸',
|
||||
'̷', '͡', ' ҉'
|
||||
]
|
||||
},
|
||||
all = [].concat(soul.up, soul.down, soul.mid),
|
||||
zalgo = {};
|
||||
|
||||
function randomNumber(range) {
|
||||
var r = Math.floor(Math.random() * range);
|
||||
return r;
|
||||
}
|
||||
|
||||
function is_char(character) {
|
||||
var bool = false;
|
||||
all.filter(function (i) {
|
||||
bool = (i === character);
|
||||
});
|
||||
return bool;
|
||||
}
|
||||
|
||||
|
||||
function heComes(text, options) {
|
||||
var result = '', counts, l;
|
||||
options = options || {};
|
||||
options["up"] = options["up"] || true;
|
||||
options["mid"] = options["mid"] || true;
|
||||
options["down"] = options["down"] || true;
|
||||
options["size"] = options["size"] || "maxi";
|
||||
text = text.split('');
|
||||
for (l in text) {
|
||||
if (is_char(l)) {
|
||||
continue;
|
||||
}
|
||||
result = result + text[l];
|
||||
counts = {"up" : 0, "down" : 0, "mid" : 0};
|
||||
switch (options.size) {
|
||||
case 'mini':
|
||||
counts.up = randomNumber(8);
|
||||
counts.min = randomNumber(2);
|
||||
counts.down = randomNumber(8);
|
||||
break;
|
||||
case 'maxi':
|
||||
counts.up = randomNumber(16) + 3;
|
||||
counts.min = randomNumber(4) + 1;
|
||||
counts.down = randomNumber(64) + 3;
|
||||
break;
|
||||
default:
|
||||
counts.up = randomNumber(8) + 1;
|
||||
counts.mid = randomNumber(6) / 2;
|
||||
counts.down = randomNumber(8) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
var arr = ["up", "mid", "down"];
|
||||
for (var d in arr) {
|
||||
var index = arr[d];
|
||||
for (var i = 0 ; i <= counts[index]; i++) {
|
||||
if (options[index]) {
|
||||
result = result + soul[index][randomNumber(soul[index].length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// don't summon him
|
||||
return heComes(text);
|
||||
}
|
||||
118
node_modules/forever/node_modules/cliff/node_modules/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
var colors = require('./colors'),
|
||||
styles = require('./styles');
|
||||
|
||||
module['exports'] = function () {
|
||||
|
||||
//
|
||||
// Extends prototype of native string object to allow for "foo".red syntax
|
||||
//
|
||||
var addProperty = function (color, func) {
|
||||
String.prototype.__defineGetter__(color, func);
|
||||
};
|
||||
|
||||
var sequencer = function sequencer (map, str) {
|
||||
return function () {
|
||||
var exploded = this.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
}
|
||||
};
|
||||
|
||||
var stylize = function stylize (str, style) {
|
||||
return styles[style].open + str + styles[style].close;
|
||||
}
|
||||
|
||||
addProperty('strip', function () {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty('stripColors', function () {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty("trap", function(){
|
||||
return colors.trap(this);
|
||||
});
|
||||
|
||||
addProperty("zalgo", function(){
|
||||
return colors.zalgo(this);
|
||||
});
|
||||
|
||||
addProperty("zebra", function(){
|
||||
return colors.zebra(this);
|
||||
});
|
||||
|
||||
addProperty("rainbow", function(){
|
||||
return colors.rainbow(this);
|
||||
});
|
||||
|
||||
addProperty("random", function(){
|
||||
return colors.random(this);
|
||||
});
|
||||
|
||||
addProperty("america", function(){
|
||||
return colors.america(this);
|
||||
});
|
||||
|
||||
//
|
||||
// Iterate through all default styles and colors
|
||||
//
|
||||
var x = Object.keys(colors.styles);
|
||||
x.forEach(function (style) {
|
||||
addProperty(style, function () {
|
||||
return stylize(this, style);
|
||||
});
|
||||
});
|
||||
|
||||
function applyTheme(theme) {
|
||||
//
|
||||
// Remark: This is a list of methods that exist
|
||||
// on String that you should not overwrite.
|
||||
//
|
||||
var stringPrototypeBlacklist = [
|
||||
'__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
|
||||
'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
|
||||
'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
|
||||
'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight'
|
||||
];
|
||||
|
||||
Object.keys(theme).forEach(function (prop) {
|
||||
if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
||||
console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name');
|
||||
}
|
||||
else {
|
||||
if (typeof(theme[prop]) === 'string') {
|
||||
colors[prop] = colors[theme[prop]];
|
||||
addProperty(prop, function () {
|
||||
return colors[theme[prop]](this);
|
||||
});
|
||||
}
|
||||
else {
|
||||
addProperty(prop, function () {
|
||||
var ret = this;
|
||||
for (var t = 0; t < theme[prop].length; t++) {
|
||||
ret = exports[theme[prop][t]](ret);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
colors.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
colors.themes[theme] = require(theme);
|
||||
applyTheme(colors.themes[theme]);
|
||||
return colors.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
12
node_modules/forever/node_modules/cliff/node_modules/colors/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var colors = require('./colors');
|
||||
module['exports'] = colors;
|
||||
|
||||
// Remark: By default, colors will add style properties to String.prototype
|
||||
//
|
||||
// If you don't wish to extend String.prototype you can do this instead and native String will not be touched
|
||||
//
|
||||
// var colors = require('colors/safe);
|
||||
// colors.red("foo")
|
||||
//
|
||||
//
|
||||
var extendStringPrototype = require('./extendStringPrototype')();
|
||||
12
node_modules/forever/node_modules/cliff/node_modules/colors/lib/maps/america.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function() {
|
||||
return function (letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return colors.red(letter);
|
||||
case 1: return colors.white(letter)
|
||||
case 2: return colors.blue(letter)
|
||||
}
|
||||
}
|
||||
})();
|
||||
13
node_modules/forever/node_modules/cliff/node_modules/colors/lib/maps/rainbow.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function () {
|
||||
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV
|
||||
return function (letter, i, exploded) {
|
||||
if (letter === " ") {
|
||||
return letter;
|
||||
} else {
|
||||
return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
8
node_modules/forever/node_modules/cliff/node_modules/colors/lib/maps/random.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function () {
|
||||
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : colors[available[Math.round(Math.random() * (available.length - 1))]](letter);
|
||||
};
|
||||
})();
|
||||
5
node_modules/forever/node_modules/cliff/node_modules/colors/lib/maps/zebra.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = function (letter, i, exploded) {
|
||||
return i % 2 === 0 ? letter : colors.inverse(letter);
|
||||
};
|
||||
77
node_modules/forever/node_modules/cliff/node_modules/colors/lib/styles.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var styles = {};
|
||||
module['exports'] = styles;
|
||||
|
||||
var codes = {
|
||||
reset: [0, 0],
|
||||
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29],
|
||||
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39],
|
||||
grey: [90, 39],
|
||||
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// legacy styles for colors pre v1.0.0
|
||||
blackBG: [40, 49],
|
||||
redBG: [41, 49],
|
||||
greenBG: [42, 49],
|
||||
yellowBG: [43, 49],
|
||||
blueBG: [44, 49],
|
||||
magentaBG: [45, 49],
|
||||
cyanBG: [46, 49],
|
||||
whiteBG: [47, 49]
|
||||
|
||||
};
|
||||
|
||||
Object.keys(codes).forEach(function (key) {
|
||||
var val = codes[key];
|
||||
var style = styles[key] = [];
|
||||
style.open = '\u001b[' + val[0] + 'm';
|
||||
style.close = '\u001b[' + val[1] + 'm';
|
||||
});
|
||||
61
node_modules/forever/node_modules/cliff/node_modules/colors/lib/system/supports-colors.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var argv = process.argv;
|
||||
|
||||
module.exports = (function () {
|
||||
if (argv.indexOf('--no-color') !== -1 ||
|
||||
argv.indexOf('--color=false') !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (argv.indexOf('--color') !== -1 ||
|
||||
argv.indexOf('--color=true') !== -1 ||
|
||||
argv.indexOf('--color=always') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.stdout && !process.stdout.isTTY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in process.env) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.env.TERM === 'dumb') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})();
|
||||
35
node_modules/forever/node_modules/cliff/node_modules/colors/package.json
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "colors",
|
||||
"description": "get colors in your node.js console",
|
||||
"version": "1.0.3",
|
||||
"author": {
|
||||
"name": "Marak Squires"
|
||||
},
|
||||
"homepage": "https://github.com/Marak/colors.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Marak/colors.js/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"terminal",
|
||||
"colors"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/Marak/colors.js.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "node tests/basic-test.js && node tests/safe-test.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.1.90"
|
||||
},
|
||||
"main": "./lib/index",
|
||||
"readme": "# colors.js\n\n## get color and style in your node.js console\n\n<img src=\"https://github.com/Marak/colors.js/raw/master/screenshots/colors.png\"/>\n\n## Installation\n\n npm install colors\n\n## colors and styles!\n\n### text colors\n\n - black\n - red\n - green\n - yellow\n - blue\n - magenta\n - cyan\n - white\n - gray\n - grey\n\n### background colors\n\n\n\n - bgBlack\n - bgRed\n - bgGreen\n - bgYellow\n - bgBlue\n - bgMagenta\n - bgCyan\n - bgWhite\n\n### styles\n\n - reset\n - bold\n - dim\n - italic\n - underline\n - inverse\n - hidden\n - strikethrough\n\n### extras\n\n - rainbow\n - zebra\n - america\n - trap\n - random\n\n\n## Usage\n\nBy popular demand, `colors` now ships with two types of usages!\n\nThe super nifty way\n\n```js\nvar colors = require('colors');\n\nconsole.log('hello'.green); // outputs green text\nconsole.log('i like cake and pies'.underline.red) // outputs red underlined text\nconsole.log('inverse the color'.inverse); // inverses the color\nconsole.log('OMG Rainbows!'.rainbow); // rainbow\nconsole.log('Run the trap'.trap); // Drops the bass\n\n```\n\nor a slightly less nifty way which doesn't extend `String.prototype`\n\n```js\nvar colors = require('colors/safe');\n\nconsole.log(colors.green('hello')); // outputs green text\nconsole.log(colors.red.underline('i like cake and pies')) // outputs red underlined text\nconsole.log(colors.inverse('inverse the color')); // inverses the color\nconsole.log(colors.rainbow('OMG Rainbows!')); // rainbow\nconsole.log(colors.trap('Run the trap')); // Drops the bass\n\n```\n\nI prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way. \n\nIf you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.\n\n## Disabling Colors\n\nTo disable colors you can pass the following arguments in the command line to your application:\n\n```bash\nnode myapp.js --no-color\n```\n\n## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)\n\n```js\nvar name = 'Marak';\nconsole.log(colors.green('Hello %s'), name);\n// outputs -> 'Hello Marak'\n```\n\n## Custom themes\n\n### Using standard API\n\n```js\n\nvar colors = require('colors');\n\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(\"this is an error\".error);\n\n// outputs yellow text\nconsole.log(\"this is a warning\".warn);\n```\n\n### Using string safe API\n\n```js\nvar colors = require('colors/safe');\n\n// set single property\nvar error = colors.red;\nerror('this is red');\n\n// set theme\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(colors.error(\"this is an error\"));\n\n// outputs yellow text\nconsole.log(colors.warn(\"this is a warning\"));\n```\n\n*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*",
|
||||
"readmeFilename": "ReadMe.md",
|
||||
"_id": "colors@1.0.3",
|
||||
"_shasum": "0433f44d809680fdeb60ed260f1b0c262e82a40b",
|
||||
"_resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
|
||||
"_from": "colors@>=1.0.3 <1.1.0"
|
||||
}
|
||||
9
node_modules/forever/node_modules/cliff/node_modules/colors/safe.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Remark: Requiring this file will use the "safe" colors API which will not touch String.prototype
|
||||
//
|
||||
// var colors = require('colors/safe);
|
||||
// colors.red("foo")
|
||||
//
|
||||
//
|
||||
var colors = require('./lib/colors');
|
||||
module['exports'] = colors;
|
||||
BIN
node_modules/forever/node_modules/cliff/node_modules/colors/screenshots/colors.png
generated
vendored
Normal file
|
After Width: | Height: | Size: 78 KiB |
50
node_modules/forever/node_modules/cliff/node_modules/colors/tests/basic-test.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var assert = require('assert'),
|
||||
colors = require('../lib/index');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(s[color], a(s, code));
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(s[color], colors[color](s));
|
||||
assert.equal(s[color].strip, s);
|
||||
assert.equal(s[color].strip, colors.strip(s));
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(s.bold, '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(s.italic, '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(s.underline, '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(s.strikethrough, '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(s.inverse, '\x1B[7m' + s + '\x1B[27m');
|
||||
|
||||
assert.ok(s.rainbow);
|
||||
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
|
||||
assert.equal(s, 'string');
|
||||
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
|
||||
45
node_modules/forever/node_modules/cliff/node_modules/colors/tests/safe-test.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var assert = require('assert'),
|
||||
colors = require('../safe');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(colors.strip(s), s);
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(colors.bold(s), '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(colors.italic(s), '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(colors.underline(s), '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(colors.strikethrough(s), '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(colors.inverse(s), '\x1B[7m' + s + '\x1B[27m');
|
||||
|
||||
assert.ok(colors.rainbow);
|
||||
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
|
||||
assert.equal(s, 'string');
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof(colors.red("astring")), 'string');
|
||||
assert.equal(typeof(colors.error("astring")), 'string');
|
||||
12
node_modules/forever/node_modules/cliff/node_modules/colors/themes/generic-logging.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module['exports'] = {
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
};
|
||||
20
node_modules/forever/node_modules/cliff/node_modules/eyes/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2009 cloudhead
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
4
node_modules/forever/node_modules/cliff/node_modules/eyes/Makefile
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
test:
|
||||
@@node test/eyes-test.js
|
||||
|
||||
.PHONY: test
|
||||
73
node_modules/forever/node_modules/cliff/node_modules/eyes/README.md
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
eyes
|
||||
====
|
||||
|
||||
a customizable value inspector for Node.js
|
||||
|
||||
synopsis
|
||||
--------
|
||||
|
||||
I was tired of looking at cluttered output in the console -- something needed to be done,
|
||||
`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare.
|
||||
So I decided to have some fun. _eyes_ were born.
|
||||
|
||||

|
||||
|
||||
_example of the output of a user-customized eyes.js inspector_
|
||||
|
||||
*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.
|
||||
|
||||
usage
|
||||
-----
|
||||
|
||||
var inspect = require('eyes').inspector({styles: {all: 'magenta'}});
|
||||
|
||||
inspect(something); // inspect with the settings passed to `inspector`
|
||||
|
||||
or
|
||||
|
||||
var eyes = require('eyes');
|
||||
|
||||
eyes.inspect(something); // inspect with the default settings
|
||||
|
||||
you can pass a _label_ to `inspect()`, to keep track of your inspections:
|
||||
|
||||
eyes.inspect(something, "a random value");
|
||||
|
||||
If you want to return the output of eyes without printing it, you can set it up this way:
|
||||
|
||||
var inspect = require('eyes').inspector({ stream: null });
|
||||
|
||||
sys.puts(inspect({ something: 42 }));
|
||||
|
||||
customization
|
||||
-------------
|
||||
|
||||
These are the default styles and settings used by _eyes_.
|
||||
|
||||
styles: { // Styles applied to stdout
|
||||
all: 'cyan', // Overall style applied to everything
|
||||
label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`
|
||||
other: 'inverted', // Objects which don't have a literal representation, such as functions
|
||||
key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`
|
||||
special: 'grey', // null, undefined...
|
||||
string: 'green',
|
||||
number: 'magenta',
|
||||
bool: 'blue', // true false
|
||||
regexp: 'green', // /\d+/
|
||||
},
|
||||
|
||||
pretty: true, // Indent object literals
|
||||
hideFunctions: false, // Don't output functions at all
|
||||
stream: process.stdout, // Stream to write to, or null
|
||||
maxLength: 2048 // Truncate output if longer
|
||||
|
||||
You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.
|
||||
|
||||
var inspect = require('eyes').inspector({
|
||||
styles: {
|
||||
all: 'magenta',
|
||||
special: 'bold'
|
||||
},
|
||||
maxLength: 512
|
||||
});
|
||||
|
||||
236
node_modules/forever/node_modules/cliff/node_modules/eyes/lib/eyes.js
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
//
|
||||
// Eyes.js - a customizable value inspector for Node.js
|
||||
//
|
||||
// usage:
|
||||
//
|
||||
// var inspect = require('eyes').inspector({styles: {all: 'magenta'}});
|
||||
// inspect(something); // inspect with the settings passed to `inspector`
|
||||
//
|
||||
// or
|
||||
//
|
||||
// var eyes = require('eyes');
|
||||
// eyes.inspect(something); // inspect with the default settings
|
||||
//
|
||||
var eyes = exports,
|
||||
stack = [];
|
||||
|
||||
eyes.defaults = {
|
||||
styles: { // Styles applied to stdout
|
||||
all: 'cyan', // Overall style applied to everything
|
||||
label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`
|
||||
other: 'inverted', // Objects which don't have a literal representation, such as functions
|
||||
key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`
|
||||
special: 'grey', // null, undefined...
|
||||
string: 'green',
|
||||
number: 'magenta',
|
||||
bool: 'blue', // true false
|
||||
regexp: 'green', // /\d+/
|
||||
},
|
||||
pretty: true, // Indent object literals
|
||||
hideFunctions: false,
|
||||
showHidden: false,
|
||||
stream: process.stdout,
|
||||
maxLength: 2048 // Truncate output if longer
|
||||
};
|
||||
|
||||
// Return a curried inspect() function, with the `options` argument filled in.
|
||||
eyes.inspector = function (options) {
|
||||
var that = this;
|
||||
return function (obj, label, opts) {
|
||||
return that.inspect.call(that, obj, label,
|
||||
merge(options || {}, opts || {}));
|
||||
};
|
||||
};
|
||||
|
||||
// If we have a `stream` defined, use it to print a styled string,
|
||||
// if not, we just return the stringified object.
|
||||
eyes.inspect = function (obj, label, options) {
|
||||
options = merge(this.defaults, options || {});
|
||||
|
||||
if (options.stream) {
|
||||
return this.print(stringify(obj, options), label, options);
|
||||
} else {
|
||||
return stringify(obj, options) + (options.styles ? '\033[39m' : '');
|
||||
}
|
||||
};
|
||||
|
||||
// Output using the 'stream', and an optional label
|
||||
// Loop through `str`, and truncate it after `options.maxLength` has been reached.
|
||||
// Because escape sequences are, at this point embeded within
|
||||
// the output string, we can't measure the length of the string
|
||||
// in a useful way, without separating what is an escape sequence,
|
||||
// versus a printable character (`c`). So we resort to counting the
|
||||
// length manually.
|
||||
eyes.print = function (str, label, options) {
|
||||
for (var c = 0, i = 0; i < str.length; i++) {
|
||||
if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5
|
||||
else if (c === options.maxLength) {
|
||||
str = str.slice(0, i - 1) + '…';
|
||||
break;
|
||||
} else { c++ }
|
||||
}
|
||||
return options.stream.write.call(options.stream, (label ?
|
||||
this.stylize(label, options.styles.label, options.styles) + ': ' : '') +
|
||||
this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n");
|
||||
};
|
||||
|
||||
// Apply a style to a string, eventually,
|
||||
// I'd like this to support passing multiple
|
||||
// styles.
|
||||
eyes.stylize = function (str, style, styles) {
|
||||
var codes = {
|
||||
'bold' : [1, 22],
|
||||
'underline' : [4, 24],
|
||||
'inverse' : [7, 27],
|
||||
'cyan' : [36, 39],
|
||||
'magenta' : [35, 39],
|
||||
'blue' : [34, 39],
|
||||
'yellow' : [33, 39],
|
||||
'green' : [32, 39],
|
||||
'red' : [31, 39],
|
||||
'grey' : [90, 39]
|
||||
}, endCode;
|
||||
|
||||
if (style && codes[style]) {
|
||||
endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0]
|
||||
: codes[style][1];
|
||||
return '\033[' + codes[style][0] + 'm' + str +
|
||||
'\033[' + endCode + 'm';
|
||||
} else { return str }
|
||||
};
|
||||
|
||||
// Convert any object to a string, ready for output.
|
||||
// When an 'array' or an 'object' are encountered, they are
|
||||
// passed to specialized functions, which can then recursively call
|
||||
// stringify().
|
||||
function stringify(obj, options) {
|
||||
var that = this, stylize = function (str, style) {
|
||||
return eyes.stylize(str, options.styles[style], options.styles)
|
||||
}, index, result;
|
||||
|
||||
if ((index = stack.indexOf(obj)) !== -1) {
|
||||
return stylize(new(Array)(stack.length - index + 1).join('.'), 'special');
|
||||
}
|
||||
stack.push(obj);
|
||||
|
||||
result = (function (obj) {
|
||||
switch (typeOf(obj)) {
|
||||
case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'"
|
||||
: '"' + obj + '"');
|
||||
return stylize(obj, 'string');
|
||||
case "regexp" : return stylize('/' + obj.source + '/', 'regexp');
|
||||
case "number" : return stylize(obj + '', 'number');
|
||||
case "function" : return options.stream ? stylize("Function", 'other') : '[Function]';
|
||||
case "null" : return stylize("null", 'special');
|
||||
case "undefined": return stylize("undefined", 'special');
|
||||
case "boolean" : return stylize(obj + '', 'bool');
|
||||
case "date" : return stylize(obj.toUTCString());
|
||||
case "array" : return stringifyArray(obj, options, stack.length);
|
||||
case "object" : return stringifyObject(obj, options, stack.length);
|
||||
}
|
||||
})(obj);
|
||||
|
||||
stack.pop();
|
||||
return result;
|
||||
};
|
||||
|
||||
// Escape invisible characters in a string
|
||||
function stringifyString (str, options) {
|
||||
return str.replace(/\\/g, '\\\\')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/[\u0001-\u001F]/g, function (match) {
|
||||
return '\\0' + match[0].charCodeAt(0).toString(8);
|
||||
});
|
||||
}
|
||||
|
||||
// Convert an array to a string, such as [1, 2, 3].
|
||||
// This function calls stringify() for each of the elements
|
||||
// in the array.
|
||||
function stringifyArray(ary, options, level) {
|
||||
var out = [];
|
||||
var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) {
|
||||
return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) ||
|
||||
(Array.isArray(o) && o.length > 0);
|
||||
}));
|
||||
var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' ';
|
||||
|
||||
for (var i = 0; i < ary.length; i++) {
|
||||
out.push(stringify(ary[i], options));
|
||||
}
|
||||
|
||||
if (out.length === 0) {
|
||||
return '[]';
|
||||
} else {
|
||||
return '[' + ws
|
||||
+ out.join(',' + (pretty ? ws : ' '))
|
||||
+ (pretty ? ws.slice(0, -4) : ws) +
|
||||
']';
|
||||
}
|
||||
};
|
||||
|
||||
// Convert an object to a string, such as {a: 1}.
|
||||
// This function calls stringify() for each of its values,
|
||||
// and does not output functions or prototype values.
|
||||
function stringifyObject(obj, options, level) {
|
||||
var out = [];
|
||||
var pretty = options.pretty && (Object.keys(obj).length > 2 ||
|
||||
Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' }));
|
||||
var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' ';
|
||||
|
||||
var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj);
|
||||
keys.forEach(function (k) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, k)
|
||||
&& !(obj[k] instanceof Function && options.hideFunctions)) {
|
||||
out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' +
|
||||
stringify(obj[k], options));
|
||||
}
|
||||
});
|
||||
|
||||
if (out.length === 0) {
|
||||
return '{}';
|
||||
} else {
|
||||
return "{" + ws
|
||||
+ out.join(',' + (pretty ? ws : ' '))
|
||||
+ (pretty ? ws.slice(0, -4) : ws) +
|
||||
"}";
|
||||
}
|
||||
};
|
||||
|
||||
// A better `typeof`
|
||||
function typeOf(value) {
|
||||
var s = typeof(value),
|
||||
types = [Object, Array, String, RegExp, Number, Function, Boolean, Date];
|
||||
|
||||
if (s === 'object' || s === 'function') {
|
||||
if (value) {
|
||||
types.forEach(function (t) {
|
||||
if (value instanceof t) { s = t.name.toLowerCase() }
|
||||
});
|
||||
} else { s = 'null' }
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function merge(/* variable args */) {
|
||||
var objs = Array.prototype.slice.call(arguments);
|
||||
var target = {};
|
||||
|
||||
objs.forEach(function (o) {
|
||||
Object.keys(o).forEach(function (k) {
|
||||
if (k === 'styles') {
|
||||
if (! o.styles) {
|
||||
target.styles = false;
|
||||
} else {
|
||||
target.styles = {}
|
||||
for (var s in o.styles) {
|
||||
target.styles[s] = o.styles[s];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
target[k] = o[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
return target;
|
||||
}
|
||||
|
||||
42
node_modules/forever/node_modules/cliff/node_modules/eyes/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "eyes",
|
||||
"description": "a customizable value inspector",
|
||||
"url": "http://github.com/cloudhead/eyes.js",
|
||||
"keywords": [
|
||||
"inspector",
|
||||
"debug",
|
||||
"inspect",
|
||||
"print"
|
||||
],
|
||||
"author": {
|
||||
"name": "Alexis Sellier",
|
||||
"email": "self@cloudhead.net"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Charlie Robbins",
|
||||
"email": "charlie@nodejitsu.com"
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
"MIT"
|
||||
],
|
||||
"main": "./lib/eyes",
|
||||
"version": "0.1.8",
|
||||
"scripts": {
|
||||
"test": "node test/*-test.js"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib",
|
||||
"test": "./test"
|
||||
},
|
||||
"engines": {
|
||||
"node": "> 0.1.90"
|
||||
},
|
||||
"readme": "eyes\n====\n\na customizable value inspector for Node.js\n\nsynopsis\n--------\n\nI was tired of looking at cluttered output in the console -- something needed to be done,\n`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. \nSo I decided to have some fun. _eyes_ were born.\n\n\n\n_example of the output of a user-customized eyes.js inspector_\n\n*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.\n\nusage\n-----\n\n var inspect = require('eyes').inspector({styles: {all: 'magenta'}});\n\n inspect(something); // inspect with the settings passed to `inspector`\n\nor\n\n var eyes = require('eyes');\n\n eyes.inspect(something); // inspect with the default settings\n\nyou can pass a _label_ to `inspect()`, to keep track of your inspections:\n\n eyes.inspect(something, \"a random value\");\n\nIf you want to return the output of eyes without printing it, you can set it up this way:\n\n var inspect = require('eyes').inspector({ stream: null });\n\n sys.puts(inspect({ something: 42 }));\n\ncustomization\n-------------\n\nThese are the default styles and settings used by _eyes_.\n\n styles: { // Styles applied to stdout\n all: 'cyan', // Overall style applied to everything\n label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`\n other: 'inverted', // Objects which don't have a literal representation, such as functions\n key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`\n special: 'grey', // null, undefined...\n string: 'green',\n number: 'magenta',\n bool: 'blue', // true false\n regexp: 'green', // /\\d+/\n },\n \n pretty: true, // Indent object literals\n hideFunctions: false, // Don't output functions at all\n stream: process.stdout, // Stream to write to, or null\n maxLength: 2048 // Truncate output if longer\n\nYou can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.\n\n var inspect = require('eyes').inspector({\n styles: {\n all: 'magenta',\n special: 'bold'\n },\n maxLength: 512\n });\n\n",
|
||||
"readmeFilename": "README.md",
|
||||
"_id": "eyes@0.1.8",
|
||||
"_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
|
||||
"_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
|
||||
"_from": "eyes@>=0.1.8 <0.2.0"
|
||||
}
|
||||
56
node_modules/forever/node_modules/cliff/node_modules/eyes/test/eyes-test.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
var util = require('util');
|
||||
var eyes = require('../lib/eyes');
|
||||
|
||||
eyes.inspect({
|
||||
number: 42,
|
||||
string: "John Galt",
|
||||
regexp: /[a-z]+/,
|
||||
array: [99, 168, 'x', {}],
|
||||
func: function () {},
|
||||
bool: false,
|
||||
nil: null,
|
||||
undef: undefined,
|
||||
object: {attr: []}
|
||||
}, "native types");
|
||||
|
||||
eyes.inspect({
|
||||
number: new(Number)(42),
|
||||
string: new(String)("John Galt"),
|
||||
regexp: new(RegExp)(/[a-z]+/),
|
||||
array: new(Array)(99, 168, 'x', {}),
|
||||
bool: new(Boolean)(false),
|
||||
object: new(Object)({attr: []}),
|
||||
date: new(Date)
|
||||
}, "wrapped types");
|
||||
|
||||
var obj = {};
|
||||
obj.that = { self: obj };
|
||||
obj.self = obj;
|
||||
|
||||
eyes.inspect(obj, "circular object");
|
||||
eyes.inspect({hello: 'moto'}, "small object");
|
||||
eyes.inspect({hello: new(Array)(6) }, "big object");
|
||||
eyes.inspect(["hello 'world'", 'hello "world"'], "quotes");
|
||||
eyes.inspect({
|
||||
recommendations: [{
|
||||
id: 'a7a6576c2c822c8e2bd81a27e41437d8',
|
||||
key: [ 'spree', 3.764316258020699 ],
|
||||
value: {
|
||||
_id: 'a7a6576c2c822c8e2bd81a27e41437d8',
|
||||
_rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98',
|
||||
type: 'domain',
|
||||
domain: 'spree',
|
||||
weight: 3.764316258020699,
|
||||
product_id: 30
|
||||
}
|
||||
}]
|
||||
}, 'complex');
|
||||
|
||||
eyes.inspect([null], "null in array");
|
||||
|
||||
var inspect = eyes.inspector({ stream: null });
|
||||
|
||||
util.puts(inspect('something', "something"));
|
||||
util.puts(inspect("something else"));
|
||||
|
||||
util.puts(inspect(["no color"], null, { styles: false }));
|
||||
44
node_modules/forever/node_modules/cliff/package.json
generated
vendored
Normal file
79
node_modules/forever/node_modules/cliff/test/cliff-test.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* log-test.js: Tests for cliff.
|
||||
*
|
||||
* (C) 2010, Charlie Robbins & the Contributors
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
vows = require('vows'),
|
||||
eyes = require('eyes'),
|
||||
cliff = require('../lib/cliff');
|
||||
|
||||
vows.describe('cliff').addBatch({
|
||||
"When using cliff module": {
|
||||
"the columnMajor() method": {
|
||||
"should respond with rows in column major form": function () {
|
||||
var columns, rows = [
|
||||
["1a", "2a", "3a", "4a"],
|
||||
["1b", "2b", "3b", "4b"],
|
||||
["1c", "2c", "3c", "4c"]
|
||||
];
|
||||
|
||||
columns = cliff.columnMajor(rows);
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
columns[i].forEach(function (val) {
|
||||
assert.isTrue(val.indexOf(i + 1) !== -1);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
"the arrayLengths() method": {
|
||||
"with a set of strings": {
|
||||
"should respond with a list of the longest elements": function () {
|
||||
var lengths, rows = [
|
||||
["1a", "2a", "3a", "4a"],
|
||||
["1b", "2bb", "3b", "4b"],
|
||||
["1c", "2c", "3ccc", "4c"],
|
||||
["1d", "2d", "3dd", "4dddd"]
|
||||
];
|
||||
|
||||
lengths = cliff.arrayLengths(rows);
|
||||
assert.equal(lengths[0], 2);
|
||||
assert.equal(lengths[1], 3);
|
||||
assert.equal(lengths[2], 4);
|
||||
assert.equal(lengths[3], 5);
|
||||
}
|
||||
},
|
||||
"with a set of numbers and strings": {
|
||||
"should respond with a list of the longest elements": function () {
|
||||
var lengths, rows = [
|
||||
[11, "2a", "3a", "4a"],
|
||||
["1b", 222, "3b", "4b"],
|
||||
["1c", "2c", 3333, "4c"],
|
||||
["1d", "2d", "3dd", 44444]
|
||||
];
|
||||
|
||||
lengths = cliff.arrayLengths(rows);
|
||||
assert.equal(lengths[0], 2);
|
||||
assert.equal(lengths[1], 3);
|
||||
assert.equal(lengths[2], 4);
|
||||
assert.equal(lengths[3], 5);
|
||||
}
|
||||
}
|
||||
},
|
||||
"the stringifyRows() method": {
|
||||
"should calculate padding correctly for numbers": function() {
|
||||
var rows = [
|
||||
['a', 'b'],
|
||||
[12345, 1]
|
||||
];
|
||||
|
||||
assert.equal(
|
||||
cliff.stringifyRows(rows),
|
||||
'a b \n12345 1 '
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
22
node_modules/forever/node_modules/colors/MIT-LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2010
|
||||
|
||||
Marak Squires
|
||||
Alexis Sellier (cloudhead)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
77
node_modules/forever/node_modules/colors/ReadMe.md
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# colors.js - get color and style in your node.js console ( and browser ) like what
|
||||
|
||||
<img src="http://i.imgur.com/goJdO.png" border = "0"/>
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
npm install colors
|
||||
|
||||
## colors and styles!
|
||||
|
||||
- bold
|
||||
- italic
|
||||
- underline
|
||||
- inverse
|
||||
- yellow
|
||||
- cyan
|
||||
- white
|
||||
- magenta
|
||||
- green
|
||||
- red
|
||||
- grey
|
||||
- blue
|
||||
- rainbow
|
||||
- zebra
|
||||
- random
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var colors = require('./colors');
|
||||
|
||||
console.log('hello'.green); // outputs green text
|
||||
console.log('i like cake and pies'.underline.red) // outputs red underlined text
|
||||
console.log('inverse the color'.inverse); // inverses the color
|
||||
console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)
|
||||
```
|
||||
|
||||
# Creating Custom themes
|
||||
|
||||
```js
|
||||
|
||||
var colors = require('colors');
|
||||
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
```
|
||||
|
||||
|
||||
### Contributors
|
||||
|
||||
Marak (Marak Squires)
|
||||
Alexis Sellier (cloudhead)
|
||||
mmalecki (Maciej Małecki)
|
||||
nicoreed (Nico Reed)
|
||||
morganrallen (Morgan Allen)
|
||||
JustinCampbell (Justin Campbell)
|
||||
ded (Dustin Diaz)
|
||||
|
||||
|
||||
#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded)
|
||||
342
node_modules/forever/node_modules/colors/colors.js
generated
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
/*
|
||||
colors.js
|
||||
|
||||
Copyright (c) 2010
|
||||
|
||||
Marak Squires
|
||||
Alexis Sellier (cloudhead)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var isHeadless = false;
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
isHeadless = true;
|
||||
}
|
||||
|
||||
if (!isHeadless) {
|
||||
var exports = {};
|
||||
var module = {};
|
||||
var colors = exports;
|
||||
exports.mode = "browser";
|
||||
} else {
|
||||
exports.mode = "console";
|
||||
}
|
||||
|
||||
//
|
||||
// Prototypes the string object to have additional method calls that add terminal colors
|
||||
//
|
||||
var addProperty = function (color, func) {
|
||||
exports[color] = function (str) {
|
||||
return func.apply(str);
|
||||
};
|
||||
String.prototype.__defineGetter__(color, func);
|
||||
};
|
||||
|
||||
function stylize(str, style) {
|
||||
|
||||
var styles;
|
||||
|
||||
if (exports.mode === 'console') {
|
||||
styles = {
|
||||
//styles
|
||||
'bold' : ['\x1B[1m', '\x1B[22m'],
|
||||
'italic' : ['\x1B[3m', '\x1B[23m'],
|
||||
'underline' : ['\x1B[4m', '\x1B[24m'],
|
||||
'inverse' : ['\x1B[7m', '\x1B[27m'],
|
||||
'strikethrough' : ['\x1B[9m', '\x1B[29m'],
|
||||
//text colors
|
||||
//grayscale
|
||||
'white' : ['\x1B[37m', '\x1B[39m'],
|
||||
'grey' : ['\x1B[90m', '\x1B[39m'],
|
||||
'black' : ['\x1B[30m', '\x1B[39m'],
|
||||
//colors
|
||||
'blue' : ['\x1B[34m', '\x1B[39m'],
|
||||
'cyan' : ['\x1B[36m', '\x1B[39m'],
|
||||
'green' : ['\x1B[32m', '\x1B[39m'],
|
||||
'magenta' : ['\x1B[35m', '\x1B[39m'],
|
||||
'red' : ['\x1B[31m', '\x1B[39m'],
|
||||
'yellow' : ['\x1B[33m', '\x1B[39m'],
|
||||
//background colors
|
||||
//grayscale
|
||||
'whiteBG' : ['\x1B[47m', '\x1B[49m'],
|
||||
'greyBG' : ['\x1B[49;5;8m', '\x1B[49m'],
|
||||
'blackBG' : ['\x1B[40m', '\x1B[49m'],
|
||||
//colors
|
||||
'blueBG' : ['\x1B[44m', '\x1B[49m'],
|
||||
'cyanBG' : ['\x1B[46m', '\x1B[49m'],
|
||||
'greenBG' : ['\x1B[42m', '\x1B[49m'],
|
||||
'magentaBG' : ['\x1B[45m', '\x1B[49m'],
|
||||
'redBG' : ['\x1B[41m', '\x1B[49m'],
|
||||
'yellowBG' : ['\x1B[43m', '\x1B[49m']
|
||||
};
|
||||
} else if (exports.mode === 'browser') {
|
||||
styles = {
|
||||
//styles
|
||||
'bold' : ['<b>', '</b>'],
|
||||
'italic' : ['<i>', '</i>'],
|
||||
'underline' : ['<u>', '</u>'],
|
||||
'inverse' : ['<span style="background-color:black;color:white;">', '</span>'],
|
||||
'strikethrough' : ['<del>', '</del>'],
|
||||
//text colors
|
||||
//grayscale
|
||||
'white' : ['<span style="color:white;">', '</span>'],
|
||||
'grey' : ['<span style="color:gray;">', '</span>'],
|
||||
'black' : ['<span style="color:black;">', '</span>'],
|
||||
//colors
|
||||
'blue' : ['<span style="color:blue;">', '</span>'],
|
||||
'cyan' : ['<span style="color:cyan;">', '</span>'],
|
||||
'green' : ['<span style="color:green;">', '</span>'],
|
||||
'magenta' : ['<span style="color:magenta;">', '</span>'],
|
||||
'red' : ['<span style="color:red;">', '</span>'],
|
||||
'yellow' : ['<span style="color:yellow;">', '</span>'],
|
||||
//background colors
|
||||
//grayscale
|
||||
'whiteBG' : ['<span style="background-color:white;">', '</span>'],
|
||||
'greyBG' : ['<span style="background-color:gray;">', '</span>'],
|
||||
'blackBG' : ['<span style="background-color:black;">', '</span>'],
|
||||
//colors
|
||||
'blueBG' : ['<span style="background-color:blue;">', '</span>'],
|
||||
'cyanBG' : ['<span style="background-color:cyan;">', '</span>'],
|
||||
'greenBG' : ['<span style="background-color:green;">', '</span>'],
|
||||
'magentaBG' : ['<span style="background-color:magenta;">', '</span>'],
|
||||
'redBG' : ['<span style="background-color:red;">', '</span>'],
|
||||
'yellowBG' : ['<span style="background-color:yellow;">', '</span>']
|
||||
};
|
||||
} else if (exports.mode === 'none') {
|
||||
return str + '';
|
||||
} else {
|
||||
console.log('unsupported mode, try "browser", "console" or "none"');
|
||||
}
|
||||
return styles[style][0] + str + styles[style][1];
|
||||
}
|
||||
|
||||
function applyTheme(theme) {
|
||||
|
||||
//
|
||||
// Remark: This is a list of methods that exist
|
||||
// on String that you should not overwrite.
|
||||
//
|
||||
var stringPrototypeBlacklist = [
|
||||
'__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
|
||||
'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
|
||||
'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
|
||||
'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight'
|
||||
];
|
||||
|
||||
Object.keys(theme).forEach(function (prop) {
|
||||
if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
||||
console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name');
|
||||
}
|
||||
else {
|
||||
if (typeof(theme[prop]) === 'string') {
|
||||
addProperty(prop, function () {
|
||||
return exports[theme[prop]](this);
|
||||
});
|
||||
}
|
||||
else {
|
||||
addProperty(prop, function () {
|
||||
var ret = this;
|
||||
for (var t = 0; t < theme[prop].length; t++) {
|
||||
ret = exports[theme[prop][t]](ret);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Iterate through all default styles and colors
|
||||
//
|
||||
var x = ['bold', 'underline', 'strikethrough', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta', 'greyBG', 'blackBG', 'yellowBG', 'redBG', 'greenBG', 'blueBG', 'whiteBG', 'cyanBG', 'magentaBG'];
|
||||
x.forEach(function (style) {
|
||||
|
||||
// __defineGetter__ at the least works in more browsers
|
||||
// http://robertnyman.com/javascript/javascript-getters-setters.html
|
||||
// Object.defineProperty only works in Chrome
|
||||
addProperty(style, function () {
|
||||
return stylize(this, style);
|
||||
});
|
||||
});
|
||||
|
||||
function sequencer(map) {
|
||||
return function () {
|
||||
if (!isHeadless) {
|
||||
return this.replace(/( )/, '$1');
|
||||
}
|
||||
var exploded = this.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
};
|
||||
}
|
||||
|
||||
var rainbowMap = (function () {
|
||||
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV
|
||||
return function (letter, i, exploded) {
|
||||
if (letter === " ") {
|
||||
return letter;
|
||||
} else {
|
||||
return stylize(letter, rainbowColors[i++ % rainbowColors.length]);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
exports.themes = {};
|
||||
|
||||
exports.addSequencer = function (name, map) {
|
||||
addProperty(name, sequencer(map));
|
||||
};
|
||||
|
||||
exports.addSequencer('rainbow', rainbowMap);
|
||||
exports.addSequencer('zebra', function (letter, i, exploded) {
|
||||
return i % 2 === 0 ? letter : letter.inverse;
|
||||
});
|
||||
|
||||
exports.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
exports.themes[theme] = require(theme);
|
||||
applyTheme(exports.themes[theme]);
|
||||
return exports.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
addProperty('stripColors', function () {
|
||||
return ("" + this).replace(/\x1B\[\d+m/g, '');
|
||||
});
|
||||
|
||||
// please no
|
||||
function zalgo(text, options) {
|
||||
var soul = {
|
||||
"up" : [
|
||||
'̍', '̎', '̄', '̅',
|
||||
'̿', '̑', '̆', '̐',
|
||||
'͒', '͗', '͑', '̇',
|
||||
'̈', '̊', '͂', '̓',
|
||||
'̈', '͊', '͋', '͌',
|
||||
'̃', '̂', '̌', '͐',
|
||||
'̀', '́', '̋', '̏',
|
||||
'̒', '̓', '̔', '̽',
|
||||
'̉', 'ͣ', 'ͤ', 'ͥ',
|
||||
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
||||
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
||||
'ͮ', 'ͯ', '̾', '͛',
|
||||
'͆', '̚'
|
||||
],
|
||||
"down" : [
|
||||
'̖', '̗', '̘', '̙',
|
||||
'̜', '̝', '̞', '̟',
|
||||
'̠', '̤', '̥', '̦',
|
||||
'̩', '̪', '̫', '̬',
|
||||
'̭', '̮', '̯', '̰',
|
||||
'̱', '̲', '̳', '̹',
|
||||
'̺', '̻', '̼', 'ͅ',
|
||||
'͇', '͈', '͉', '͍',
|
||||
'͎', '͓', '͔', '͕',
|
||||
'͖', '͙', '͚', '̣'
|
||||
],
|
||||
"mid" : [
|
||||
'̕', '̛', '̀', '́',
|
||||
'͘', '̡', '̢', '̧',
|
||||
'̨', '̴', '̵', '̶',
|
||||
'͜', '͝', '͞',
|
||||
'͟', '͠', '͢', '̸',
|
||||
'̷', '͡', ' ҉'
|
||||
]
|
||||
},
|
||||
all = [].concat(soul.up, soul.down, soul.mid),
|
||||
zalgo = {};
|
||||
|
||||
function randomNumber(range) {
|
||||
var r = Math.floor(Math.random() * range);
|
||||
return r;
|
||||
}
|
||||
|
||||
function is_char(character) {
|
||||
var bool = false;
|
||||
all.filter(function (i) {
|
||||
bool = (i === character);
|
||||
});
|
||||
return bool;
|
||||
}
|
||||
|
||||
function heComes(text, options) {
|
||||
var result = '', counts, l;
|
||||
options = options || {};
|
||||
options["up"] = options["up"] || true;
|
||||
options["mid"] = options["mid"] || true;
|
||||
options["down"] = options["down"] || true;
|
||||
options["size"] = options["size"] || "maxi";
|
||||
text = text.split('');
|
||||
for (l in text) {
|
||||
if (is_char(l)) {
|
||||
continue;
|
||||
}
|
||||
result = result + text[l];
|
||||
counts = {"up" : 0, "down" : 0, "mid" : 0};
|
||||
switch (options.size) {
|
||||
case 'mini':
|
||||
counts.up = randomNumber(8);
|
||||
counts.min = randomNumber(2);
|
||||
counts.down = randomNumber(8);
|
||||
break;
|
||||
case 'maxi':
|
||||
counts.up = randomNumber(16) + 3;
|
||||
counts.min = randomNumber(4) + 1;
|
||||
counts.down = randomNumber(64) + 3;
|
||||
break;
|
||||
default:
|
||||
counts.up = randomNumber(8) + 1;
|
||||
counts.mid = randomNumber(6) / 2;
|
||||
counts.down = randomNumber(8) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
var arr = ["up", "mid", "down"];
|
||||
for (var d in arr) {
|
||||
var index = arr[d];
|
||||
for (var i = 0 ; i <= counts[index]; i++) {
|
||||
if (options[index]) {
|
||||
result = result + soul[index][randomNumber(soul[index].length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return heComes(text);
|
||||
}
|
||||
|
||||
|
||||
// don't summon zalgo
|
||||
addProperty('zalgo', function () {
|
||||
return zalgo(this);
|
||||
});
|
||||
76
node_modules/forever/node_modules/colors/example.html
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Colors Example</title>
|
||||
<script src="colors.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
var test = colors.red("hopefully colorless output");
|
||||
|
||||
document.write('Rainbows are fun!'.rainbow + '<br/>');
|
||||
document.write('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
||||
document.write('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||
//document.write('zalgo time!'.zalgo);
|
||||
document.write(test.stripColors);
|
||||
document.write("a".grey + " b".black);
|
||||
|
||||
document.write("Zebras are so fun!".zebra);
|
||||
|
||||
document.write(colors.rainbow('Rainbows are fun!'));
|
||||
document.write("This is " + "not".strikethrough + " fun.");
|
||||
|
||||
document.write(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
|
||||
document.write(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
|
||||
//document.write(colors.zalgo('zalgo time!'));
|
||||
document.write(colors.stripColors(test));
|
||||
document.write(colors.grey("a") + colors.black(" b"));
|
||||
|
||||
colors.addSequencer("america", function(letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return letter.red;
|
||||
case 1: return letter.white;
|
||||
case 2: return letter.blue;
|
||||
}
|
||||
});
|
||||
|
||||
colors.addSequencer("random", (function() {
|
||||
var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]];
|
||||
};
|
||||
})());
|
||||
|
||||
document.write("AMERICA! F--K YEAH!".america);
|
||||
document.write("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random);
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
document.write("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
document.write("this is a warning".warn);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
77
node_modules/forever/node_modules/colors/example.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
var colors = require('./colors');
|
||||
|
||||
//colors.mode = "browser";
|
||||
|
||||
var test = colors.red("hopefully colorless output");
|
||||
console.log('Rainbows are fun!'.rainbow);
|
||||
console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
||||
console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||
//console.log('zalgo time!'.zalgo);
|
||||
console.log(test.stripColors);
|
||||
console.log("a".grey + " b".black);
|
||||
console.log("Zebras are so fun!".zebra);
|
||||
console.log('background color attack!'.black.whiteBG)
|
||||
|
||||
//
|
||||
// Remark: .strikethrough may not work with Mac OS Terminal App
|
||||
//
|
||||
console.log("This is " + "not".strikethrough + " fun.");
|
||||
console.log(colors.rainbow('Rainbows are fun!'));
|
||||
console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
|
||||
console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
|
||||
//console.log(colors.zalgo('zalgo time!'));
|
||||
console.log(colors.stripColors(test));
|
||||
console.log(colors.grey("a") + colors.black(" b"));
|
||||
|
||||
colors.addSequencer("america", function(letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return letter.red;
|
||||
case 1: return letter.white;
|
||||
case 2: return letter.blue;
|
||||
}
|
||||
});
|
||||
|
||||
colors.addSequencer("random", (function() {
|
||||
var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]];
|
||||
};
|
||||
})());
|
||||
|
||||
console.log("AMERICA! F--K YEAH!".america);
|
||||
console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random);
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme('./themes/winston-dark.js');
|
||||
|
||||
console.log("this is an input".input);
|
||||
|
||||
31
node_modules/forever/node_modules/colors/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "colors",
|
||||
"description": "get colors in your node.js console like what",
|
||||
"version": "0.6.2",
|
||||
"author": {
|
||||
"name": "Marak Squires"
|
||||
},
|
||||
"homepage": "https://github.com/Marak/colors.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Marak/colors.js/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"terminal",
|
||||
"colors"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/Marak/colors.js.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.1.90"
|
||||
},
|
||||
"main": "colors",
|
||||
"readme": "# colors.js - get color and style in your node.js console ( and browser ) like what\n\n<img src=\"http://i.imgur.com/goJdO.png\" border = \"0\"/>\n\n\n## Installation\n\n npm install colors\n\n## colors and styles!\n\n- bold\n- italic\n- underline\n- inverse\n- yellow\n- cyan\n- white\n- magenta\n- green\n- red\n- grey\n- blue\n- rainbow\n- zebra\n- random\n\n## Usage\n\n``` js\nvar colors = require('./colors');\n\nconsole.log('hello'.green); // outputs green text\nconsole.log('i like cake and pies'.underline.red) // outputs red underlined text\nconsole.log('inverse the color'.inverse); // inverses the color\nconsole.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)\n```\n\n# Creating Custom themes\n\n```js\n\nvar colors = require('colors');\n\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(\"this is an error\".error);\n\n// outputs yellow text\nconsole.log(\"this is a warning\".warn);\n```\n\n\n### Contributors \n\nMarak (Marak Squires)\nAlexis Sellier (cloudhead)\nmmalecki (Maciej Małecki)\nnicoreed (Nico Reed)\nmorganrallen (Morgan Allen)\nJustinCampbell (Justin Campbell)\nded (Dustin Diaz)\n\n\n#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded)\n",
|
||||
"readmeFilename": "ReadMe.md",
|
||||
"_id": "colors@0.6.2",
|
||||
"_shasum": "2423fe6678ac0c5dae8852e5d0e5be08c997abcc",
|
||||
"_resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz",
|
||||
"_from": "colors@>=0.6.2 <0.7.0"
|
||||
}
|
||||
70
node_modules/forever/node_modules/colors/test.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
var assert = require('assert'),
|
||||
colors = require('./colors');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(s[color], a(s, code));
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(s[color], colors[color](s));
|
||||
assert.equal(s[color].stripColors, s);
|
||||
assert.equal(s[color].stripColors, colors.stripColors(s));
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(s.bold, '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(s.italic, '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(s.underline, '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(s.strikethrough, '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(s.inverse, '\x1B[7m' + s + '\x1B[27m');
|
||||
assert.ok(s.rainbow);
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
assert.equal(s, 'string');
|
||||
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
|
||||
colors.mode = 'browser';
|
||||
assert.equal(s.bold, '<b>' + s + '</b>');
|
||||
assert.equal(s.italic, '<i>' + s + '</i>');
|
||||
assert.equal(s.underline, '<u>' + s + '</u>');
|
||||
assert.equal(s.strikethrough, '<del>' + s + '</del>');
|
||||
assert.equal(s.inverse, '<span style="background-color:black;color:white;">' + s + '</span>');
|
||||
assert.ok(s.rainbow);
|
||||
stylesColors.forEach(function (color) {
|
||||
assert.equal(s[color], h(s, color));
|
||||
assert.equal(colors[color](s), h(s, color));
|
||||
});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
|
||||
colors.mode = 'none';
|
||||
stylesAll.forEach(function (style) {
|
||||
assert.equal(s[style], s);
|
||||
assert.equal(colors[style](s), s);
|
||||
});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
12
node_modules/forever/node_modules/colors/themes/winston-dark.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module['exports'] = {
|
||||
silly: 'rainbow',
|
||||
input: 'black',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
};
|
||||
12
node_modules/forever/node_modules/colors/themes/winston-light.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module['exports'] = {
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
};
|
||||
2
node_modules/forever/node_modules/flatiron/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
12
node_modules/forever/node_modules/flatiron/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
language: node_js
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
node_js:
|
||||
- 0.8
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- travis@nodejitsu.com
|
||||
irc: "irc.freenode.org#nodejitsu"
|
||||
|
||||
19
node_modules/forever/node_modules/flatiron/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2011 Nodejitsu Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
482
node_modules/forever/node_modules/flatiron/README.md
generated
vendored
Normal file
@@ -0,0 +1,482 @@
|
||||
# [flatiron](http://flatironjs.org) [](http://travis-ci.org/flatiron/flatiron)
|
||||
|
||||
*Framework components for node.js and the browser*
|
||||
|
||||

|
||||
|
||||
# Example HTTP Server:
|
||||
|
||||
```js
|
||||
var flatiron = require('flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.http);
|
||||
|
||||
app.router.get('/', function () {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('Hello world!\n');
|
||||
});
|
||||
|
||||
app.start(8080);
|
||||
```
|
||||
|
||||
# Example HTTPS Server:
|
||||
|
||||
```js
|
||||
var flatiron = require('flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.http, {
|
||||
https: {
|
||||
cert: 'path/to/cert.pem',
|
||||
key: 'path/to/key.pem',
|
||||
ca: 'path/to/ca.pem'
|
||||
}
|
||||
});
|
||||
|
||||
app.router.get('/', function () {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('Hello world!\n');
|
||||
});
|
||||
|
||||
app.start(8080);
|
||||
```
|
||||
|
||||
# Example CLI Application:
|
||||
|
||||
```js
|
||||
// example.js
|
||||
|
||||
var flatiron = require('flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.cli, {
|
||||
dir: __dirname,
|
||||
usage: [
|
||||
'This is a basic flatiron cli application example!',
|
||||
'',
|
||||
'hello - say hello to somebody.'
|
||||
]
|
||||
});
|
||||
|
||||
app.cmd('hello', function () {
|
||||
app.prompt.get('name', function (err, result) {
|
||||
app.log.info('hello '+result.name+'!');
|
||||
})
|
||||
})
|
||||
|
||||
app.start();
|
||||
```
|
||||
|
||||
## Run It:
|
||||
|
||||
```
|
||||
% node example.js hello
|
||||
prompt: name: world
|
||||
info: hello world!
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing NPM (Node Package Manager)
|
||||
```
|
||||
curl http://npmjs.org/install.sh | sh
|
||||
```
|
||||
|
||||
### Installing Flatiron
|
||||
```
|
||||
[sudo] npm install flatiron
|
||||
```
|
||||
|
||||
### Installing Union (Required for `flatiron.plugins.http`)
|
||||
```
|
||||
npm install union
|
||||
```
|
||||
|
||||
# Usage:
|
||||
|
||||
## Start With `flatiron.app`:
|
||||
|
||||
`flatiron.app` is a [broadway injection container](https://github.com/flatiron/broadway). To be brief, what it does is allow plugins to modify the `app` object directly:
|
||||
|
||||
```js
|
||||
var flatiron = require('flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
var hello = {
|
||||
attach: function (options) {
|
||||
this.hello = options.message || 'Why hello!';
|
||||
}
|
||||
};
|
||||
|
||||
app.use(hello, {
|
||||
message: "Hi! How are you?"
|
||||
});
|
||||
|
||||
// Will print, "Hi! How are you?"
|
||||
console.log(app.hello);
|
||||
```
|
||||
|
||||
Virtually all additional functionality in flatiron comes from broadway plugins, such as `flatiron.plugins.http` and `flatiron.plugins.cli`.
|
||||
|
||||
### `app.config`
|
||||
|
||||
`flatiron.app` comes with a [`config`](https://github.com/flatiron/broadway/blob/master/lib/broadway/plugins/config.js) plugin pre-loaded, which adds configuration management courtesy [nconf](https://github.com/flatiron/nconf). `app.config` has the same api as the `nconf` object.
|
||||
|
||||
The `literal` store is configured by default. If you want to use different stores you can easily attach them to the `app.config` instance.
|
||||
|
||||
```js
|
||||
// add the `env` store to the config
|
||||
app.config.use('env');
|
||||
|
||||
// add the `file` store the the config
|
||||
app.config.use('file', { file: 'path/to/config.json' });
|
||||
|
||||
// or using an alternate syntax
|
||||
app.config.env().file({ file: 'path/to/config.json' });
|
||||
|
||||
// and removing stores
|
||||
app.config.remove('literal');
|
||||
```
|
||||
|
||||
### `app.log`
|
||||
|
||||
`flatiron.app` will also load a [`log`](https://github.com/flatiron/broadway/blob/master/lib/broadway/plugins/log.js) plugin during the init phase, which attaches a [winston container](https://github.com/flatiron/winston) to `app.log`. This logger is configured by combining the `app.options.log` property with the configuration retrieved from `app.config.get('log')`.
|
||||
|
||||
## Create An HTTP Server with `flatiron.plugins.http(options)`:
|
||||
|
||||
This plugin adds http serving functionality to your flatiron app by attaching the following properties and methods:
|
||||
|
||||
### Define Routes with `app.router`:
|
||||
|
||||
This is a [director](https://github.com/flatiron/director) router configured to route http requests after the middlewares in `app.http.before` are applied. Example routes include:
|
||||
|
||||
```js
|
||||
|
||||
// GET /
|
||||
app.router.get('/', function () {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('Hello world!\n');
|
||||
});
|
||||
|
||||
// POST to /
|
||||
app.router.post('/', function () {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.write('Hey, you posted some cool data!\n');
|
||||
this.res.end(util.inspect(this.req.body, true, 2, true) + '\n');
|
||||
});
|
||||
|
||||
// Parameterized routes
|
||||
app.router.get('/sandwich/:type', function (type) {
|
||||
if (~['bacon', 'burger'].indexOf(type)) {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('Serving ' + type + ' sandwich!\n');
|
||||
}
|
||||
else {
|
||||
this.res.writeHead(404, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('No such sandwich, sorry!\n');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
`app.router` can also route against regular expressions and more! To learn more about director's advanced functionality, visit director's [project page](https://github.com/flatiron/director#readme).
|
||||
|
||||
|
||||
### Access The Server with `app.server`:
|
||||
|
||||
This is a [union](https://github.com/flatiron/union) middleware kernel.
|
||||
|
||||
### Modify the Server Options with `app.http`:
|
||||
|
||||
This object contains options that are passed to the union server, including `app.http.before`, `app.http.after` and `app.http.headers`.
|
||||
|
||||
These properties may be set by passing them through as options:
|
||||
|
||||
```js
|
||||
app.use(flatiron.plugins.http, {
|
||||
before: [],
|
||||
after: []
|
||||
});
|
||||
```
|
||||
|
||||
You can read more about these options on the [union project page](https://github.com/flatiron/union#readme).
|
||||
|
||||
### Start The Server with `app.start(port, <host>, <callback(err)>)`
|
||||
|
||||
This method will both call `app.init` (which will call any asynchronous initialization steps on loaded plugins) and start the http server with the given arguments. For example, the following will start your flatiron http server on port 8080:
|
||||
|
||||
```js
|
||||
app.start(8080);
|
||||
```
|
||||
|
||||
## Create a CLI Application with `flatiron.plugins.cli(options)`
|
||||
|
||||
This plugin turns your app into a cli application framework. For example, [jitsu]
|
||||
(https://github.com/nodejitsu/jitsu) uses flatiron and the cli plugin.
|
||||
|
||||
Valid options include:
|
||||
|
||||
```js
|
||||
{
|
||||
"argvOptions": {}, // A configuration hash passed to the cli argv parser.
|
||||
"usage": [ "foo", "bar" ], // A message to show for cli usage. Joins arrays with `\n`.
|
||||
"dir": require('path').join(__dirname, 'lib', 'commands'), // A directory with commands to lazy-load
|
||||
"notFoundUsage": false // Disable help messages when command not found
|
||||
}
|
||||
```
|
||||
|
||||
### Add lazy-loaded CLI commands with `options.dir` and `app.commands`:
|
||||
|
||||
Flatiron CLI will automatically lazy-load modules defining commands in the directory specified by `options.dir`. For example:
|
||||
|
||||
```js
|
||||
// example2.js
|
||||
var path = require('path'),
|
||||
flatiron = require('./lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.cli, {
|
||||
dir: path.join(__dirname, 'cmds')
|
||||
});
|
||||
|
||||
app.start();
|
||||
```
|
||||
|
||||
```js
|
||||
// cmd/highfive.js
|
||||
var highfive = module.exports = function highfive (person, cb) {
|
||||
this.log.info('High five to ' + person + '!');
|
||||
cb(null);
|
||||
};
|
||||
```
|
||||
|
||||
In the command, you expose a function of arguments and a callback. `this` is set to `app`, and the routing is taken care of automatically.
|
||||
|
||||
Here it is in action:
|
||||
|
||||
```
|
||||
% node example2.js highfive Flatiron
|
||||
info: High five to Flatiron!
|
||||
```
|
||||
|
||||
You can also define these commands by adding them directly to `app.commands` yourself:
|
||||
|
||||
```
|
||||
// example2b.js
|
||||
var flatiron = require('./lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
var path = require('path'),
|
||||
flatiron = require('./lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.cli);
|
||||
|
||||
app.commands.highfive = function (person, cb) {
|
||||
this.log.info('High five to ' + person + '!');
|
||||
cb(null);
|
||||
};
|
||||
|
||||
app.start();
|
||||
```
|
||||
|
||||
```
|
||||
% node example2b.js highfive Flatiron
|
||||
info: High five to Flatiron!
|
||||
```
|
||||
|
||||
Callback will always be the last argument provided to a function assigned to command
|
||||
|
||||
```js
|
||||
app.commands.highfive = function (person, cb) {
|
||||
this.log.info('High five to ' + person + '!');
|
||||
console.log(arguments);
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
% node example2b.js highfive Flatiron lol haha
|
||||
info: High five to Flatiron!
|
||||
{
|
||||
'0': 'Flatiron',
|
||||
'1': 'lol',
|
||||
'2': 'haha',
|
||||
'3': [Function]
|
||||
}
|
||||
```
|
||||
|
||||
### Define Ad-Hoc Commands With `app.cmd(path, handler)`:
|
||||
|
||||
This adds the cli routing path `path` to the app's CLI router, using the [director](https://github.com/flatiron/director) route handler `handler`, aliasing `app.router.on`. `cmd` routes are defined the same way as http routes, except that it uses ` ` (a space) for a delimiter instead of `/`.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
// example.js
|
||||
var flatiron = require('./lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.cli, {
|
||||
usage: [
|
||||
'usage: node test.js hello <person>',
|
||||
'',
|
||||
' This will print "hello <person>"'
|
||||
]
|
||||
});
|
||||
|
||||
app.cmd('hello :person', function (person) {
|
||||
app.log.info('hello ' + person + '!');
|
||||
});
|
||||
|
||||
app.start()
|
||||
```
|
||||
|
||||
When you run this program correctly, it will say hello:
|
||||
|
||||
```
|
||||
% node example.js hello person
|
||||
info: hello person!
|
||||
```
|
||||
|
||||
If not, you get a friendly usage message:
|
||||
|
||||
```
|
||||
% node test.js hello
|
||||
help: usage: node test.js hello <person>
|
||||
help:
|
||||
help: This will print "hello <person>"
|
||||
```
|
||||
|
||||
### Check CLI Arguments with `app.argv`:
|
||||
|
||||
Once your app is started, `app.argv` will contain the [optimist](http://github.com/substack/node-optimist)-parsed argv options hash, ready to go!
|
||||
|
||||
Here's an example:
|
||||
|
||||
```js
|
||||
// example3.js
|
||||
var flatiron = require('./lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.cli);
|
||||
|
||||
app.start();
|
||||
|
||||
app.log.info(JSON.stringify(app.argv));
|
||||
```
|
||||
|
||||
This prints:
|
||||
|
||||
```
|
||||
% node example3.js
|
||||
info: {"_":[], "$0": "node ./example3.js"}
|
||||
```
|
||||
|
||||
Awesome!
|
||||
|
||||
### Add a Default Help Command with `options.usage`:
|
||||
|
||||
When attaching the CLI plugin, just specify options.usage to get a friendly default message for when there aren't any matching routes:
|
||||
|
||||
```js
|
||||
// example4.js
|
||||
var flatiron = require('./lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.cli, {
|
||||
usage: [
|
||||
'Welcome to my app!',
|
||||
'Your command didn\'t do anything.',
|
||||
'This is expected.'
|
||||
]
|
||||
});
|
||||
|
||||
app.start();
|
||||
```
|
||||
|
||||
```
|
||||
% node example4.js
|
||||
help: Welcome to my app!
|
||||
help: Your command didn't do anything.
|
||||
help: This is expected.
|
||||
```
|
||||
|
||||
### Start The Application with `app.start(callback)`:
|
||||
|
||||
As seen in these examples, starting your app is as easy as `app.start`! this method takes a callback, which is called when an `app.command` completes. Here's a complete example demonstrating this behavior and how it integrates with `options.usage`:
|
||||
|
||||
```js
|
||||
// example5.js
|
||||
var path = require('path'),
|
||||
flatiron = require('./lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.cli, {
|
||||
usage: [
|
||||
'`node example5.js error`: Throws an error.',
|
||||
'`node example5.js friendly`: Does not throw an error.'
|
||||
]
|
||||
});
|
||||
|
||||
app.commands.error = function (cb) {
|
||||
cb(new Error('I\'m an error!'));
|
||||
};
|
||||
|
||||
app.commands.friendly = function (cb) {
|
||||
cb(null);
|
||||
}
|
||||
|
||||
app.start(function (err) {
|
||||
if (err) {
|
||||
app.log.error(err.message || 'You didn\'t call any commands!');
|
||||
app.log.warn('NOT OK.');
|
||||
return process.exit(1);
|
||||
}
|
||||
app.log.info('OK.');
|
||||
});
|
||||
```
|
||||
|
||||
Here's how our app behaves:
|
||||
|
||||
```
|
||||
% node example5.js friendly
|
||||
info: OK.
|
||||
|
||||
% node example5.js error
|
||||
error: I'm an error!
|
||||
warn: NOT OK.
|
||||
|
||||
% node example5.js
|
||||
help: `node example2b.js error`: Throws an error.
|
||||
help: `node example2b.js friendly`: Does not throw an error.
|
||||
error: You didn't call any commands!
|
||||
warn: NOT OK.
|
||||
```
|
||||
|
||||
# Read More About Flatiron!
|
||||
|
||||
## Articles
|
||||
|
||||
* [Scaling Isomorphic Javascript Code](http://blog.nodejitsu.com/scaling-isomorphic-javascript-code)
|
||||
* [Introducing Flatiron](http://blog.nodejitsu.com/introducing-flatiron)
|
||||
* [Writing CLI Apps with Flatiron](http://blog.jit.su/writing-cli-apps-with-flatiron)
|
||||
|
||||
## Sub-Projects
|
||||
|
||||
* [Broadway](https://github.com/flatiron/broadway)
|
||||
* [Union](https://github.com/flatiron/union)
|
||||
* [Director](https://github.com/flatiron/director)
|
||||
* [Plates](https://github.com/flatiron/plates)
|
||||
* [Resourceful](https://github.com/flatiron/resourceful)
|
||||
* [And More](https://github.com/flatiron)!
|
||||
|
||||
# Tests
|
||||
|
||||
Tests are written in vows:
|
||||
|
||||
``` bash
|
||||
$ npm test
|
||||
```
|
||||
|
||||
#### Author: [Nodejitsu Inc.](http://nodejitsu.com)
|
||||
#### License: MIT
|
||||
30
node_modules/forever/node_modules/flatiron/bin/flatiron
generated
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var flatiron = require('../lib/flatiron'),
|
||||
path = require('path'),
|
||||
app = flatiron.app;
|
||||
|
||||
var actions = {
|
||||
create: 'Creates an empty template for a flatiron application'
|
||||
};
|
||||
|
||||
app.version = flatiron.version;
|
||||
|
||||
app.use(flatiron.plugins.cli, {
|
||||
version: true,
|
||||
dir: path.join(__dirname, '..', 'lib', 'flatiron', 'cli'),
|
||||
usage: [
|
||||
'flatiron',
|
||||
'',
|
||||
'Commands:'
|
||||
].concat(Object.keys(actions).map(function(key){
|
||||
return ' ' + key + ' - ' + actions[key];
|
||||
}))
|
||||
});
|
||||
|
||||
//
|
||||
// Alias `flatiron create` to `flatiron new`.
|
||||
//
|
||||
app.alias('new', 'create');
|
||||
|
||||
app.start();
|
||||
28
node_modules/forever/node_modules/flatiron/examples/cli-sample/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
console.time('start');
|
||||
var flatiron = require('../../lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
require('pkginfo')(module, 'version');
|
||||
|
||||
app.version = exports.version;
|
||||
|
||||
app.use(flatiron.plugins.cli, {
|
||||
dir: __dirname,
|
||||
usage: [
|
||||
'Simple app example for flatiron!',
|
||||
'',
|
||||
'app start - print a prompt and arguments',
|
||||
'print <msg> - echo a message'
|
||||
],
|
||||
version: true
|
||||
});
|
||||
|
||||
app.cmd('app start', function () {
|
||||
console.timeEnd('start');
|
||||
console.dir('it works!!!');
|
||||
app.prompt.get('name', function (err, name) {
|
||||
console.dir(arguments);
|
||||
})
|
||||
})
|
||||
|
||||
app.start();
|
||||
5
node_modules/forever/node_modules/flatiron/examples/cli-sample/print.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var print = module.exports = function print(msg) {
|
||||
console.log(msg);
|
||||
}
|
||||
print.usage = 'Print out a <msg>';
|
||||
|
||||
30
node_modules/forever/node_modules/flatiron/examples/http-sample.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var util = require('util'),
|
||||
flatiron = require('../lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.http);
|
||||
|
||||
app.router.get('/', function () {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('Hello world!\n');
|
||||
});
|
||||
|
||||
app.router.post('/', function () {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.write('Hey, you posted some cool data!\n');
|
||||
this.res.end(util.inspect(this.req.body, true, 2, true) + '\n');
|
||||
});
|
||||
|
||||
app.router.get('/sandwich/:type', function (type) {
|
||||
if (~['bacon', 'burger'].indexOf(type)) {
|
||||
this.res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('Serving ' + type + ' sandwich!\n');
|
||||
}
|
||||
else {
|
||||
this.res.writeHead(404, { 'Content-Type': 'text/plain' });
|
||||
this.res.end('No such sandwich, sorry!\n');
|
||||
}
|
||||
});
|
||||
|
||||
app.start(8080);
|
||||
|
||||
8
node_modules/forever/node_modules/flatiron/examples/resourceful-app/app.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
var flatiron = require('../../lib/flatiron'),
|
||||
app = module.exports = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.resourceful, {
|
||||
root: __dirname,
|
||||
engine: 'memory'
|
||||
});
|
||||
13
node_modules/forever/node_modules/flatiron/examples/resourceful-app/app/resources/creature.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var resourceful = require('resourceful');
|
||||
|
||||
var Creature = module.exports = resourceful.define('creature', function () {
|
||||
this.string('diet');
|
||||
this.bool('vertebrate');
|
||||
this.array('belly');
|
||||
|
||||
this.timestamps();
|
||||
});
|
||||
|
||||
Creature.prototype.feed = function (food) {
|
||||
this.belly.push(food);
|
||||
};
|
||||
15
node_modules/forever/node_modules/flatiron/examples/resourceful-app/package.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "resourceful-app",
|
||||
"description": "An example flatiron app using resourceful",
|
||||
"version": "0.1.0",
|
||||
"author": "Nodejitsu Inc. <info@nodejitsu.com>",
|
||||
"dependencies": {
|
||||
"flatiron": "0.3.x",
|
||||
"resourceful": "0.3.x"
|
||||
},
|
||||
"main": "./app",
|
||||
"engines": {
|
||||
"node": ">= 0.6.4"
|
||||
}
|
||||
}
|
||||
|
||||
8
node_modules/forever/node_modules/flatiron/examples/socket.io/index.html
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script>
|
||||
var socket = io.connect('http://localhost');
|
||||
socket.on('news', function (data) {
|
||||
console.log(data);
|
||||
socket.emit('my other event', { my: 'data' });
|
||||
});
|
||||
</script>
|
||||
38
node_modules/forever/node_modules/flatiron/examples/socket.io/server.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// Socket.io configuration for Flatiron
|
||||
// -------------------------------------------------- //
|
||||
|
||||
var flatiron = require('../../lib/flatiron'),
|
||||
fs = require("fs"),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.http, {
|
||||
before: [function (req, res) {
|
||||
fs.readFile(__dirname + '/index.html', function (err, data) {
|
||||
if (err) {
|
||||
res.writeHead(500);
|
||||
return res.end('Error loading index.html');
|
||||
}
|
||||
res.writeHead(200);
|
||||
res.end(data);
|
||||
});
|
||||
|
||||
}]
|
||||
});
|
||||
|
||||
|
||||
// Set the server to listen on port `8080`.
|
||||
// It is important to do this first, as app.server
|
||||
// isn't actually created until you start()
|
||||
app.start(8080);
|
||||
|
||||
// Socket.io
|
||||
// -------------------------------------------------- //
|
||||
|
||||
var io = require('socket.io').listen(app.server);
|
||||
|
||||
io.sockets.on('connection', function(socket) {
|
||||
socket.emit('news', { hello: 'world' });
|
||||
socket.on('my other event', function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
12
node_modules/forever/node_modules/flatiron/examples/static-app/app.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
var flatiron = require('../../lib/flatiron'),
|
||||
app = flatiron.app;
|
||||
|
||||
app.use(flatiron.plugins.http);
|
||||
app.use(flatiron.plugins.static, { root: __dirname });
|
||||
|
||||
app.router.get('/headers', function () {
|
||||
this.res.json(this.req.headers);
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
1
node_modules/forever/node_modules/flatiron/examples/static-app/app/assets/style.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
body { color: lime; background-color: black; }
|
||||
1
node_modules/forever/node_modules/flatiron/examples/static-app/app/assets/style.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
document.write('Hello World!');
|
||||
15
node_modules/forever/node_modules/flatiron/examples/static-app/package.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "static-app",
|
||||
"description": "An example flatiron app using static plugin",
|
||||
"version": "0.1.0",
|
||||
"author": "Nodejitsu Inc. <info@nodejitsu.com>",
|
||||
"dependencies": {
|
||||
"flatiron": "0.3.x",
|
||||
"st": "0.1.0"
|
||||
},
|
||||
"main": "./app",
|
||||
"engines": {
|
||||
"node": ">= 0.6.4"
|
||||
}
|
||||
}
|
||||
|
||||
71
node_modules/forever/node_modules/flatiron/lib/flatiron.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* flatiron.js: An elegant blend of convention and configuration for building apps in Node.js and the browser.
|
||||
*
|
||||
* Copyright(c) 2011 Nodejitsu Inc. <info@nodejitsu.com>
|
||||
* MIT LICENCE
|
||||
*
|
||||
*/
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
broadway = require('broadway');
|
||||
|
||||
var flatiron = exports,
|
||||
_app;
|
||||
|
||||
//
|
||||
// ### Export core `flatiron` modules
|
||||
//
|
||||
flatiron.common = require('./flatiron/common');
|
||||
flatiron.constants = require('./flatiron/constants');
|
||||
flatiron.formats = broadway.formats;
|
||||
flatiron.App = require('./flatiron/app').App;
|
||||
flatiron.version = require('../package.json').version;
|
||||
|
||||
//
|
||||
// ### Expose core `flatiron` plugins
|
||||
// Hoist those up from `broadway` and define each of
|
||||
// the `flatiron` plugins as a lazy loaded `require` statement
|
||||
//
|
||||
flatiron.plugins = broadway.common.mixin(
|
||||
{},
|
||||
broadway.plugins,
|
||||
broadway.common.requireDirLazy(path.join(__dirname, 'flatiron', 'plugins'))
|
||||
);
|
||||
|
||||
|
||||
Object.defineProperty(flatiron, 'app', {
|
||||
|
||||
// Don't allow another `.defineProperty` on 'app'
|
||||
configurable: false,
|
||||
|
||||
//
|
||||
// ### getter @app {flatiron.App}
|
||||
// Gets the default top-level Application for `flatiron`
|
||||
//
|
||||
get: function() {
|
||||
return _app = _app || flatiron.createApp();
|
||||
},
|
||||
|
||||
//
|
||||
// #### setter @app {flatiron.App}
|
||||
// Options for the application to create or the application to set
|
||||
//
|
||||
set: function(value) {
|
||||
if (value instanceof flatiron.App) return _app = value;
|
||||
return _app = flatiron.createApp(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// ### function createApp (options)
|
||||
// #### @options {Object} Options for the application to create
|
||||
// Creates a new instance of `flatiron.App` with the
|
||||
// specified `options`.
|
||||
//
|
||||
flatiron.createApp = function (options) {
|
||||
return new flatiron.App(options);
|
||||
};
|
||||
|
||||
21
node_modules/forever/node_modules/flatiron/lib/flatiron/app.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* app.js: Core Application object for managing plugins and features in broadway
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
util = require('util'),
|
||||
broadway = require('broadway');
|
||||
|
||||
var App = exports.App = function (options) {
|
||||
broadway.App.call(this, options);
|
||||
};
|
||||
|
||||
//
|
||||
// Inherit from `broadway.App`.
|
||||
//
|
||||
util.inherits(App, broadway.App);
|
||||
105
node_modules/forever/node_modules/flatiron/lib/flatiron/cli/create.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
flatiron = require('../../flatiron'),
|
||||
common = flatiron.common,
|
||||
app = flatiron.app;
|
||||
|
||||
module.exports = function create(name, type, callback) {
|
||||
type = type || 'http';
|
||||
name = name || '';
|
||||
|
||||
var existsSync = fs.existsSync || path.existsSync,
|
||||
root = path.join(process.cwd(), name),
|
||||
scaffold = path.join(__dirname, '..', '..', '..', 'scaffolds', type),
|
||||
info = {};
|
||||
|
||||
if (!existsSync(scaffold)) {
|
||||
app.log.error('Scaffold named ' + type.yellow + ' does not exist');
|
||||
return callback();
|
||||
}
|
||||
|
||||
//
|
||||
// Prompts user for details about their app to put in `package.json`.
|
||||
//
|
||||
function prompt (next) {
|
||||
var fields = ['name', 'author', 'description', 'homepage'];
|
||||
app.prompt.override = {name: name};
|
||||
app.prompt.start();
|
||||
app.prompt.addProperties(info, fields, next);
|
||||
}
|
||||
|
||||
//
|
||||
// Creates directories specified in `/scaffolds/:type/directories.json`.
|
||||
//
|
||||
function createDirs(next) {
|
||||
var dirs = common.directories.normalize(
|
||||
common.mixin({}, flatiron.constants.DIRECTORIES, { '#ROOT': root }),
|
||||
JSON.parse(fs.readFileSync(path.join(scaffold, 'directories.json'), 'utf8'))
|
||||
);
|
||||
|
||||
Object.keys(dirs).forEach(function (name) {
|
||||
app.log.info('Creating directory ' + name.grey);
|
||||
});
|
||||
|
||||
common.directories.create(dirs, next);
|
||||
}
|
||||
|
||||
//
|
||||
// Creates files specified in `/scaffolds/:type/files.json`.
|
||||
//
|
||||
function createFiles(next) {
|
||||
var files = common.directories.normalize(
|
||||
common.mixin({}, flatiron.constants.DIRECTORIES, { '#ROOT': root }),
|
||||
JSON.parse(fs.readFileSync(path.join(scaffold, 'files.json'), 'utf8'))
|
||||
);
|
||||
|
||||
function copyFile(file, nextFile) {
|
||||
app.log.info('Writing file ' + file.grey);
|
||||
common.cpr(path.join(scaffold, file), files[file], nextFile);
|
||||
}
|
||||
|
||||
common.async.mapSeries(Object.keys(files), copyFile, next);
|
||||
}
|
||||
|
||||
//
|
||||
// Creates a templated package.json from `/scaffolds/:type/package.json`.
|
||||
//
|
||||
function createPackage(next) {
|
||||
var pkg = JSON.parse(fs.readFileSync(path.join(scaffold, 'package.json'), 'utf8'));
|
||||
|
||||
pkg.dependencies.flatiron = flatiron.version;
|
||||
|
||||
flatiron.common.mixin(pkg, info);
|
||||
|
||||
app.log.info('Writing ' + 'package.json'.grey);
|
||||
fs.writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2) + '\n', next);
|
||||
}
|
||||
|
||||
app.log.info('Creating application ' + (name ? name.magenta : ''));
|
||||
app.log.info('Using ' + type.yellow + ' scaffold.');
|
||||
common.async.series([
|
||||
prompt,
|
||||
createDirs,
|
||||
createPackage,
|
||||
createFiles
|
||||
], function onComplete(err) {
|
||||
if (err) {
|
||||
if (err.message === 'canceled') {
|
||||
// Start a new line to make the cancel look pretty.
|
||||
return process.stdout.write('\n');
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
app.log.info('Application ' + info.name.magenta + ' is now ready');
|
||||
callback();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.usage = [
|
||||
'Generates a flatiron skeleton application. If no <type>',
|
||||
'is specified an HTTP application will be created.',
|
||||
'<type> can currently be either cli or http',
|
||||
'',
|
||||
'create <app-name> <type>',
|
||||
];
|
||||
52
node_modules/forever/node_modules/flatiron/lib/flatiron/common.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* common.js: Common utility functions for flatiron.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var fs = require('fs'),
|
||||
broadway = require('broadway');
|
||||
|
||||
//
|
||||
// Hoist `broadway.common` to `flatiron.common`.
|
||||
//
|
||||
var common = module.exports = broadway.common.mixin({}, broadway.common);
|
||||
|
||||
//
|
||||
// ### function templateUsage (app, commands)
|
||||
// Updates the references to `<app>` to `app.name` in usage for the
|
||||
// specified `commands`.
|
||||
//
|
||||
common.templateUsage = function (app, commands) {
|
||||
if (!app.name) {
|
||||
return commands;
|
||||
}
|
||||
|
||||
function templateUsage(usage) {
|
||||
return usage.map(function (line) {
|
||||
return line.replace(/\<app\>/ig, app.name);
|
||||
});
|
||||
}
|
||||
|
||||
Object.keys(commands).forEach(function (command) {
|
||||
if (command === 'usage') {
|
||||
commands.usage = templateUsage(commands.usage);
|
||||
}
|
||||
else if (commands[command].usage) {
|
||||
commands[command].usage = templateUsage(commands[command].usage);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// ### function tryReaddirSync (dir)
|
||||
// #### @dir {string} Directory to attempt to list
|
||||
//
|
||||
// Attempts to call `fs.readdirSync` but ignores errors.
|
||||
//
|
||||
common.tryReaddirSync = function (dir) {
|
||||
try { return fs.readdirSync(dir) }
|
||||
catch (err) { return [] }
|
||||
};
|
||||
19
node_modules/forever/node_modules/flatiron/lib/flatiron/constants.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* constants.js: Constants within the Flatiron framework.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var constants = exports;
|
||||
|
||||
constants.DIRECTORIES = {
|
||||
"#ENV": "#CONFIG/env",
|
||||
"#APP": "#ROOT/app",
|
||||
"#CONFIG": "#ROOT/config",
|
||||
"#DOCS": "#ROOT/docs",
|
||||
"#LOG": "#ROOT/log",
|
||||
"#LIB": "#ROOT/lib",
|
||||
"#TEST": "#ROOT/test"
|
||||
};
|
||||
454
node_modules/forever/node_modules/flatiron/lib/flatiron/plugins/cli.js
generated
vendored
Normal file
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
* index.js: Top-level plugin exposing CLI features in flatiron
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
flatiron = require('../../flatiron'),
|
||||
common = flatiron.common,
|
||||
director = require('director');
|
||||
|
||||
//
|
||||
// ### Name this plugin
|
||||
//
|
||||
exports.name = 'cli';
|
||||
|
||||
//
|
||||
// ### function attach (options, done)
|
||||
// #### @options {Object} Options for this plugin
|
||||
// Initializes `this` (the application) with the core `cli` plugins consisting of:
|
||||
// `argv`, `prompt`, `routing`, `commands` in that order.
|
||||
//
|
||||
exports.attach = function (options) {
|
||||
var app = this;
|
||||
options = options || {};
|
||||
|
||||
//
|
||||
// Define the `cli` namespace on the app for later use
|
||||
//
|
||||
app.cli = app.cli || {};
|
||||
|
||||
//
|
||||
// Mixin some keys properly so that plugins can also set them
|
||||
//
|
||||
options.argv = common.mixin({}, app.cli.argv || {}, options.argv || {});
|
||||
options.prompt = common.mixin({}, app.cli.prompt || {}, options.prompt || {});
|
||||
|
||||
app.cli = common.mixin({}, app.cli, options);
|
||||
|
||||
if (app.cli.notFoundUsage == undefined) {
|
||||
app.cli.notFoundUsage = true;
|
||||
}
|
||||
|
||||
//
|
||||
// Setup `this.argv` to use `optimist`.
|
||||
//
|
||||
exports.argv.call(this, app.cli.argv);
|
||||
app.use(flatiron.plugins.inspect);
|
||||
|
||||
//
|
||||
// If `options.version` is truthy, `app.version` is defined and `-v` or
|
||||
// `--version` command line parameters were passed, print out `app.version`
|
||||
// and exit.
|
||||
//
|
||||
if (app.cli.version && app.version && (this.argv.v || this.argv.version)) {
|
||||
console.log(app.version);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
//
|
||||
// Setup `this.prompt`.
|
||||
//
|
||||
exports.prompt.call(this, app.cli.prompt);
|
||||
|
||||
//
|
||||
// Setup `app.router` and associated core routing method.
|
||||
//
|
||||
app.router = new director.cli.Router().configure({
|
||||
async: app.async || app.cli.async
|
||||
});
|
||||
|
||||
app.start = function (options, callback) {
|
||||
if (!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
callback = callback || function () {};
|
||||
app.init(options, function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
app.router.dispatch('on', app.argv._.join(' '), app.log, callback);
|
||||
});
|
||||
};
|
||||
|
||||
app.cmd = function (path, handler) {
|
||||
app.router.on(path, handler);
|
||||
};
|
||||
|
||||
exports.commands.call(this);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function init (done)
|
||||
// #### @done {function} Continuation to respond to when complete
|
||||
// Initializes this plugin by setting `winston.cli` (i.e. `app.log.cli`)
|
||||
// to enable colors and padded levels.
|
||||
//
|
||||
exports.init = function (done) {
|
||||
var app = this,
|
||||
logger;
|
||||
|
||||
if (!app.log.help) {
|
||||
logger = app.log.get('default');
|
||||
logger.cli().extend(app.log);
|
||||
}
|
||||
|
||||
if (app.config) {
|
||||
//
|
||||
// Create a literal store for argv to
|
||||
// avoid re-parsing CLI options.
|
||||
//
|
||||
app.config.use('argv', {
|
||||
type: 'literal',
|
||||
store: app.argv
|
||||
});
|
||||
|
||||
app.config.env();
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
//
|
||||
// ### function argv (options)
|
||||
// #### @options {Object} Pass-thru options for optimist
|
||||
// Sets up `app.argv` using `optimist` and the specified options.
|
||||
//
|
||||
exports.argv = function (options) {
|
||||
var optimist = require('optimist').string('_');
|
||||
|
||||
if (options && Object.keys(options).length) {
|
||||
optimist = optimist.options(options);
|
||||
this.showOptions = optimist.help;
|
||||
this.argv = optimist.argv;
|
||||
}
|
||||
else {
|
||||
this.showOptions = optimist.help;
|
||||
this.argv = optimist.argv;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ### function commands (options)
|
||||
// #### @options {Object} Options for the application commands
|
||||
// Configures the `app.commands` object which is lazy-loaded from disk
|
||||
// along with some default logic for: `help` and `alias`.
|
||||
//
|
||||
exports.commands = function (options) {
|
||||
var app = this;
|
||||
|
||||
function showUsage(target) {
|
||||
target = Array.isArray(target) ? target : target.split('\n');
|
||||
target.forEach(function (line) {
|
||||
app.log.help(line);
|
||||
});
|
||||
|
||||
var lines = app.showOptions().split('\n').filter(Boolean);
|
||||
|
||||
if (lines.length) {
|
||||
app.log.help('');
|
||||
lines.forEach(function (line) {
|
||||
app.log.help(line);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Setup any pass-thru options to the
|
||||
// application instance but make them lazy
|
||||
//
|
||||
app.usage = app.cli.usage;
|
||||
app.cli.source = app.cli.dir || app.cli.source;
|
||||
app.commands = app.commands || {};
|
||||
|
||||
//
|
||||
// Helper function which loads the file for the
|
||||
// specified `name` into `app.commands`.
|
||||
//
|
||||
function loadCommand(name, command, silent) {
|
||||
var resource = app.commands[name];
|
||||
var usage = app.usage || [
|
||||
name
|
||||
? 'Cannot find commands for ' + name.magenta
|
||||
: 'Cannot find commands'
|
||||
];
|
||||
|
||||
if (resource && (!command || resource[command])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (app.cli.source) {
|
||||
if (!app.cli.sourceDir) {
|
||||
try {
|
||||
var stats = fs.statSync(app.cli.source);
|
||||
app.cli.sourceDir = stats.isDirectory();
|
||||
}
|
||||
catch (ex) {
|
||||
if (app.cli.notFoundUsage) {
|
||||
showUsage(usage)
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (app.cli.sourceDir) {
|
||||
app.commands[name] = require(path.join(app.cli.source, name || ''));
|
||||
}
|
||||
else {
|
||||
app.commands = common.mixin(app.commands, require(app.cli.source));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
// If that file could not be found, error message should start with
|
||||
// "Cannot find module" and contain the name of the file we tried requiring.
|
||||
if (!err.message.match(/^Cannot find module/) || (name && err.message.indexOf(name) === -1)) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
if (app.cli.notFoundUsage) {
|
||||
showUsage(usage);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Helper function to ensure the user wishes to execute
|
||||
// a destructive command.
|
||||
//
|
||||
function ensureDestroy(callback) {
|
||||
app.prompt.get(['destroy'], function (err, result) {
|
||||
if (result.destroy !== 'yes' && result.destroy !== 'y') {
|
||||
app.log.warn('Destructive operation cancelled');
|
||||
return callback(true);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Helper function which executes the command
|
||||
// represented by the Array of `parts` passing
|
||||
// control to the `callback`.
|
||||
//
|
||||
function executeCommand(parts, callback) {
|
||||
var name,
|
||||
shouldLoad = true,
|
||||
command,
|
||||
usage;
|
||||
|
||||
if (typeof parts === 'undefined' || typeof parts === 'function') {
|
||||
throw(new Error('parts is a required argument of type Array'));
|
||||
}
|
||||
|
||||
name = parts.shift();
|
||||
|
||||
if (app.cli.source || app.commands[name]) {
|
||||
if (app.commands[name]) {
|
||||
shouldLoad = false;
|
||||
if (typeof app.commands[name] != 'function' && !app.commands[name][parts[0]]) {
|
||||
shouldLoad = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldLoad && !loadCommand(name, parts[0])) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
command = app.commands[name];
|
||||
while (command) {
|
||||
usage = command.usage;
|
||||
|
||||
if (!app.argv.h && !app.argv.help && typeof command === 'function') {
|
||||
while (parts.length + 1 < command.length) {
|
||||
parts.push(null);
|
||||
}
|
||||
|
||||
if (command.destructive) {
|
||||
return ensureDestroy(function (err) {
|
||||
return err ? callback() : command.apply(app, parts.concat(callback));
|
||||
})
|
||||
}
|
||||
|
||||
command.apply(app, parts.concat(callback));
|
||||
return;
|
||||
}
|
||||
|
||||
command = command[parts.shift()];
|
||||
}
|
||||
|
||||
//
|
||||
// Since we have not resolved a needle, try and print out a usage message
|
||||
//
|
||||
if (usage || app.cli.usage) {
|
||||
showUsage(usage || app.cli.usage);
|
||||
callback(false);
|
||||
}
|
||||
}
|
||||
else if (app.usage) {
|
||||
//
|
||||
// If there's no directory we're supposed to search for modules, simply
|
||||
// print out usage notice if it's provided.
|
||||
//
|
||||
showUsage(app.cli.usage);
|
||||
callback(true);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Expose the executeCommand method
|
||||
//
|
||||
exports.executeCommand = executeCommand;
|
||||
|
||||
//
|
||||
// Allow commands to be aliased to subcomponents. e.g.
|
||||
//
|
||||
// app.alias('list', { resource: 'apps', command: 'list' });
|
||||
// app.alias('new', { command: 'create' });
|
||||
// app.alias('new', 'create');
|
||||
//
|
||||
app.alias = function (target, source) {
|
||||
app.commands.__defineGetter__(target, function () {
|
||||
|
||||
var resource = source.resource || source.command || source,
|
||||
command = source.resource ? source.command : null;
|
||||
|
||||
loadCommand(resource, command, true);
|
||||
resource = app.commands[resource];
|
||||
|
||||
if (resource) {
|
||||
return source.resource && source.command
|
||||
? resource[source.command]
|
||||
: resource;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// Set the `loadCommand` function to run
|
||||
// whenever the router has not matched
|
||||
// the CLI arguments, `process.argv`.
|
||||
//
|
||||
app.router.notfound = function (callback) {
|
||||
executeCommand(app.argv._.slice(), callback);
|
||||
};
|
||||
|
||||
//
|
||||
// Setup default help command
|
||||
//
|
||||
app.cmd(/help ([^\s]+)?\s?([^\s]+)?/, app.showHelp = function showHelp() {
|
||||
var args = Array.prototype.slice.call(arguments).filter(Boolean),
|
||||
callback = typeof args[args.length - 1] === 'function' && args.pop(),
|
||||
resource,
|
||||
usage;
|
||||
|
||||
function displayAndRespond(found) {
|
||||
showUsage(usage || app.usage);
|
||||
if (!found) {
|
||||
app.log.warn('Cannot find help for ' + args.join(' ').magenta);
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadCommand(args[0], args[1], true)) {
|
||||
return displayAndRespond(false);
|
||||
}
|
||||
|
||||
resource = app.commands[args[0]];
|
||||
usage = resource.usage;
|
||||
|
||||
for (var i = 1; i < args.length; i++) {
|
||||
if (!resource[args[i]]) {
|
||||
return displayAndRespond(false);
|
||||
}
|
||||
else if (resource[args[i]].usage) {
|
||||
resource = resource[args[i]];
|
||||
usage = resource.usage;
|
||||
}
|
||||
}
|
||||
|
||||
displayAndRespond(true);
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// ### function prompt (options)
|
||||
// #### @options {Object} Options for the prompt.
|
||||
// Sets up the application `prompt` property to be a lazy
|
||||
// setting which loads the `prompt` module.
|
||||
//
|
||||
exports.prompt = function (options) {
|
||||
options = options || {};
|
||||
|
||||
this.__defineGetter__('prompt', function () {
|
||||
if (!this._prompt) {
|
||||
//
|
||||
// Pass-thru any prompt specific options that are supplied.
|
||||
//
|
||||
var prompt = require('prompt'),
|
||||
self = this;
|
||||
|
||||
prompt.allowEmpty = options.allowEmpty || prompt.allowEmpty;
|
||||
prompt.message = options.message || prompt.message;
|
||||
prompt.delimiter = options.delimiter || prompt.delimiter;
|
||||
prompt.properties = options.properties || prompt.properties;
|
||||
|
||||
//
|
||||
// Setup `destroy` property for destructive commands
|
||||
//
|
||||
prompt.properties.destroy = {
|
||||
name: 'destroy',
|
||||
message: 'This operation cannot be undone, Would you like to proceed?',
|
||||
default: 'yes'
|
||||
};
|
||||
|
||||
//
|
||||
// Hoist up any prompt specific events and re-emit them as
|
||||
// `prompt::*` events.
|
||||
//
|
||||
['start', 'pause', 'resume', 'prompt', 'invalid'].forEach(function (ev) {
|
||||
prompt.on(ev, function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
self.emit.apply(self, [['prompt', ev]].concat(args));
|
||||
});
|
||||
});
|
||||
|
||||
//
|
||||
// Extend `this` (the application) with prompt functionality
|
||||
// and open `stdin`.
|
||||
//
|
||||
this._prompt = prompt;
|
||||
this._prompt.start().pause();
|
||||
}
|
||||
|
||||
return this._prompt;
|
||||
});
|
||||
};
|
||||
104
node_modules/forever/node_modules/flatiron/lib/flatiron/plugins/http.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* http.js: Top-level plugin exposing HTTP features in flatiron
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var director = require('director'),
|
||||
flatiron = require('../../flatiron'),
|
||||
union;
|
||||
|
||||
try {
|
||||
//
|
||||
// Attempt to require union.
|
||||
//
|
||||
union = require('union');
|
||||
}
|
||||
catch (ex) {
|
||||
//
|
||||
// Do nothing since this is a progressive enhancement
|
||||
//
|
||||
console.warn('flatiron.plugins.http requires the `union` module from npm');
|
||||
console.warn('install using `npm install union`.');
|
||||
console.trace();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Name this plugin.
|
||||
//
|
||||
exports.name = 'http';
|
||||
|
||||
exports.attach = function (options) {
|
||||
var app = this;
|
||||
|
||||
//
|
||||
// Define the `http` namespace on the app for later use
|
||||
//
|
||||
app.http = app.http || {};
|
||||
|
||||
app.http = flatiron.common.mixin({}, app.http, options || {});
|
||||
|
||||
app.http.route = flatiron.common.mixin({ async: true }, app.http.route || {});
|
||||
|
||||
app.http.buffer = (app.http.buffer !== false);
|
||||
app.http.before = app.http.before || [];
|
||||
app.http.after = app.http.after || [];
|
||||
app.http.headers = app.http.headers || {
|
||||
'x-powered-by': 'flatiron ' + flatiron.version
|
||||
};
|
||||
|
||||
app.router = new director.http.Router().configure(app.http.route);
|
||||
|
||||
app.start = function (port, host, callback) {
|
||||
if (!callback && typeof host === 'function') {
|
||||
callback = host;
|
||||
host = null;
|
||||
}
|
||||
|
||||
app.createServer();
|
||||
|
||||
app.init(function (err) {
|
||||
if (err) {
|
||||
if (callback) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
app.listen(port, host, callback);
|
||||
});
|
||||
};
|
||||
|
||||
app.createServer = function(){
|
||||
app.server = union.createServer({
|
||||
buffer: app.http.buffer,
|
||||
after: app.http.after,
|
||||
before: app.http.before.concat(function (req, res) {
|
||||
if (!app.router.dispatch(req, res, app.http.onError || union.errorHandler)) {
|
||||
if (!app.http.onError) res.emit('next');
|
||||
}
|
||||
}),
|
||||
headers: app.http.headers,
|
||||
limit: app.http.limit,
|
||||
https: app.http.https,
|
||||
spdy: app.http.spdy
|
||||
});
|
||||
};
|
||||
|
||||
app.listen = function (port, host, callback) {
|
||||
if (!callback && typeof host === 'function') {
|
||||
callback = host;
|
||||
host = null;
|
||||
}
|
||||
|
||||
if (!app.server) app.createServer();
|
||||
|
||||
return host
|
||||
? app.server.listen(port, host, callback)
|
||||
: app.server.listen(port, callback);
|
||||
};
|
||||
};
|
||||
125
node_modules/forever/node_modules/flatiron/lib/flatiron/plugins/resourceful.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* resourceful.js: Top-level plugin exposing resourceful to flatiron app
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
flatiron = require('../../flatiron'),
|
||||
common = flatiron.common,
|
||||
resourceful,
|
||||
existsSync = fs.existsSync || path.existsSync;
|
||||
|
||||
try {
|
||||
//
|
||||
// Attempt to require resourceful.
|
||||
//
|
||||
resourceful = require('resourceful');
|
||||
}
|
||||
catch (ex) {
|
||||
//
|
||||
// Do nothing since this is a progressive enhancement
|
||||
//
|
||||
console.warn('flatiron.plugins.resourceful requires the `resourceful` module from npm');
|
||||
console.warn('install using `npm install resourceful`.');
|
||||
console.trace();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
exports.name = 'resourceful';
|
||||
|
||||
exports.attach = function (options) {
|
||||
var app = this;
|
||||
options = options || {};
|
||||
|
||||
//
|
||||
// Accept string `options`.
|
||||
//
|
||||
if (typeof options === 'string') {
|
||||
options = { root: options };
|
||||
}
|
||||
|
||||
//
|
||||
// Create `app.resources` if it does not exist already.
|
||||
//
|
||||
app.resources = app.resources || {};
|
||||
|
||||
//
|
||||
// Expose a couple of resourceful helpers
|
||||
//
|
||||
app.define = resourceful.define;
|
||||
|
||||
//
|
||||
// Lazy-load the resources directory based on a few intelligent defaults:
|
||||
//
|
||||
// * `options.dir`: Explicit path to resources directory
|
||||
// * `options.root`: Relative root to the resources directory ('/app/resources')
|
||||
// * `app.root`: Relative root to the resources directory ('/app/resources')
|
||||
//
|
||||
if (options.dir || options.root || app.root) {
|
||||
app._resourceDir = options.dir
|
||||
|| path.join(options.root || app.root, 'app', 'resources');
|
||||
|
||||
try {
|
||||
existsSync(app._resourceDir)
|
||||
}
|
||||
catch (err) {
|
||||
//
|
||||
// If an invalid path has been provided, don't attempt to load it
|
||||
//
|
||||
console.error('invalid resource path: ' + app._resourceDir);
|
||||
return;
|
||||
}
|
||||
|
||||
var files = common.tryReaddirSync(app._resourceDir);
|
||||
|
||||
if (files.length === 0) {
|
||||
//
|
||||
// If no resources were found in the path, warn, but don't error
|
||||
//
|
||||
console.warn('no resources found at: ' + app._resourceDir);
|
||||
}
|
||||
|
||||
files.forEach(function (file) {
|
||||
file = file.replace('.js', '');
|
||||
app.resources.__defineGetter__(common.capitalize(file), function () {
|
||||
delete app.resources[common.capitalize(file)];
|
||||
return app.resources[common.capitalize(file)] = require(
|
||||
path.resolve(app._resourceDir, file)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
//
|
||||
// TODO: Determine how best to integrate `restful` here.
|
||||
//
|
||||
};
|
||||
|
||||
exports.init = function (done) {
|
||||
var app = this,
|
||||
options;
|
||||
|
||||
//
|
||||
// Attempt to merge defaults passed to `app.use(flatiron.plugins.resourceful)`
|
||||
// with any additional configuration that may have been loaded.
|
||||
//
|
||||
options = common.mixin(
|
||||
{},
|
||||
app.options['resourceful'],
|
||||
app.config.get('resourceful') || app.config.get('database') || {}
|
||||
);
|
||||
|
||||
app.config.set('resourceful', options);
|
||||
|
||||
//
|
||||
// Remark: Should we accept the autoMigrate option?
|
||||
//
|
||||
if (options.engine) {
|
||||
resourceful.use(options.engine, options);
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
87
node_modules/forever/node_modules/flatiron/lib/flatiron/plugins/static.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* static.js: Top-level plugin exposing st's static server to flatiron app
|
||||
*
|
||||
* (C) 2012, Nodejitsu, Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var path = require('path'),
|
||||
flatiron = require('../../flatiron'),
|
||||
common = flatiron.common, st;
|
||||
|
||||
try {
|
||||
//
|
||||
// Attempt to require st.
|
||||
//
|
||||
st = require('st');
|
||||
}
|
||||
catch (ex) {
|
||||
//
|
||||
// Do nothing since this is a progressive enhancement
|
||||
//
|
||||
console.warn('flatiron.plugins.static requires the `st` module from npm');
|
||||
console.warn('install using `npm install st`.');
|
||||
console.trace();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
exports.name = 'static';
|
||||
|
||||
exports.attach = function (options) {
|
||||
var app = this;
|
||||
|
||||
options = options || {};
|
||||
|
||||
//
|
||||
// Accept string `options`
|
||||
//
|
||||
if (typeof options === 'string') {
|
||||
options = { root: options };
|
||||
}
|
||||
|
||||
//
|
||||
// Default overrides
|
||||
//
|
||||
options.passthrough = true;
|
||||
|
||||
//
|
||||
// Url for static server
|
||||
//
|
||||
options.index = options.index || false;
|
||||
options.dot = options.dot || false;
|
||||
options.url = options.url || '/';
|
||||
|
||||
//
|
||||
// Attempt to merge defaults passed to `app.use(flatiron.plugins.static)`
|
||||
// with any additional configuration that may have been loaded
|
||||
options = common.mixin(
|
||||
{},
|
||||
options,
|
||||
app.config.get('static') || {}
|
||||
);
|
||||
|
||||
app.config.set('static', options);
|
||||
|
||||
//
|
||||
// `app.static` api to be used by other plugins
|
||||
// to server static files
|
||||
//
|
||||
app.static = function (dir) {
|
||||
options.path = dir;
|
||||
app.http.before = app.http.before.concat(st(options));
|
||||
}
|
||||
|
||||
// * `options.dir`: Explicit path to assets directory
|
||||
// * `options.root`: Relative root to the assets directory ('/app/assets')
|
||||
// * `app.root`: Relative root to the assets directory ('/app/assets')
|
||||
if (options.dir || options.root || app.root) {
|
||||
app._staticDir = options.dir
|
||||
|| path.join(options.root || app.root, 'app', 'assets');
|
||||
|
||||
//
|
||||
// Serve staticDir using middleware in union
|
||||
//
|
||||
app.static(app._staticDir);
|
||||
}
|
||||
}
|
||||
4
node_modules/forever/node_modules/flatiron/node_modules/broadway/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
.DS_Store
|
||||
|
||||
10
node_modules/forever/node_modules/flatiron/node_modules/broadway/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
notifications:
|
||||
email:
|
||||
- travis@nodejitsu.com
|
||||
irc: "irc.freenode.org#nodejitsu"
|
||||
|
||||
19
node_modules/forever/node_modules/flatiron/node_modules/broadway/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2011 Nodejitsu Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
124
node_modules/forever/node_modules/flatiron/node_modules/broadway/README.md
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# broadway [](http://travis-ci.org/flatiron/broadway)
|
||||
|
||||
*Lightweight application extensibility and composition with a twist of feature
|
||||
reflection.*
|
||||
|
||||
## Example
|
||||
|
||||
### app.js
|
||||
```js
|
||||
var broadway = require("broadway");
|
||||
|
||||
var app = new broadway.App();
|
||||
|
||||
// Passes the second argument to `helloworld.attach`.
|
||||
app.use(require("./plugins/helloworld"), { "delimiter": "!" } );
|
||||
|
||||
app.init(function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.hello("world");
|
||||
```
|
||||
|
||||
### plugins/helloworld.js
|
||||
|
||||
```js
|
||||
// `exports.attach` gets called by broadway on `app.use`
|
||||
exports.attach = function (options) {
|
||||
|
||||
this.hello = function (world) {
|
||||
console.log("Hello "+ world + options.delimiter || ".");
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// `exports.init` gets called by broadway on `app.init`.
|
||||
exports.init = function (done) {
|
||||
|
||||
// This plugin doesn't require any initialization step.
|
||||
return done();
|
||||
|
||||
};
|
||||
```
|
||||
|
||||
### run it!
|
||||
|
||||
```bash
|
||||
josh@onix:~/dev/broadway/examples$ node simple/app.js
|
||||
Hello world!
|
||||
josh@onix:~/dev/broadway/examples$
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing npm (node package manager)
|
||||
``` bash
|
||||
$ curl http://npmjs.org/install.sh | sh
|
||||
```
|
||||
|
||||
### Installing broadway
|
||||
``` bash
|
||||
$ [sudo] npm install broadway
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### App#init(callback)
|
||||
|
||||
Initialize application and it's plugins, `callback` will be called with null or
|
||||
initialization error as first argument.
|
||||
|
||||
### App#use(plugin, options)
|
||||
|
||||
Attach plugin to application. `plugin` should conform to following interface:
|
||||
|
||||
```javascript
|
||||
var plugin = {
|
||||
"name": "example-plugin", // Plugin's name
|
||||
|
||||
"attach": function attach(options) {
|
||||
// Called with plugin options once plugin attached to application
|
||||
// `this` - is a reference to application
|
||||
},
|
||||
|
||||
"detach": function detach() {
|
||||
// Called when plugin detached from application
|
||||
// (Only if plugin with same name was attached)
|
||||
// `this` - is a reference to application
|
||||
},
|
||||
|
||||
"init": function init(callback) {
|
||||
// Called on application initialization
|
||||
// App#init(callback) will be called once every plugin will call `callback`
|
||||
// `this` - is a reference to application
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### App#on(event, callback) and App#emit(event, data)
|
||||
|
||||
App inherits from [EventEmitter2][2], and many plugins build on this
|
||||
functionality.
|
||||
|
||||
#### Built-In Events:
|
||||
|
||||
* `error:init`: Broadway emits this event when it throws an error while attempting to initialize.
|
||||
|
||||
Read the [EventEmitter2][2] documentation for more information.
|
||||
|
||||
## Tests
|
||||
All tests are written with [vows][0] and should be run with [npm][1]:
|
||||
|
||||
``` bash
|
||||
$ npm test
|
||||
```
|
||||
|
||||
#### [Charlie Robbins](http://nodejitsu.com)
|
||||
#### License: MIT
|
||||
|
||||
[0]: http://vowsjs.org
|
||||
[1]: http://npmjs.org
|
||||
[2]: https://github.com/hij1nx/EventEmitter2
|
||||
66
node_modules/forever/node_modules/flatiron/node_modules/broadway/bin/build
generated
vendored
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var Codesurgeon = require('codesurgeon').Codesurgeon;
|
||||
var surgeon = new Codesurgeon;
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var root = path.join(__dirname, '..');
|
||||
var lib = path.join(root, 'lib', 'broadway');
|
||||
|
||||
//
|
||||
// Distill and package the browser version.
|
||||
//
|
||||
surgeon
|
||||
//
|
||||
.configure({
|
||||
package: root + '/package.json',
|
||||
owner: 'Nodejitsu, Inc (Using Codesurgeon).'
|
||||
})
|
||||
.read(
|
||||
path.join(root, 'node_modules', 'eventemitter2', 'lib', 'eventemitter2.js'),
|
||||
path.join(lib, 'browser.js')
|
||||
)
|
||||
//
|
||||
// we want everything so far. specify extract with no
|
||||
// parameters to get everything into the output buffer.
|
||||
//
|
||||
.extract()
|
||||
//
|
||||
// clear the input so far, but don't clear the output.
|
||||
//
|
||||
.clear('inputs')
|
||||
//
|
||||
// read the `app.js` file
|
||||
//
|
||||
.read(
|
||||
path.join(lib, 'app.js')
|
||||
)
|
||||
//
|
||||
// the current input buffer contains stuff that we dont
|
||||
// want in the browser build, so let's cherry pick from
|
||||
// the buffer.
|
||||
//
|
||||
.extract(
|
||||
'App.prototype.init',
|
||||
'App.prototype.use',
|
||||
'App.prototype.remove',
|
||||
'App.prototype.inspect'
|
||||
)
|
||||
//
|
||||
// wrap everything that is in the current buffer with a
|
||||
// closure so that we dont get any collisions with other
|
||||
// libraries
|
||||
//
|
||||
.wrap()
|
||||
//
|
||||
// write the debuggable version of the file. This file will
|
||||
// get renamed to include the version from the package.json
|
||||
//
|
||||
.write(root + '/build/broadway.js')
|
||||
//
|
||||
// now lets make a minified version for production use.
|
||||
//
|
||||
.uglify()
|
||||
.write(root + '/build/broadway.min.js')
|
||||
;
|
||||
12
node_modules/forever/node_modules/flatiron/node_modules/broadway/examples/browser/app.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
var app = new App();
|
||||
|
||||
app.use(HelloWorld, { "delimiter": "!" } );
|
||||
|
||||
app.init(function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.hello("world");
|
||||
11
node_modules/forever/node_modules/flatiron/node_modules/broadway/examples/browser/index.html
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Example</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript" src="broadway.js"></script>
|
||||
<script type="text/javascript" src="plugins/helloworld.js"></script>
|
||||
<script type="text/javascript" src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
23
node_modules/forever/node_modules/flatiron/node_modules/broadway/examples/browser/plugins/helloworld.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
window.HelloWorld = {};
|
||||
|
||||
//
|
||||
// `exports.attach` gets called by broadway on `app.use`
|
||||
//
|
||||
HelloWorld.attach = function (options) {
|
||||
|
||||
this.hello = function (world) {
|
||||
console.log("Hello "+ world + options.delimiter || ".");
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// `exports.init` gets called by broadway on `app.init`.
|
||||
//
|
||||
HelloWorld.init = function (done) {
|
||||
|
||||
//
|
||||
// This plugin doesn't require any initialization step.
|
||||
//
|
||||
return done();
|
||||
};
|
||||
17
node_modules/forever/node_modules/flatiron/node_modules/broadway/examples/nodejs/app.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var broadway = require('../../'),
|
||||
app = new broadway.App();
|
||||
|
||||
// Passes the second argument to `helloworld.attach`.
|
||||
app.use(require("./plugins/helloworld"), { "delimiter": "!" } );
|
||||
app.use(broadway.plugins.log, {
|
||||
logAll: true
|
||||
});
|
||||
|
||||
app.init(function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.hello("world");
|
||||
app.emit('world:hello', { meta: 'is here' });
|
||||
23
node_modules/forever/node_modules/flatiron/node_modules/broadway/examples/nodejs/plugins/helloworld.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
var HelloWorld = exports;
|
||||
|
||||
//
|
||||
// `exports.attach` gets called by broadway on `app.use`
|
||||
//
|
||||
HelloWorld.attach = function (options) {
|
||||
|
||||
this.hello = function (world) {
|
||||
console.log("Hello "+ world + options.delimiter || ".");
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// `exports.init` gets called by broadway on `app.init`.
|
||||
//
|
||||
HelloWorld.init = function (done) {
|
||||
|
||||
//
|
||||
// This plugin doesn't require any initialization step.
|
||||
//
|
||||
return done();
|
||||
};
|
||||
19
node_modules/forever/node_modules/flatiron/node_modules/broadway/lib/broadway.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* broadway.js: Top-level include for the broadway module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var path = require('path'),
|
||||
utile = require('utile');
|
||||
|
||||
var broadway = exports;
|
||||
|
||||
broadway.App = require('./broadway/app').App;
|
||||
broadway.common = require('./broadway/common');
|
||||
broadway.features = require('./broadway/features');
|
||||
broadway.formats = require('nconf').formats;
|
||||
broadway.plugins = utile.requireDirLazy(path.join(__dirname, 'broadway', 'plugins'));
|
||||
|
||||
225
node_modules/forever/node_modules/flatiron/node_modules/broadway/lib/broadway/app.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* app.js: Core Application object for managing plugins and features in broadway
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var utile = require('utile'),
|
||||
async = utile.async,
|
||||
events = require('eventemitter2'),
|
||||
bootstrapper = require('./bootstrapper'),
|
||||
common = require('./common'),
|
||||
features = require('./features');
|
||||
|
||||
var App = exports.App = function (options) {
|
||||
//
|
||||
// Setup options and `App` constants.
|
||||
//
|
||||
options = options || {};
|
||||
this.root = options.root;
|
||||
this.delimiter = options.delimiter || '::';
|
||||
|
||||
//
|
||||
// Inherit from `EventEmitter2`
|
||||
//
|
||||
events.EventEmitter2.call(this, {
|
||||
delimiter: this.delimiter,
|
||||
wildcard: true
|
||||
});
|
||||
|
||||
//
|
||||
// Setup other relevant options such as the plugins
|
||||
// for this instance.
|
||||
//
|
||||
this.options = options;
|
||||
this.env = options.env || process.env['NODE_ENV'] || 'development'
|
||||
this.plugins = options.plugins || {};
|
||||
this.initialized = false;
|
||||
this.bootstrapper = options.bootstrapper || bootstrapper;
|
||||
this.initializers = {};
|
||||
this.initlist = [];
|
||||
|
||||
//
|
||||
// Bootstrap this instance
|
||||
//
|
||||
this.bootstrapper.bootstrap(this);
|
||||
};
|
||||
|
||||
//
|
||||
// Inherit from `EventEmitter2`.
|
||||
//
|
||||
utile.inherits(App, events.EventEmitter2);
|
||||
|
||||
//
|
||||
// ### function init (options, callback)
|
||||
// #### @options {Object} **Optional** Additional options to initialize with.
|
||||
// #### @callback {function} Continuation to respond to when complete.
|
||||
// Initializes this instance by the following procedure:
|
||||
//
|
||||
// 1. Initializes all plugins (starting with `core`).
|
||||
// 2. Creates all directories in `this.config.directories` (if any).
|
||||
// 3. Ensures the files in the core directory structure conform to the
|
||||
// features required by this application.
|
||||
//
|
||||
App.prototype.init = function (options, callback) {
|
||||
if (!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (this.initialized) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
var self = this;
|
||||
options = options || {};
|
||||
callback = callback || function () {};
|
||||
this.env = options.env || this.env;
|
||||
this.options = common.mixin({}, this.options, options);
|
||||
|
||||
function onComplete() {
|
||||
self.initialized = true;
|
||||
self.emit('init');
|
||||
callback();
|
||||
}
|
||||
|
||||
function ensureFeatures (err) {
|
||||
return err
|
||||
? onError(err)
|
||||
: features.ensure(this, onComplete);
|
||||
}
|
||||
|
||||
function initPlugin(plugin, next) {
|
||||
if (typeof self.initializers[plugin] === 'function') {
|
||||
return self.initializers[plugin].call(self, function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
self.emit(['plugin', plugin, 'init']);
|
||||
self.initializers[plugin] = true;
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
function initPlugins() {
|
||||
async.forEach(self.initlist, initPlugin, ensureFeatures);
|
||||
}
|
||||
|
||||
//
|
||||
// Emit and respond with any errors that may short
|
||||
// circuit the process.
|
||||
//
|
||||
function onError(err) {
|
||||
self.emit(['error', 'init'], err);
|
||||
callback(err);
|
||||
}
|
||||
|
||||
//
|
||||
// Run the bootstrapper, initialize plugins, and
|
||||
// ensure features for this instance.
|
||||
//
|
||||
this.bootstrapper.init(this, initPlugins);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function use(plugin, callback)
|
||||
// Attachs the plugin with the specific name to this `App` instance.
|
||||
//
|
||||
App.prototype.use = function (plugin, options, callback) {
|
||||
options = options || {};
|
||||
|
||||
if (typeof plugin === 'undefined') {
|
||||
console.log('Cannot load invalid plugin!');
|
||||
return callback && callback(new Error('Invalid plugin'));
|
||||
}
|
||||
|
||||
var name = plugin.name,
|
||||
self = this;
|
||||
|
||||
// If the plugin doesn't have a name, use itself as an identifier for the plugins hash.
|
||||
if (!name) {
|
||||
name = common.uuid();
|
||||
}
|
||||
|
||||
if (this.plugins[name]) {
|
||||
return callback && callback();
|
||||
}
|
||||
|
||||
//
|
||||
// Setup state on this instance for the specified plugin
|
||||
//
|
||||
this.plugins[name] = plugin;
|
||||
this.options[name] = common.mixin({}, options, this.options[name] || {});
|
||||
|
||||
//
|
||||
// Attach the specified plugin to this instance, extending
|
||||
// the `App` with new functionality.
|
||||
//
|
||||
if (this.plugins[name].attach && options.attach !== false) {
|
||||
this.plugins[name].attach.call(this, options);
|
||||
}
|
||||
|
||||
//
|
||||
// Setup the initializer only if `options.init` is
|
||||
// not false. This allows for some plugins to be lazy-loaded
|
||||
//
|
||||
if (options.init === false) {
|
||||
return callback && callback();
|
||||
}
|
||||
|
||||
if (!this.initialized) {
|
||||
this.initializers[name] = plugin.init || true;
|
||||
this.initlist.push(name);
|
||||
return callback && callback();
|
||||
}
|
||||
else if (plugin.init) {
|
||||
plugin.init.call(this, function (err) {
|
||||
var args = err
|
||||
? [['plugin', name, 'error'], err]
|
||||
: [['plugin', name, 'init']];
|
||||
|
||||
self.emit.apply(self, args);
|
||||
return callback && (err ? callback(err) : callback());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ### function remove(name)
|
||||
// Detaches the plugin with the specific name from this `App` instance.
|
||||
//
|
||||
App.prototype.remove = function (name) {
|
||||
// if this is a plugin object set the name to the plugins name
|
||||
if (name.name) {
|
||||
name = name.name;
|
||||
}
|
||||
|
||||
if (this.plugins[name] && this.plugins[name].detach) {
|
||||
this.plugins[name].detach.call(this);
|
||||
}
|
||||
|
||||
delete this.plugins[name];
|
||||
delete this.options[name];
|
||||
delete this.initializers[name];
|
||||
|
||||
var init = this.initlist.indexOf(name);
|
||||
|
||||
if (init !== -1) {
|
||||
this.initlist.splice(1, init);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ### function inspect ()
|
||||
// Inspects the modules and features used by the current
|
||||
// application directory structure
|
||||
//
|
||||
App.prototype.inspect = function () {
|
||||
|
||||
};
|
||||
84
node_modules/forever/node_modules/flatiron/node_modules/broadway/lib/broadway/bootstrapper.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* bootstrapper.js: Default logic for bootstrapping broadway applications.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var broadway = require('../broadway');
|
||||
|
||||
//
|
||||
// ### bootstrap (app, callback)
|
||||
// #### @app {broadway.App} Application to bootstrap
|
||||
// #### @callback {function} Continuation to respond to when complete.
|
||||
// Bootstraps the specified `app`.
|
||||
//
|
||||
exports.bootstrap = function (app) {
|
||||
app.options['config'] = app.options['config'] || {};
|
||||
app.options['config'].init = false;
|
||||
app.use(broadway.plugins.config);
|
||||
|
||||
//
|
||||
// Remove initializers run by the bootstrapper.
|
||||
//
|
||||
delete app.initializers['config'];
|
||||
app.initlist.pop();
|
||||
|
||||
//
|
||||
// Set the current environment in the config
|
||||
//
|
||||
app.config.set('env', app.env);
|
||||
};
|
||||
|
||||
//
|
||||
// ### bootstrap (app, callback)
|
||||
// #### @app {broadway.App} Application to bootstrap
|
||||
// #### @callback {function} Continuation to respond to when complete.
|
||||
// Runs the initialization step of the bootstrapping process
|
||||
// for the specified `app`.
|
||||
//
|
||||
exports.init = function (app, callback) {
|
||||
broadway.plugins.config.init.call(app, function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (app.config.get('handleExceptions')) {
|
||||
app.use(broadway.plugins.exceptions, app.options['exceptions'] || {});
|
||||
}
|
||||
|
||||
app.use(broadway.plugins.directories, app.options['directories'] || {});
|
||||
app.use(broadway.plugins.log, app.options['log'] || {});
|
||||
|
||||
//
|
||||
// Ensure the `directories` and `log` plugins initialize before
|
||||
// any other plugins. Since we cannot depend on ordering (if they were
|
||||
// manually added) splice the specific indexes
|
||||
//
|
||||
var log = app.initlist.indexOf('log');
|
||||
app.initlist.unshift.apply(
|
||||
app.initlist,
|
||||
app.initlist.splice(log)
|
||||
);
|
||||
|
||||
var directories = app.initlist.indexOf('directories');
|
||||
app.initlist.unshift.apply(
|
||||
app.initlist,
|
||||
app.initlist.splice(directories)
|
||||
);
|
||||
|
||||
//
|
||||
// Put the godot plugin before the log if it exists
|
||||
//
|
||||
var godot = app.initlist.indexOf('godot');
|
||||
if(~godot) {
|
||||
app.initlist.unshift.apply(
|
||||
app.initlist,
|
||||
app.initlist.splice(godot)
|
||||
);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
75
node_modules/forever/node_modules/flatiron/node_modules/broadway/lib/broadway/browser.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
/*
|
||||
* browser.js: Browser specific functionality for broadway.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var id = 0;
|
||||
|
||||
var common = {
|
||||
mixin: function (target) {
|
||||
var objs = Array.prototype.slice.call(arguments, 1);
|
||||
objs.forEach(function (o) {
|
||||
Object.keys(o).forEach(function (attr) {
|
||||
var getter = o.__lookupGetter__(attr);
|
||||
if (!getter) {
|
||||
target[attr] = o[attr];
|
||||
}
|
||||
else {
|
||||
target.__defineGetter__(attr, getter);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return target;
|
||||
},
|
||||
uuid: function () {
|
||||
return String(id++);
|
||||
}
|
||||
};
|
||||
|
||||
var App = exports.App = function (options) {
|
||||
//
|
||||
// Setup options and `App` constants.
|
||||
//
|
||||
var self = this;
|
||||
options = options || {};
|
||||
this.root = options.root;
|
||||
this.delimiter = options.delimiter || '::';
|
||||
|
||||
//
|
||||
// Inherit from `EventEmitter2`
|
||||
//
|
||||
exports.EventEmitter2.call(this, {
|
||||
delimiter: this.delimiter,
|
||||
wildcard: true
|
||||
});
|
||||
|
||||
//
|
||||
// Setup other relevant options such as the plugins
|
||||
// for this instance.
|
||||
//
|
||||
this.options = options;
|
||||
this.plugins = options.plugins || {};
|
||||
this.initialized = false;
|
||||
this.bootstrapper = { init: function (app, func) {} };
|
||||
this.initializers = {};
|
||||
};
|
||||
|
||||
var inherit = function (ctor, superCtor) {
|
||||
ctor.super_ = superCtor;
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inherit(exports.App, exports.EventEmitter2);
|
||||
|
||||
78
node_modules/forever/node_modules/flatiron/node_modules/broadway/lib/broadway/common/directories.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* app.js: Common utility functions for working with directories
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var utile = require('utile'),
|
||||
async = utile.async,
|
||||
mkdirp = utile.mkdirp,
|
||||
rimraf = utile.rimraf;
|
||||
|
||||
var directories = exports;
|
||||
|
||||
//
|
||||
// ### function create (dirs, callback)
|
||||
// #### @dirs {Object} Directories to create
|
||||
// #### @callback {function} Continuation to respond to when complete
|
||||
// Creates all of the specified `directories` in the current environment.
|
||||
//
|
||||
directories.create = function (dirs, callback) {
|
||||
function createDir(dir, next) {
|
||||
mkdirp(dir, 0755, function () {
|
||||
next(null, dir);
|
||||
});
|
||||
}
|
||||
|
||||
if (!dirs) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
async.mapSeries(Object.keys(dirs).map(function (key) {
|
||||
return dirs[key]
|
||||
}), createDir, callback);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function remove (dirs, callback)
|
||||
// #### @dirs {Object} Directories to remove
|
||||
// #### @callback {function} Continuation to respond to when complete
|
||||
// Removes all of the specified `directories` in the current environment.
|
||||
//
|
||||
directories.remove = function (dirs, callback) {
|
||||
function removeDir (dir, next) {
|
||||
rimraf(dir, function () {
|
||||
next(null, dir);
|
||||
});
|
||||
}
|
||||
|
||||
if (!dirs) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
async.mapSeries(Object.keys(dirs).map(function (key) {
|
||||
return dirs[key]
|
||||
}), removeDir, callback);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function normalize (root, dirs)
|
||||
// #### @keys {Object} Set of keys to normalize upon.
|
||||
// #### @dirs {Object} Set of directories to normalize.
|
||||
// Normalizes the specified `dirs` against the relative
|
||||
// `root` of the application.
|
||||
//
|
||||
directories.normalize = function (keys, dirs) {
|
||||
var normalized = {};
|
||||
|
||||
Object.keys(dirs).forEach(function (key) {
|
||||
normalized[key] = dirs[key];
|
||||
Object.keys(keys).forEach(function (constant) {
|
||||
normalized[key] = normalized[key].replace(constant, keys[constant]);
|
||||
});
|
||||
});
|
||||
|
||||
return normalized;
|
||||
};
|
||||
18
node_modules/forever/node_modules/flatiron/node_modules/broadway/lib/broadway/common/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* common.js: Top-level include for the `common` module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var common = module.exports = require('utile');
|
||||
|
||||
common.directories = require('./directories');
|
||||
|
||||
// A naive shared "unique ID" generator for cases where `plugin.name` is
|
||||
// undefined.
|
||||
var id = 0;
|
||||
common.uuid = function () {
|
||||
return String(id++);
|
||||
}
|
||||