mqtt stuff added
This commit is contained in:
28
node_modules/help-me/.npmignore
generated
vendored
Normal file
28
node_modules/help-me/.npmignore
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# Commenting this out is preferred by some people, see
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||
node_modules
|
||||
|
||||
# Users Environment Variables
|
||||
.lock-wscript
|
11
node_modules/help-me/.travis.yml
generated
vendored
Normal file
11
node_modules/help-me/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- '0.10'
|
||||
- '0.12'
|
||||
- '4'
|
||||
- '5'
|
||||
- '6'
|
||||
- '7'
|
||||
script:
|
||||
- npm test
|
22
node_modules/help-me/LICENSE
generated
vendored
Normal file
22
node_modules/help-me/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Matteo Collina
|
||||
|
||||
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.
|
||||
|
50
node_modules/help-me/README.md
generated
vendored
Normal file
50
node_modules/help-me/README.md
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
help-me
|
||||
=======
|
||||
|
||||
Help command for node, to use with [minimist](http://npm.im/minimist) and [commist](http://npm.im/commist).
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
|
||||
var helpMe = require('help-me')
|
||||
var help = helpMe({
|
||||
// the default
|
||||
dir: path.join(path.dirname(require.main.filename), 'doc'),
|
||||
// the default
|
||||
ext: '.txt'
|
||||
})
|
||||
|
||||
help
|
||||
.createStream(['hello']) // can support also strings
|
||||
.pipe(process.stdout)
|
||||
|
||||
// little helper to do the same
|
||||
help.toStdout(['hello']
|
||||
```
|
||||
|
||||
Usage with commist
|
||||
------------------
|
||||
|
||||
[Commist](http://npm.im/commist) provide a command system for node.
|
||||
|
||||
```js
|
||||
var commist = require('commist')()
|
||||
var help = require('help-me')()
|
||||
|
||||
commist.register('help', help.toStdout)
|
||||
|
||||
commist.parse(process.argv.splice(2))
|
||||
```
|
||||
|
||||
Acknowledgements
|
||||
----------------
|
||||
|
||||
This project was kindly sponsored by [nearForm](http://nearform.com).
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
MIT
|
1
node_modules/help-me/doc/hello.txt
generated
vendored
Normal file
1
node_modules/help-me/doc/hello.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
this is hello world
|
1
node_modules/help-me/doc/help.txt
generated
vendored
Normal file
1
node_modules/help-me/doc/help.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
aaaaa
|
8
node_modules/help-me/example.js
generated
vendored
Normal file
8
node_modules/help-me/example.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
var commist = require('commist')()
|
||||
var help = require('./')()
|
||||
|
||||
commist.register('help', help.toStdout)
|
||||
|
||||
commist.parse(process.argv.splice(2))
|
1
node_modules/help-me/fixture/basic/hello.txt
generated
vendored
Normal file
1
node_modules/help-me/fixture/basic/hello.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
ahdsadhdash
|
1
node_modules/help-me/fixture/basic/help.txt
generated
vendored
Normal file
1
node_modules/help-me/fixture/basic/help.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
hello world
|
0
node_modules/help-me/fixture/dir/a/b.txt
generated
vendored
Normal file
0
node_modules/help-me/fixture/dir/a/b.txt
generated
vendored
Normal file
1
node_modules/help-me/fixture/no-ext/hello
generated
vendored
Normal file
1
node_modules/help-me/fixture/no-ext/hello
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
ghghghhg
|
1
node_modules/help-me/fixture/shortnames/abcde fghi lmno.txt
generated
vendored
Normal file
1
node_modules/help-me/fixture/shortnames/abcde fghi lmno.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
ewweqjewqjewqj
|
1
node_modules/help-me/fixture/shortnames/abcde hello.txt
generated
vendored
Normal file
1
node_modules/help-me/fixture/shortnames/abcde hello.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
45678
|
1
node_modules/help-me/fixture/shortnames/hello world.txt
generated
vendored
Normal file
1
node_modules/help-me/fixture/shortnames/hello world.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
12345
|
85
node_modules/help-me/help-me.js
generated
vendored
Normal file
85
node_modules/help-me/help-me.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var through = require('through2')
|
||||
var globStream = require('glob-stream')
|
||||
var concat = require('callback-stream')
|
||||
var xtend = require('xtend')
|
||||
|
||||
var defaults = {
|
||||
dir: path.join(path.dirname(require.main.filename), 'doc'),
|
||||
ext: '.txt',
|
||||
help: 'help'
|
||||
}
|
||||
|
||||
function helpMe (opts) {
|
||||
opts = xtend(defaults, opts)
|
||||
|
||||
if (!opts.dir) {
|
||||
throw new Error('missing directory')
|
||||
}
|
||||
|
||||
return {
|
||||
createStream: createStream,
|
||||
toStdout: toStdout
|
||||
}
|
||||
|
||||
function createStream (args) {
|
||||
if (typeof args === 'string') {
|
||||
args = args.split(' ')
|
||||
} else if (!args || args.length === 0) {
|
||||
args = [opts.help]
|
||||
}
|
||||
|
||||
var out = through()
|
||||
var gs = globStream([opts.dir + '/**/*' + opts.ext])
|
||||
var re = new RegExp(args.map(function (arg) {
|
||||
return arg + '[a-zA-Z0-9]*'
|
||||
}).join('[ /]+'))
|
||||
|
||||
gs.pipe(concat({ objectMode: true }, function (err, files) {
|
||||
if (err) return out.emit('error', err)
|
||||
|
||||
files = files.map(function (file) {
|
||||
file.relative = file.path.replace(file.base, '').replace(/^\//, '')
|
||||
return file
|
||||
}).filter(function (file) {
|
||||
return file.relative.match(re)
|
||||
})
|
||||
|
||||
if (files.length === 0) {
|
||||
return out.emit('error', new Error('no such help file'))
|
||||
} else if (files.length > 1) {
|
||||
out.write('There are ' + files.length + ' help pages ')
|
||||
out.write('that matches the given request, please disambiguate:\n')
|
||||
files.forEach(function (file) {
|
||||
out.write(' * ')
|
||||
out.write(file.relative.replace(opts.ext, ''))
|
||||
out.write('\n')
|
||||
})
|
||||
out.end()
|
||||
return
|
||||
}
|
||||
|
||||
fs.createReadStream(files[0].path)
|
||||
.on('error', function (err) {
|
||||
out.emit('error', err)
|
||||
})
|
||||
.pipe(out)
|
||||
}))
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
function toStdout (args) {
|
||||
createStream(args)
|
||||
.on('error', function () {
|
||||
console.log('no such help file\n')
|
||||
toStdout()
|
||||
})
|
||||
.pipe(process.stdout)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = helpMe
|
67
node_modules/help-me/package.json
generated
vendored
Normal file
67
node_modules/help-me/package.json
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "help-me@^1.0.1",
|
||||
"_id": "help-me@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-jy1QjQYAtKRW2i8IZVbn5cBWo8Y=",
|
||||
"_location": "/help-me",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "help-me@^1.0.1",
|
||||
"name": "help-me",
|
||||
"escapedName": "help-me",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mqtt"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/help-me/-/help-me-1.1.0.tgz",
|
||||
"_shasum": "8f2d508d0600b4a456da2f086556e7e5c056a3c6",
|
||||
"_spec": "help-me@^1.0.1",
|
||||
"_where": "/home/wn/workspace-node/PiAlive/node_modules/mqtt",
|
||||
"author": {
|
||||
"name": "Matteo Collina",
|
||||
"email": "hello@matteocollina.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mcollina/help-me/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"callback-stream": "^1.0.2",
|
||||
"glob-stream": "^6.1.0",
|
||||
"through2": "^2.0.1",
|
||||
"xtend": "^4.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Help command for node, partner of minimist and commist",
|
||||
"devDependencies": {
|
||||
"commist": "^1.0.0",
|
||||
"concat-stream": "^1.4.7",
|
||||
"faucet": "0.0.1",
|
||||
"pre-commit": "^1.1.3",
|
||||
"standard": "^9.0.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"homepage": "https://github.com/mcollina/help-me",
|
||||
"keywords": [
|
||||
"help",
|
||||
"command",
|
||||
"minimist",
|
||||
"commist"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "help-me.js",
|
||||
"name": "help-me",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mcollina/help-me.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test.js | faucet"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
193
node_modules/help-me/test.js
generated
vendored
Normal file
193
node_modules/help-me/test.js
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
var concat = require('concat-stream')
|
||||
var fs = require('fs')
|
||||
var helpMe = require('./')
|
||||
|
||||
test('show the doc/help.txt from the require.main folder if no options are passed', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helpMe()
|
||||
.createStream()
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('./doc/help.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
test('show a generic help.txt from a folder to a stream', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helpMe({
|
||||
dir: 'fixture/basic'
|
||||
}).createStream()
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/basic/help.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
test('custom help command with an array', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helpMe({
|
||||
dir: 'fixture/basic'
|
||||
}).createStream(['hello'])
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/basic/hello.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
test('custom help command without an ext', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helpMe({
|
||||
dir: 'fixture/no-ext',
|
||||
ext: ''
|
||||
}).createStream(['hello'])
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/no-ext/hello', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
test('custom help command with a string', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helpMe({
|
||||
dir: 'fixture/basic'
|
||||
}).createStream('hello')
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/basic/hello.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
test('missing help file', function (t) {
|
||||
t.plan(1)
|
||||
|
||||
helpMe({
|
||||
dir: 'fixture/basic'
|
||||
}).createStream('abcde')
|
||||
.on('error', function (err) {
|
||||
t.equal(err.message, 'no such help file')
|
||||
})
|
||||
.resume()
|
||||
})
|
||||
|
||||
test('custom help command with an array', function (t) {
|
||||
var helper = helpMe({
|
||||
dir: 'fixture/shortnames'
|
||||
})
|
||||
|
||||
t.test('abbreviates two words in one', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helper
|
||||
.createStream(['world'])
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/shortnames/hello world.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
t.test('abbreviates three words in two', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helper
|
||||
.createStream(['abcde', 'fghi'])
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/shortnames/abcde fghi lmno.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
t.test('abbreviates a word', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helper
|
||||
.createStream(['abc', 'fg'])
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/shortnames/abcde fghi lmno.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
t.test('abbreviates a word using strings', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helper
|
||||
.createStream('abc fg')
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/shortnames/abcde fghi lmno.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
t.test('print a disambiguation', function (t) {
|
||||
t.plan(1)
|
||||
|
||||
var expected = '' +
|
||||
'There are 2 help pages that matches the given request, please disambiguate:\n' +
|
||||
' * abcde fghi lmno\n' +
|
||||
' * abcde hello\n'
|
||||
|
||||
helper
|
||||
.createStream(['abc'])
|
||||
.pipe(concat({ encoding: 'string' }, function (data) {
|
||||
t.equal(data, expected)
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
||||
test('support for help files organized in folders', function (t) {
|
||||
var helper = helpMe({
|
||||
dir: 'fixture/dir'
|
||||
})
|
||||
|
||||
t.test('passing an array', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helper
|
||||
.createStream(['a', 'b'])
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/dir/a/b.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
||||
t.test('passing a string', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
helper
|
||||
.createStream('a b')
|
||||
.pipe(concat(function (data) {
|
||||
fs.readFile('fixture/dir/a/b.txt', function (err, expected) {
|
||||
t.error(err)
|
||||
t.equal(data.toString(), expected.toString())
|
||||
})
|
||||
}))
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user