This commit is contained in:
commit
9dc3e1a66a
23 changed files with 4 additions and 1326 deletions
|
@ -47,8 +47,10 @@ function connect(){
|
||||||
|
|
||||||
if(!client.port){
|
if(!client.port){
|
||||||
client.log('Connecting client on Unix Socket :'.debug, client.path.variable);
|
client.log('Connecting client on Unix Socket :'.debug, client.path.variable);
|
||||||
if (process.platform ==='win32' && !client.path.startsWith('\\\\.\\pipe\\')){
|
|
||||||
var path = client.path;
|
var path = client.path;
|
||||||
|
|
||||||
|
if (process.platform ==='win32' && !client.path.startsWith('\\\\.\\pipe\\')){
|
||||||
path = path.replace(/^\//, '');
|
path = path.replace(/^\//, '');
|
||||||
path = path.replace(/\//g, '-');
|
path = path.replace(/\//g, '-');
|
||||||
path= '\\\\.\\pipe\\'+path;
|
path= '\\\\.\\pipe\\'+path;
|
||||||
|
|
178
node_modules/colors/ReadMe.md
generated
vendored
178
node_modules/colors/ReadMe.md
generated
vendored
|
@ -1,178 +0,0 @@
|
||||||
# colors.js [![Build Status](https://travis-ci.org/Marak/colors.js.svg?branch=master)](https://travis-ci.org/Marak/colors.js)
|
|
||||||
|
|
||||||
## get color and style in your node.js console
|
|
||||||
|
|
||||||
![Demo](https://raw.githubusercontent.com/Marak/colors.js/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"));
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also combine them:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var colors = require('colors');
|
|
||||||
|
|
||||||
colors.setTheme({
|
|
||||||
custom: ['red', 'underline']
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log('test'.custom);
|
|
||||||
```
|
|
||||||
|
|
||||||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
|
59
node_modules/colors/package.json
generated
vendored
59
node_modules/colors/package.json
generated
vendored
|
@ -1,59 +0,0 @@
|
||||||
{
|
|
||||||
"name": "colors",
|
|
||||||
"description": "get colors in your node.js console",
|
|
||||||
"version": "1.1.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"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"test": "node tests/basic-test.js && node tests/safe-test.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.1.90"
|
|
||||||
},
|
|
||||||
"main": "lib",
|
|
||||||
"files": [
|
|
||||||
"examples",
|
|
||||||
"lib",
|
|
||||||
"LICENSE",
|
|
||||||
"safe.js",
|
|
||||||
"themes"
|
|
||||||
],
|
|
||||||
"gitHead": "8bf2ad9fa695dcb30b7e9fd83691b139fd6655c4",
|
|
||||||
"_id": "colors@1.1.2",
|
|
||||||
"_shasum": "168a4701756b6a7f51a12ce0c97bfa28c084ed63",
|
|
||||||
"_from": "colors@1.1.2",
|
|
||||||
"_npmVersion": "2.1.8",
|
|
||||||
"_nodeVersion": "0.11.13",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "marak",
|
|
||||||
"email": "marak.squires@gmail.com"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "marak",
|
|
||||||
"email": "marak.squires@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dist": {
|
|
||||||
"shasum": "168a4701756b6a7f51a12ce0c97bfa28c084ed63",
|
|
||||||
"tarball": "http://registry.npmjs.org/colors/-/colors-1.1.2.tgz"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"_resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz",
|
|
||||||
"readme": "ERROR: No README data found!"
|
|
||||||
}
|
|
24
node_modules/event-pubsub/LICENSE
generated
vendored
24
node_modules/event-pubsub/LICENSE
generated
vendored
|
@ -1,24 +0,0 @@
|
||||||
This is free and unencumbered software released into the public domain.
|
|
||||||
|
|
||||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
||||||
distribute this software, either in source code form or as a compiled
|
|
||||||
binary, for any purpose, commercial or non-commercial, and by any
|
|
||||||
means.
|
|
||||||
|
|
||||||
In jurisdictions that recognize copyright laws, the author or authors
|
|
||||||
of this software dedicate any and all copyright interest in the
|
|
||||||
software to the public domain. We make this dedication for the benefit
|
|
||||||
of the public at large and to the detriment of our heirs and
|
|
||||||
successors. We intend this dedication to be an overt act of
|
|
||||||
relinquishment in perpetuity of all present and future rights to this
|
|
||||||
software under copyright law.
|
|
||||||
|
|
||||||
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 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.
|
|
||||||
|
|
||||||
For more information, please refer to <http://unlicense.org>
|
|
119
node_modules/event-pubsub/README.md
generated
vendored
119
node_modules/event-pubsub/README.md
generated
vendored
|
@ -1,119 +0,0 @@
|
||||||
Event PubSub
|
|
||||||
============
|
|
||||||
|
|
||||||
Pubsub events for Node and the browser allowing event scoping and multiple scopes.
|
|
||||||
Easy for any developer level. No frills, just high speed pubsub events!
|
|
||||||
|
|
||||||
[Pretty GitHub.io site](http://riaevangelist.github.io/event-pubsub/)
|
|
||||||
|
|
||||||
[![alt event-pubsub npm details](https://nodei.co/npm/event-pubsub.png?stars=true "event-pubsub npm package details")](https://npmjs.org/package/event-pubsub)
|
|
||||||
|
|
||||||
**EXAMPLE FILES**
|
|
||||||
|
|
||||||
1. [Node Pubsub Event Examples](https://github.com/RIAEvangelist/event-pubsub/tree/master/examples/node)
|
|
||||||
2. [Browser Pubsub Event Examples](https://github.com/RIAEvangelist/event-pubsub/tree/master/examples/browser)
|
|
||||||
|
|
||||||
**Node Install**
|
|
||||||
``npm install event-pubsub``
|
|
||||||
|
|
||||||
**Browser Install**
|
|
||||||
*see browser examples above or below*
|
|
||||||
|
|
||||||
---
|
|
||||||
### Basic Example
|
|
||||||
---
|
|
||||||
***NOTE - the only diffeence between node and browser code is how the ``events`` variable is created***
|
|
||||||
* node ``var events = new require('../../event-pubsub.js')();``
|
|
||||||
* browser ``var events = new window.pubsub();``
|
|
||||||
|
|
||||||
#### Node
|
|
||||||
|
|
||||||
var events = new require('../../event-pubsub.js')();
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
console.log('hello event recieved ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'removeEvents',
|
|
||||||
function(){
|
|
||||||
events.off('*');
|
|
||||||
console.log('Removed all events');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* trigger events for testing
|
|
||||||
* **********************************/
|
|
||||||
events.trigger(
|
|
||||||
'hello',
|
|
||||||
'world'
|
|
||||||
);
|
|
||||||
|
|
||||||
events.trigger(
|
|
||||||
'removeEvents'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
#### Browser
|
|
||||||
##### HTML
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>PubSub Example</title>
|
|
||||||
<script src='../../event-pubsub-browser.js'></script>
|
|
||||||
<script src='yourAmazingCode.js'></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
...
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
##### Inside Your Amazing Code
|
|
||||||
|
|
||||||
var events = new window.pubsub();
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
console.log('hello event recieved ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'removeEvents',
|
|
||||||
function(){
|
|
||||||
events.off('*');
|
|
||||||
console.log('Removed all events');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* trigger events for testing
|
|
||||||
* **********************************/
|
|
||||||
events.trigger(
|
|
||||||
'hello',
|
|
||||||
'world'
|
|
||||||
);
|
|
||||||
|
|
||||||
events.trigger(
|
|
||||||
'removeEvents'
|
|
||||||
);
|
|
128
node_modules/event-pubsub/event-pubsub-browser.js
generated
vendored
128
node_modules/event-pubsub/event-pubsub-browser.js
generated
vendored
|
@ -1,128 +0,0 @@
|
||||||
window.pubsub=(
|
|
||||||
function(){
|
|
||||||
|
|
||||||
function sub(type,handler){
|
|
||||||
checkScope.apply(this);
|
|
||||||
|
|
||||||
if(!this._events_[type])
|
|
||||||
this._events_[type]=[];
|
|
||||||
|
|
||||||
this._events_[type].push(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unsub(type,handler){
|
|
||||||
checkScope.apply(this);
|
|
||||||
|
|
||||||
if(type=='*'){
|
|
||||||
var params=Array.prototype.slice.call(arguments,1);
|
|
||||||
for(
|
|
||||||
var keys = Object.keys(this._events_),
|
|
||||||
count = keys.length,
|
|
||||||
i=0;
|
|
||||||
i<count;
|
|
||||||
i++
|
|
||||||
){
|
|
||||||
var args=params.unshift(keys[i]);
|
|
||||||
this.off.call(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this._events_[type])
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!handler){
|
|
||||||
delete this._events_[type];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this._events_[type].length<2){
|
|
||||||
delete this._events_[type];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(var i=0,
|
|
||||||
count=this._events_[type].length;
|
|
||||||
i<count;
|
|
||||||
i++
|
|
||||||
){
|
|
||||||
if(this._events_[type][i]==handler)
|
|
||||||
this._events_[type].splice(i,1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function pub(type){
|
|
||||||
checkScope.apply(this);
|
|
||||||
|
|
||||||
if(this._events_['*'] && type!='*'){
|
|
||||||
var params=Array.prototype.slice.call(arguments);
|
|
||||||
params.unshift('*');
|
|
||||||
this.trigger.apply(this,params);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this._events_[type])
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(var i=0,
|
|
||||||
events=this._events_[type],
|
|
||||||
count=events.length,
|
|
||||||
args=Array.prototype.slice.call(arguments,1);
|
|
||||||
i<count;
|
|
||||||
i++){
|
|
||||||
events[i].apply(this, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkScope(){
|
|
||||||
if(!this._events_)
|
|
||||||
this._events_={};
|
|
||||||
}
|
|
||||||
|
|
||||||
function init(scope){
|
|
||||||
if(!scope)
|
|
||||||
return {
|
|
||||||
on:sub,
|
|
||||||
off:unsub,
|
|
||||||
trigger:pub
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.on=(
|
|
||||||
function(scope){
|
|
||||||
return function(){
|
|
||||||
sub.apply(
|
|
||||||
scope,
|
|
||||||
Array.prototype.slice.call(arguments)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(scope);
|
|
||||||
|
|
||||||
scope.off=(
|
|
||||||
function(scope){
|
|
||||||
return function(){
|
|
||||||
unsub.apply(
|
|
||||||
scope,
|
|
||||||
Array.prototype.slice.call(arguments)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(scope);
|
|
||||||
|
|
||||||
scope.trigger=(
|
|
||||||
function(scope){
|
|
||||||
return function(){
|
|
||||||
pub.apply(
|
|
||||||
scope,
|
|
||||||
Array.prototype.slice.call(arguments)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(scope);
|
|
||||||
|
|
||||||
scope._events_={};
|
|
||||||
}
|
|
||||||
|
|
||||||
return init;
|
|
||||||
|
|
||||||
}
|
|
||||||
)();
|
|
122
node_modules/event-pubsub/event-pubsub.js
generated
vendored
122
node_modules/event-pubsub/event-pubsub.js
generated
vendored
|
@ -1,122 +0,0 @@
|
||||||
function sub(type,handler){
|
|
||||||
checkScope.apply(this);
|
|
||||||
|
|
||||||
if(!this._events_[type])
|
|
||||||
this._events_[type]=[];
|
|
||||||
|
|
||||||
this._events_[type].push(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unsub(type,handler){
|
|
||||||
checkScope.apply(this);
|
|
||||||
|
|
||||||
if(type=='*'){
|
|
||||||
var params=Array.prototype.slice.call(arguments,1);
|
|
||||||
for(
|
|
||||||
var keys = Object.keys(this._events_),
|
|
||||||
count = keys.length,
|
|
||||||
i=0;
|
|
||||||
i<count;
|
|
||||||
i++
|
|
||||||
){
|
|
||||||
var args=params.unshift(keys[i]);
|
|
||||||
this.off.call(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this._events_[type])
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!handler){
|
|
||||||
delete this._events_[type];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this._events_[type].length<2){
|
|
||||||
delete this._events_[type];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(var i=0,
|
|
||||||
count=this._events_[type].length;
|
|
||||||
i<count;
|
|
||||||
i++
|
|
||||||
){
|
|
||||||
if(this._events_[type][i]==handler)
|
|
||||||
this._events_[type].splice(i,1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function pub(type){
|
|
||||||
checkScope.apply(this);
|
|
||||||
|
|
||||||
if(this._events_['*'] && type!='*'){
|
|
||||||
var params=Array.prototype.slice.call(arguments);
|
|
||||||
params.unshift('*');
|
|
||||||
this.trigger.apply(this,params);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this._events_[type])
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(var i=0,
|
|
||||||
events=this._events_[type],
|
|
||||||
count=events.length,
|
|
||||||
args=Array.prototype.slice.call(arguments,1);
|
|
||||||
i<count;
|
|
||||||
i++){
|
|
||||||
events[i].apply(this, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkScope(){
|
|
||||||
if(!this._events_)
|
|
||||||
this._events_={};
|
|
||||||
}
|
|
||||||
|
|
||||||
function init(scope){
|
|
||||||
if(!scope)
|
|
||||||
return {
|
|
||||||
on:sub,
|
|
||||||
off:unsub,
|
|
||||||
trigger:pub
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.on=(
|
|
||||||
function(scope){
|
|
||||||
return function(){
|
|
||||||
sub.apply(
|
|
||||||
scope,
|
|
||||||
Array.prototype.slice.call(arguments)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(scope);
|
|
||||||
|
|
||||||
scope.off=(
|
|
||||||
function(scope){
|
|
||||||
return function(){
|
|
||||||
unsub.apply(
|
|
||||||
scope,
|
|
||||||
Array.prototype.slice.call(arguments)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(scope);
|
|
||||||
|
|
||||||
scope.trigger=(
|
|
||||||
function(scope){
|
|
||||||
return function(){
|
|
||||||
pub.apply(
|
|
||||||
scope,
|
|
||||||
Array.prototype.slice.call(arguments)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(scope);
|
|
||||||
|
|
||||||
scope._events_={};
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=init
|
|
15
node_modules/event-pubsub/examples/browser/basic.html
generated
vendored
15
node_modules/event-pubsub/examples/browser/basic.html
generated
vendored
|
@ -1,15 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Basic PubSub Example</title>
|
|
||||||
<script src='../../event-pubsub-browser.js'></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<ul id='events'>
|
|
||||||
<li>
|
|
||||||
<h1>PubSub Basic Events Example</h1>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<script src='basic.js'></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
75
node_modules/event-pubsub/examples/browser/basic.js
generated
vendored
75
node_modules/event-pubsub/examples/browser/basic.js
generated
vendored
|
@ -1,75 +0,0 @@
|
||||||
var events = new window.pubsub();
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
*
|
|
||||||
* The events var was instantiated
|
|
||||||
* as it's own scope
|
|
||||||
*
|
|
||||||
* **********************************/
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('hello event recieved ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('Second handler listening to hello event got',data);
|
|
||||||
events.trigger(
|
|
||||||
'world',
|
|
||||||
{
|
|
||||||
type:'myObject',
|
|
||||||
data:{
|
|
||||||
x:'YAY, Objects!'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'world',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('World event got',data);
|
|
||||||
events.off('*');
|
|
||||||
eventLog.log('Removed all events')
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**********************************\
|
|
||||||
*
|
|
||||||
* Demonstrate * event (on all events)
|
|
||||||
* remove this for less verbose
|
|
||||||
* example
|
|
||||||
*
|
|
||||||
* ********************************/
|
|
||||||
events.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
eventLog.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/*******************************\
|
|
||||||
*
|
|
||||||
* Prep HTML for logging
|
|
||||||
*
|
|
||||||
* *****************************/
|
|
||||||
var eventLog=document.getElementById('events');
|
|
||||||
//not using console.log incase it doesn't work in some browser. *TLDT (Too lazy didn't test)*
|
|
||||||
eventLog.log=_log_;
|
|
||||||
function _log_ (){
|
|
||||||
var events=Array.prototype.slice.call(arguments),
|
|
||||||
newEvent=document.createElement('li');
|
|
||||||
|
|
||||||
newEvent.innerHTML=events.join(' ');
|
|
||||||
this.appendChild(newEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
events.trigger(
|
|
||||||
'hello',
|
|
||||||
'world'
|
|
||||||
);
|
|
15
node_modules/event-pubsub/examples/browser/multipleScopes.html
generated
vendored
15
node_modules/event-pubsub/examples/browser/multipleScopes.html
generated
vendored
|
@ -1,15 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Basic PubSub Example</title>
|
|
||||||
<script src='../../event-pubsub-browser.js'></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<ul id='events'>
|
|
||||||
<li>
|
|
||||||
<h1>PubSub Multiple Event Scopes Example</h1>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<script src='multipleScopes.js'></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
103
node_modules/event-pubsub/examples/browser/multipleScopes.js
generated
vendored
103
node_modules/event-pubsub/examples/browser/multipleScopes.js
generated
vendored
|
@ -1,103 +0,0 @@
|
||||||
/************************************\
|
|
||||||
* instantiating myEvents scope
|
|
||||||
* **********************************/
|
|
||||||
var myEvents=new window.pubsub();
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* instantiating myEvents2 scope
|
|
||||||
* **********************************/
|
|
||||||
var myEvents2=new window.pubsub();
|
|
||||||
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* binding myEvents events
|
|
||||||
* **********************************/
|
|
||||||
myEvents.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('myEvents hello event recieved ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('Second handler listening to myEvents hello event got',data);
|
|
||||||
myEvents.trigger(
|
|
||||||
'world',
|
|
||||||
{
|
|
||||||
type:'myObject',
|
|
||||||
data:{
|
|
||||||
x:'YAY, Objects!'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents.on(
|
|
||||||
'world',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('myEvents World event got',data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**********************************\
|
|
||||||
*
|
|
||||||
* Demonstrate * event (on all events)
|
|
||||||
* remove this for less verbose
|
|
||||||
* example
|
|
||||||
*
|
|
||||||
* ********************************/
|
|
||||||
myEvents.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
eventLog.log('myEvents Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* binding myEvents2 events
|
|
||||||
* **********************************/
|
|
||||||
myEvents2.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('myEvents2 Hello event should never be called ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents2.on(
|
|
||||||
'world',
|
|
||||||
function(data){
|
|
||||||
eventLog.log('myEvents2 World event ',data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/*******************************\
|
|
||||||
*
|
|
||||||
* Prep HTML for logging
|
|
||||||
*
|
|
||||||
* *****************************/
|
|
||||||
var eventLog=document.getElementById('events');
|
|
||||||
//not using console.log incase it doesn't work in some browser. *TLDT (Too lazy didn't test)*
|
|
||||||
eventLog.log=_log_;
|
|
||||||
function _log_ (){
|
|
||||||
var events=Array.prototype.slice.call(arguments),
|
|
||||||
newEvent=document.createElement('li');
|
|
||||||
|
|
||||||
newEvent.innerHTML=events.join(' ');
|
|
||||||
this.appendChild(newEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* trigger events for testing
|
|
||||||
* **********************************/
|
|
||||||
myEvents.trigger(
|
|
||||||
'hello',
|
|
||||||
'world'
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents2.trigger(
|
|
||||||
'world',
|
|
||||||
'is round'
|
|
||||||
);
|
|
15
node_modules/event-pubsub/examples/browser/objectScope.html
generated
vendored
15
node_modules/event-pubsub/examples/browser/objectScope.html
generated
vendored
|
@ -1,15 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Basic PubSub Example</title>
|
|
||||||
<script src='../../event-pubsub-browser.js'></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<ul id='events'>
|
|
||||||
<li>
|
|
||||||
<h1>PubSub Events inside of and using an Object as the scope Example</h1>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<script src='objectScope.js'></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
73
node_modules/event-pubsub/examples/browser/objectScope.js
generated
vendored
73
node_modules/event-pubsub/examples/browser/objectScope.js
generated
vendored
|
@ -1,73 +0,0 @@
|
||||||
/************************************\
|
|
||||||
*
|
|
||||||
* The events var was instantiated
|
|
||||||
* as it's own scope
|
|
||||||
*
|
|
||||||
* **********************************/
|
|
||||||
|
|
||||||
var thing={
|
|
||||||
id:'my thing'
|
|
||||||
}
|
|
||||||
/******************************\
|
|
||||||
*
|
|
||||||
* Create events in the scope
|
|
||||||
* of the "thing" object
|
|
||||||
*
|
|
||||||
* ****************************/
|
|
||||||
new window.pubsub(thing);
|
|
||||||
|
|
||||||
thing.on(
|
|
||||||
'getID',
|
|
||||||
function(){
|
|
||||||
eventLog.log('things id is : ',this.id);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
thing.on(
|
|
||||||
'setID',
|
|
||||||
function(id){
|
|
||||||
eventLog.log('setting id to : ',id);
|
|
||||||
this.id=id;
|
|
||||||
this.trigger('getID');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**********************************\
|
|
||||||
*
|
|
||||||
* Demonstrate * event (on all events)
|
|
||||||
* remove this for less verbose
|
|
||||||
* example
|
|
||||||
*
|
|
||||||
* ********************************/
|
|
||||||
thing.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
eventLog.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/*******************************\
|
|
||||||
*
|
|
||||||
* Prep HTML for logging
|
|
||||||
*
|
|
||||||
* *****************************/
|
|
||||||
var eventLog=document.getElementById('events');
|
|
||||||
//not using console.log incase it doesn't work in some browser. *TLDT (Too lazy didn't test)*
|
|
||||||
eventLog.log=_log_;
|
|
||||||
function _log_ (){
|
|
||||||
var events=Array.prototype.slice.call(arguments),
|
|
||||||
newEvent=document.createElement('li');
|
|
||||||
|
|
||||||
newEvent.innerHTML=events.join(' ');
|
|
||||||
this.appendChild(newEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* trigger events for testing
|
|
||||||
* **********************************/
|
|
||||||
thing.trigger('getID');
|
|
||||||
|
|
||||||
thing.trigger(
|
|
||||||
'setID',
|
|
||||||
'your thing'
|
|
||||||
)
|
|
62
node_modules/event-pubsub/examples/node/basic.js
generated
vendored
62
node_modules/event-pubsub/examples/node/basic.js
generated
vendored
|
@ -1,62 +0,0 @@
|
||||||
var events = new require('../../event-pubsub.js')();
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
*
|
|
||||||
* The events var was instantiated
|
|
||||||
* as it's own scope
|
|
||||||
*
|
|
||||||
* **********************************/
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
console.log('hello event recieved ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
console.log('Second handler listening to hello event got',data);
|
|
||||||
events.trigger(
|
|
||||||
'world',
|
|
||||||
{
|
|
||||||
type:'myObject',
|
|
||||||
data:{
|
|
||||||
x:'YAY, Objects!'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
events.on(
|
|
||||||
'world',
|
|
||||||
function(data){
|
|
||||||
console.log('World event got',data);
|
|
||||||
events.off('*');
|
|
||||||
console.log('Removed all events');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**********************************\
|
|
||||||
*
|
|
||||||
* Demonstrate * event (on all events)
|
|
||||||
* remove this for less verbose
|
|
||||||
* example
|
|
||||||
*
|
|
||||||
* ********************************/
|
|
||||||
events.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* trigger events for testing
|
|
||||||
* **********************************/
|
|
||||||
events.trigger(
|
|
||||||
'hello',
|
|
||||||
'world'
|
|
||||||
);
|
|
90
node_modules/event-pubsub/examples/node/multipleScopes.js
generated
vendored
90
node_modules/event-pubsub/examples/node/multipleScopes.js
generated
vendored
|
@ -1,90 +0,0 @@
|
||||||
var pubsub = require('../../event-pubsub.js');
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* instantiating myEvents scope
|
|
||||||
* **********************************/
|
|
||||||
var myEvents=new pubsub();
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* instantiating myEvents2 scope
|
|
||||||
* **********************************/
|
|
||||||
var myEvents2=new pubsub();
|
|
||||||
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* binding myEvents events
|
|
||||||
* **********************************/
|
|
||||||
myEvents.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
console.log('myEvents hello event recieved ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
console.log('Second handler listening to myEvents hello event got',data);
|
|
||||||
myEvents.trigger(
|
|
||||||
'world',
|
|
||||||
{
|
|
||||||
type:'myObject',
|
|
||||||
data:{
|
|
||||||
x:'YAY, Objects!'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents.on(
|
|
||||||
'world',
|
|
||||||
function(data){
|
|
||||||
console.log('myEvents World event got',data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**********************************\
|
|
||||||
*
|
|
||||||
* Demonstrate * event (on all events)
|
|
||||||
* remove this for less verbose
|
|
||||||
* example
|
|
||||||
*
|
|
||||||
* ********************************/
|
|
||||||
myEvents.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
console.log('myEvents Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* binding myEvents2 events
|
|
||||||
* **********************************/
|
|
||||||
myEvents2.on(
|
|
||||||
'hello',
|
|
||||||
function(data){
|
|
||||||
console.log('myEvents2 Hello event should never be called ', data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents2.on(
|
|
||||||
'world',
|
|
||||||
function(data){
|
|
||||||
console.log('myEvents2 World event ',data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
* trigger events for testing
|
|
||||||
* **********************************/
|
|
||||||
myEvents.trigger(
|
|
||||||
'hello',
|
|
||||||
'world'
|
|
||||||
);
|
|
||||||
|
|
||||||
myEvents2.trigger(
|
|
||||||
'world',
|
|
||||||
'is round'
|
|
||||||
);
|
|
56
node_modules/event-pubsub/examples/node/objectScope.js
generated
vendored
56
node_modules/event-pubsub/examples/node/objectScope.js
generated
vendored
|
@ -1,56 +0,0 @@
|
||||||
var pubsub = require('../../event-pubsub.js');
|
|
||||||
|
|
||||||
/************************************\
|
|
||||||
*
|
|
||||||
* The events var was instantiated
|
|
||||||
* as it's own scope
|
|
||||||
*
|
|
||||||
* **********************************/
|
|
||||||
|
|
||||||
var thing={
|
|
||||||
id:'my thing'
|
|
||||||
}
|
|
||||||
/******************************\
|
|
||||||
*
|
|
||||||
* Create events in the scope
|
|
||||||
* of the "thing" object
|
|
||||||
*
|
|
||||||
* ****************************/
|
|
||||||
new pubsub(thing);
|
|
||||||
|
|
||||||
thing.on(
|
|
||||||
'getID',
|
|
||||||
function(){
|
|
||||||
console.log('things id is : ',this.id);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
thing.on(
|
|
||||||
'setID',
|
|
||||||
function(id){
|
|
||||||
console.log('setting id to : ',id);
|
|
||||||
this.id=id;
|
|
||||||
this.trigger('getID');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**********************************\
|
|
||||||
*
|
|
||||||
* Demonstrate * event (on all events)
|
|
||||||
* remove this for less verbose
|
|
||||||
* example
|
|
||||||
*
|
|
||||||
* ********************************/
|
|
||||||
thing.on(
|
|
||||||
'*',
|
|
||||||
function(type){
|
|
||||||
console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
thing.trigger('getID');
|
|
||||||
|
|
||||||
thing.trigger(
|
|
||||||
'setID',
|
|
||||||
'your thing'
|
|
||||||
)
|
|
51
node_modules/event-pubsub/package.json
generated
vendored
51
node_modules/event-pubsub/package.json
generated
vendored
|
@ -1,51 +0,0 @@
|
||||||
{
|
|
||||||
"name": "event-pubsub",
|
|
||||||
"version": "1.0.3",
|
|
||||||
"description": "Pubsub events for Node and the browser allowing event scoping and multiple scopes. Easy for any developer level. No frills, just high speed pubsub events!",
|
|
||||||
"main": "event-pubsub.js",
|
|
||||||
"directories": {
|
|
||||||
"example": "examples"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/RIAEvangelist/event-pubsub.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"event",
|
|
||||||
"events",
|
|
||||||
"pubsub",
|
|
||||||
"node",
|
|
||||||
"browser"
|
|
||||||
],
|
|
||||||
"author": {
|
|
||||||
"name": "Brandon Nozaki Miller"
|
|
||||||
},
|
|
||||||
"license": "Unlicense",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/RIAEvangelist/event-pubsub/issues"
|
|
||||||
},
|
|
||||||
"homepage": "http://riaevangelist.github.io/event-pubsub/",
|
|
||||||
"_id": "event-pubsub@1.0.3",
|
|
||||||
"dist": {
|
|
||||||
"shasum": "c81c49b101cdb4892d8fa2631b443184db2de6aa",
|
|
||||||
"tarball": "http://registry.npmjs.org/event-pubsub/-/event-pubsub-1.0.3.tgz"
|
|
||||||
},
|
|
||||||
"_from": "event-pubsub@>=1.0.3 <1.1.0",
|
|
||||||
"_npmVersion": "1.4.3",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "riaevangelist",
|
|
||||||
"email": "brandon@diginow.it"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "riaevangelist",
|
|
||||||
"email": "brandon@diginow.it"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_shasum": "c81c49b101cdb4892d8fa2631b443184db2de6aa",
|
|
||||||
"_resolved": "https://registry.npmjs.org/event-pubsub/-/event-pubsub-1.0.3.tgz",
|
|
||||||
"readme": "ERROR: No README data found!"
|
|
||||||
}
|
|
38
node_modules/node-cmd/README.md
generated
vendored
38
node_modules/node-cmd/README.md
generated
vendored
|
@ -1,38 +0,0 @@
|
||||||
#node-cmd
|
|
||||||
-
|
|
||||||
*Node.js commandline/terminal interface.*
|
|
||||||
|
|
||||||
Simple commandline or terminal interface to allow you to run cli or bash style commands as if you were in the terminal.
|
|
||||||
|
|
||||||
Run commands asynchronously, and if needed can get the output as a string.
|
|
||||||
|
|
||||||
#Methods
|
|
||||||
-
|
|
||||||
|
|
||||||
|method | arguments | functionality |
|
|
||||||
|-------|-----------|---------------|
|
|
||||||
|run | command | runs a command asynchronously|
|
|
||||||
|get | command,callback | runs a command asynchronously, when the command is complete all of the stdout will be passed to the callback|
|
|
||||||
|
|
||||||
|
|
||||||
#Examples
|
|
||||||
-
|
|
||||||
|
|
||||||
var cmd=require('node-cmd');
|
|
||||||
|
|
||||||
cmd.get(
|
|
||||||
'pwd',
|
|
||||||
function(data){
|
|
||||||
console.log('the current working dir is : ',data)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
cmd.run('touch example.created.file');
|
|
||||||
|
|
||||||
cmd.get(
|
|
||||||
'ls',
|
|
||||||
function(data){
|
|
||||||
console.log('the current dir contains these files :\n\n',data)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
31
node_modules/node-cmd/cmd.js
generated
vendored
31
node_modules/node-cmd/cmd.js
generated
vendored
|
@ -1,31 +0,0 @@
|
||||||
var sys = require('sys'),
|
|
||||||
exec = require('child_process').exec;
|
|
||||||
|
|
||||||
var commandline={
|
|
||||||
get:getString,
|
|
||||||
run:runCommand
|
|
||||||
};
|
|
||||||
|
|
||||||
function runCommand(command){
|
|
||||||
exec(
|
|
||||||
command
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getString(command,callback){
|
|
||||||
exec(
|
|
||||||
command,
|
|
||||||
(
|
|
||||||
function(){
|
|
||||||
return function(err,data,stderr){
|
|
||||||
if(!callback)
|
|
||||||
return;
|
|
||||||
|
|
||||||
callback(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(callback)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=commandline;
|
|
17
node_modules/node-cmd/example/basic.js
generated
vendored
17
node_modules/node-cmd/example/basic.js
generated
vendored
|
@ -1,17 +0,0 @@
|
||||||
var cmd=require('../cmd.js');
|
|
||||||
|
|
||||||
cmd.get(
|
|
||||||
'pwd',
|
|
||||||
function(data){
|
|
||||||
console.log('the current working dir is : ',data)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
cmd.run('touch example.created.file');
|
|
||||||
|
|
||||||
cmd.get(
|
|
||||||
'ls',
|
|
||||||
function(data){
|
|
||||||
console.log('the current dir contains these files :\n\n',data)
|
|
||||||
}
|
|
||||||
);
|
|
0
node_modules/node-cmd/example/example.created.file
generated
vendored
0
node_modules/node-cmd/example/example.created.file
generated
vendored
53
node_modules/node-cmd/package.json
generated
vendored
53
node_modules/node-cmd/package.json
generated
vendored
|
@ -1,53 +0,0 @@
|
||||||
{
|
|
||||||
"name": "node-cmd",
|
|
||||||
"version": "1.0.2",
|
|
||||||
"description": "Simple commandline/terminal interface to allow you to run cli or bash style commands as if you were in the terminal.",
|
|
||||||
"main": "cmd.js",
|
|
||||||
"directories": {
|
|
||||||
"example": "example"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/RIAEvangelist/node-cmd.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"commandline",
|
|
||||||
"terminal",
|
|
||||||
"cmd",
|
|
||||||
"cli",
|
|
||||||
"bash",
|
|
||||||
"script"
|
|
||||||
],
|
|
||||||
"author": {
|
|
||||||
"name": "Brandon Nozaki Miller"
|
|
||||||
},
|
|
||||||
"license": "DBAD",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/RIAEvangelist/node-cmd/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/RIAEvangelist/node-cmd",
|
|
||||||
"gitHead": "a003426996e8594af31a6486cfb7d28d0a547bc9",
|
|
||||||
"_id": "node-cmd@1.0.2",
|
|
||||||
"_shasum": "89cdb50181476cdd127763d5c8514499fe3c038d",
|
|
||||||
"_from": "node-cmd@>=1.0.1 <1.1.0",
|
|
||||||
"_npmVersion": "1.4.23",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "riaevangelist",
|
|
||||||
"email": "brandon@diginow.it"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "riaevangelist",
|
|
||||||
"email": "brandon@1942design.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dist": {
|
|
||||||
"shasum": "89cdb50181476cdd127763d5c8514499fe3c038d",
|
|
||||||
"tarball": "http://registry.npmjs.org/node-cmd/-/node-cmd-1.0.2.tgz"
|
|
||||||
},
|
|
||||||
"_resolved": "https://registry.npmjs.org/node-cmd/-/node-cmd-1.0.2.tgz",
|
|
||||||
"readme": "ERROR: No README data found!"
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "node-ipc",
|
"name": "node-ipc",
|
||||||
"version": "4.0.0",
|
"version": "4.1.0",
|
||||||
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",
|
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",
|
||||||
"main": "node-ipc.js",
|
"main": "node-ipc.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
Loading…
Reference in a new issue