amass
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -5,6 +5,7 @@ { | ||
"author": "Dave Eddy <dave@daveeddy.com> (http://www.daveeddy.com)", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"bin": { | ||
"amass": "./bin/amass.js" | ||
}, | ||
"preferGlobal": true, | ||
"scripts": { | ||
@@ -22,2 +23,5 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=0.8" | ||
}, | ||
"dependencies": { | ||
@@ -24,0 +28,0 @@ "latest": "~0.1.0", |
@@ -10,2 +10,3 @@ var fs = require('fs'); | ||
var p = path.join(basedir, 'package.json'); | ||
var readme = path.join(basedir, 'README.md'); | ||
@@ -26,3 +27,3 @@ module.exports.basedir = dir; | ||
_check_exists(); | ||
var command = ['npm', 'ls'] | ||
var command = ['npm', 'ls', '--depth', '0'] | ||
exec(command, {cwd: basedir}, cb); | ||
@@ -40,2 +41,3 @@ } | ||
fs.mkdirSync(basedir); | ||
fs.writeFileSync(readme, ''); | ||
} catch (e) {} | ||
@@ -42,0 +44,0 @@ var data = { |
@@ -9,10 +9,4 @@ amass | ||
Command line tool | ||
npm install -g amass | ||
Node module | ||
npm install amass | ||
Usage | ||
@@ -38,2 +32,14 @@ ----- | ||
By default, amass exposes 3 keys | ||
amass | json -k | ||
[ | ||
"amass", | ||
"os", | ||
"process" | ||
] | ||
You can extend this by writing [plugins](#plugins) | ||
Why? | ||
@@ -58,9 +64,7 @@ ---- | ||
*still in beta* | ||
### *still in beta* | ||
All plugins will be stored in `/var/amass`. The idea is that plugins should be standalone | ||
node modules that expose useful system information, and as such, be installed in node\_modules | ||
in `/var/amass`. | ||
Extend the functionality of `amass` by writing/using plugins | ||
#### how to | ||
### how to add plugins | ||
@@ -86,3 +90,3 @@ You may need to `sudo` some of these commands. | ||
That shows you the installed plugins and their dependencies. If the output | ||
looks familiar to you sharp eye ;), The output is straight from `npm`. | ||
looks familiar to you, it's because it is straight from `npm`. | ||
@@ -104,3 +108,40 @@ Now, remove the plugin | ||
### write your own plugins | ||
As of right now, a module must be published to npm before it can be used, | ||
or symlinked to `/var/amass/node_modules`. Let's create a simple hello world | ||
plugin. | ||
`/var/amass/node_modules/my_plugin/index.js` | ||
``` js | ||
module.exports = function(cb) { | ||
var data = { | ||
"name": "dave", | ||
"hello": "world" | ||
}; | ||
cb(null, data); | ||
}; | ||
``` | ||
There you go, that's it. Now, when you run `amass`, you will see your data. | ||
$ amass | json my_plugin | ||
{ | ||
"name": "dave", | ||
"hello": "world" | ||
} | ||
To write a module, have your `exports` be a function that takes a single | ||
argument (the callback), and call it with your data (or any error. | ||
The key that the data will have in the `amass` output is the name of your | ||
module. | ||
### technical details | ||
1. Plugins are stored in `/var/amass`, this directory is created lazily | ||
when invoked with an option that pertains to plugins. | ||
2. Plugins should be standalone node modules that expose useful system | ||
information, and as such, be installed in node\_modules in `/var/amass`. | ||
License | ||
@@ -107,0 +148,0 @@ ------- |
9488
213
146