{"_id":"boot-in-the-arse","_rev":"1926540","name":"boot-in-the-arse","description":"Asynchronous bootstrapping of Node applications","dist-tags":{"latest":"0.3.0"},"maintainers":[{"name":"matteo.collina","email":""}],"time":{"modified":"2021-12-09T13:49:18.000Z","created":"2016-08-05T13:43:23.415Z","0.3.0":"2016-10-20T16:50:33.057Z","0.2.1":"2016-10-02T13:22:36.900Z","0.2.0":"2016-08-30T12:11:02.247Z","0.1.0":"2016-08-16T07:01:52.970Z","0.0.1":"2016-08-05T13:43:23.415Z"},"users":{"gergelyke":true},"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"repository":{"type":"git","url":"git+https://github.com/mcollina/boot-in-the-arse.git"},"versions":{"0.3.0":{"name":"boot-in-the-arse","version":"0.3.0","description":"Asynchronous bootstrapping of Node applications","main":"boot.js","scripts":{"test":"standard && tap test/*.js"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/boot-in-the-arse.git"},"keywords":["async","boot","delayed","open"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/boot-in-the-arse/issues"},"homepage":"https://github.com/mcollina/boot-in-the-arse#readme","devDependencies":{"express":"^4.14.0","pre-commit":"^1.1.3","standard":"^7.1.2","tap":"^6.3.0"},"dependencies":{"fastq":"^1.4.1"},"gitHead":"8003cb37004cdf14eea45535f56da3b32dd36333","_id":"boot-in-the-arse@0.3.0","_shasum":"9bb68cb5b27b50d914f4918052382b1dcbc631cc","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"9bb68cb5b27b50d914f4918052382b1dcbc631cc","size":6877,"noattachment":false,"key":"/boot-in-the-arse/-/boot-in-the-arse-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/boot-in-the-arse/download/boot-in-the-arse-0.3.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/boot-in-the-arse-0.3.0.tgz_1476982232430_0.9677014304324985"},"directories":{},"publish_time":1476982233057,"_cnpm_publish_time":1476982233057,"_hasShrinkwrap":false},"0.2.1":{"name":"boot-in-the-arse","version":"0.2.1","description":"Asynchronous bootstrapping of Node applications","main":"boot.js","scripts":{"test":"standard && tap test/*.js"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/boot-in-the-arse.git"},"keywords":["async","boot","delayed","open"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/boot-in-the-arse/issues"},"homepage":"https://github.com/mcollina/boot-in-the-arse#readme","devDependencies":{"express":"^4.14.0","pre-commit":"^1.1.3","standard":"^7.1.2","tap":"^6.3.0"},"dependencies":{"fastq":"^1.4.1"},"gitHead":"4715d7ba28a648b0fe24290c62901cd05d7b4ce5","_id":"boot-in-the-arse@0.2.1","_shasum":"0580d72e8c543b9ef8c5d76b290e98f59c477827","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.7.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"0580d72e8c543b9ef8c5d76b290e98f59c477827","size":6503,"noattachment":false,"key":"/boot-in-the-arse/-/boot-in-the-arse-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/boot-in-the-arse/download/boot-in-the-arse-0.2.1.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/boot-in-the-arse-0.2.1.tgz_1475414555551_0.9018543011043221"},"directories":{},"publish_time":1475414556900,"_cnpm_publish_time":1475414556900,"_hasShrinkwrap":false},"0.2.0":{"name":"boot-in-the-arse","version":"0.2.0","description":"Asynchronous bootstrapping of Node applications","main":"boot.js","scripts":{"test":"standard && tap test/*.js"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/boot-in-the-arse.git"},"keywords":["async","boot","delayed","open"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/boot-in-the-arse/issues"},"homepage":"https://github.com/mcollina/boot-in-the-arse#readme","devDependencies":{"express":"^4.14.0","pre-commit":"^1.1.3","standard":"^7.1.2","tap":"^6.3.0"},"dependencies":{"fastq":"^1.4.1"},"gitHead":"f153f7f3abcef490ee80da72c8aae722483ad5e3","_id":"boot-in-the-arse@0.2.0","_shasum":"93a72ff8fe160e97a6fc55d92396ab8e71654599","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.5.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"93a72ff8fe160e97a6fc55d92396ab8e71654599","size":6443,"noattachment":false,"key":"/boot-in-the-arse/-/boot-in-the-arse-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/boot-in-the-arse/download/boot-in-the-arse-0.2.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/boot-in-the-arse-0.2.0.tgz_1472559060397_0.5634636925533414"},"directories":{},"publish_time":1472559062247,"_cnpm_publish_time":1472559062247,"_hasShrinkwrap":false},"0.1.0":{"name":"boot-in-the-arse","version":"0.1.0","description":"Asynchronous bootstrapping of Node applications","main":"boot.js","scripts":{"test":"standard && tap test/*.js"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/boot-in-the-arse.git"},"keywords":["async","boot","delayed","open"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/boot-in-the-arse/issues"},"homepage":"https://github.com/mcollina/boot-in-the-arse#readme","devDependencies":{"pre-commit":"^1.1.3","standard":"^7.1.2","tap":"^6.3.0"},"dependencies":{"fastq":"^1.4.1"},"gitHead":"44fc1fb1aad9b8720e6869002e351babb277385c","_id":"boot-in-the-arse@0.1.0","_shasum":"41f03e38e3768a4d963a0744c0342fefad9dd23f","_from":".","_npmVersion":"3.10.5","_nodeVersion":"4.4.5","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"41f03e38e3768a4d963a0744c0342fefad9dd23f","size":4292,"noattachment":false,"key":"/boot-in-the-arse/-/boot-in-the-arse-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/boot-in-the-arse/download/boot-in-the-arse-0.1.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/boot-in-the-arse-0.1.0.tgz_1471330911370_0.9502336592413485"},"directories":{},"publish_time":1471330912970,"_cnpm_publish_time":1471330912970,"_hasShrinkwrap":false},"0.0.1":{"name":"boot-in-the-arse","version":"0.0.1","description":"Asynchronous bootstrapping of Node applications","main":"boot.js","scripts":{"test":"standard && tap test.js"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/boot-in-the-arse.git"},"keywords":["async","boot","delayed","open"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/boot-in-the-arse/issues"},"homepage":"https://github.com/mcollina/boot-in-the-arse#readme","devDependencies":{"pre-commit":"^1.1.3","standard":"^7.1.2","tap":"^6.3.0"},"dependencies":{"fastq":"^1.4.1","inherits":"^2.0.1"},"gitHead":"cfcc748fb8320df0401519edc0e44761285adf31","_id":"boot-in-the-arse@0.0.1","_shasum":"2dd4fc4c9f94d4dbf7a1b88909ade54a9a366273","_from":".","_npmVersion":"3.10.5","_nodeVersion":"4.4.5","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"2dd4fc4c9f94d4dbf7a1b88909ade54a9a366273","size":2290,"noattachment":false,"key":"/boot-in-the-arse/-/boot-in-the-arse-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/boot-in-the-arse/download/boot-in-the-arse-0.0.1.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/boot-in-the-arse-0.0.1.tgz_1470404601701_0.4245321820490062"},"directories":{},"publish_time":1470404603415,"_cnpm_publish_time":1470404603415,"_hasShrinkwrap":false}},"readme":"# boot-in-the-arse &nbsp;&nbsp;[![Build Status](https://travis-ci.org/mcollina/boot-in-the-arse.svg)](https://travis-ci.org/mcollina/boot-in-the-arse)\n\nAsynchronous bootstrapping made easy. Wait for all components/plugins to start, and then start your whole app.\n\n`boot-in-the-arse` is fully reentrant and graph-based. You can load\ncomponents/plugins _within_ plugins, and be still sure that things will\nhappen in the right order.\n\n[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\n* [Install](#install)\n* [Example](#example)\n* [API](#api)\n* [Acknowledgements](#acknowledgements)\n* [License](#license)\n\n<a name=\"install\"></a>\n## Install\n\nTo install `boot-in-the-arse`, simply use npm:\n\n```\nnpm install boot-in-the-arse --save\n```\n\n<a name=\"example\"></a>\n## Example\n\nThe example below can be found [here][example] and ran using `node example.js`. It\ndemonstrates how to use `boot-in-the-arse` to load functions /\nplugins in\norder.\n\n\n```js\n'use strict'\n\nconst boot = require('boot-in-the-arse')()\n\nboot\n  .use(first, { hello: 'world' })\n  .after((cb) => {\n    console.log('after first and second')\n    cb()\n  })\n  .use(third, (err) => {\n    if (err) {\n      console.log('something bad happened')\n      console.log(err)\n    }\n\n    console.log('third plugin loaded')\n  })\n  .ready(function () {\n    console.log('application booted!')\n  })\n\nfunction first (instance, opts, cb) {\n  console.log('first loaded', opts)\n  instance.use(second, cb)\n}\n\nfunction second (instance, opts, cb) {\n  console.log('second loaded')\n  process.nextTick(cb)\n}\n\nfunction third (instance, opts, cb) {\n  console.log('third loaded')\n  cb()\n}\n```\n\n<a name=\"api\"></a>\n## API\n\n  * <a href=\"#constructor\"><code><b>boot()</b></code></a>\n  * <a href=\"#use\"><code>instance.<b>use()</b></code></a>\n  * <a href=\"#after\"><code>instance.<b>after()</b></code></a>\n  * <a href=\"#ready\"><code>instance.<b>ready()</b></code></a>\n  * <a href=\"#express\"><code>boot.<b>express()</b></code></a>\n\n-------------------------------------------------------\n<a name=\"constructor\"></a>\n\n### boot([instance], [started])\n\nStart a booting sequence.\n\n`instance` will be used as the first\nargument of all plugins loaded and `use`, `after` and `ready` \nfunction will be\nadded to that object, keeping the support for the chainable API:\n\n```js\nconst server = {}\n\nrequire('boot-in-the-arse')(server)\n\nserver.use(function first (s, opts, cb) {\n  // s is the same of server\n  s.use(function second (s, opts, cb) {\n    cb()\n  }, cb)\n}).after(function (cb) {\n  // after first and second are finished\n  cb()\n})\n```\n\nOptions:\n\n* `expose`: a key/value property to change how `use`, `after` and `ready` are exposed.\n\nEvents:\n\n* `'error'`  if something bad happens\n* `'start'`  when the application starts\n\nThe `boot` function can be used also as a\nconstructor to inherits from.\n\n-------------------------------------------------------\n<a name=\"use\"></a>\n\n### app.use(func, [opts], [cb])\n\nLoads a functions asynchronously. The function must have the\nsignature:\n\n```js\nfunction plugin (server, opts, done) {\n  done()\n}\n```\n`done` must be called only once.\n\nReturns the instance on which `use` is called, to support a\nchainable API.\n\nIf you need to add more than a function and you don't need to use a different options object or callback, you can pass an array of functions to `.use`.\n```js\nboot.use([first, second, third], opts, cb)\n```\nThe functions will be loaded in the same order as they are inside the array.\n\n-------------------------------------------------------\n<a name=\"after\"></a>\n\n### app.after(func([done]), [cb])\n\nCalls a functon after all the previously defined plugins are loaded, including\nall their dependencies. The `'start'` event is not emitted yet.\n\n```js\nboot.after(function (done) {\n  done()\n})\n```\n\n`done` must be called only once.\n\nReturns the instance on which `after` is called, to support a\nchainable API.\n\n-------------------------------------------------------\n<a name=\"ready\"></a>\n\n### app.ready(func([done]))\n\nCalls a functon after all the plugins and `after` call are\ncompleted, but befer `'start'` is emitted. `ready` callbacks are\nexecuted one at a time.\n\n```js\nboot.ready(function (done) {\n  done()\n})\n```\n\n`done` must be called only once.\n\nReturns the instance on which `ready` is called, to support a\nchainable API.\n\n-------------------------------------------------------\n<a name=\"express\"></a>\n\n### boot.express(app)\n\nSame as:\n\n```js\nconst app = express()\n\nboot(app, {\n  expose: {\n    use: 'load'\n  }\n})\n```\n\n-------------------------------------------------------\n\n## Acknowledgements\n\nThis project was kindly sponsored by [nearForm](http://nearform.com).\n\n## License\n\nCopyright Matteo Collina 2016, Licensed under [MIT][].\n\n[MIT]: ./LICENSE\n[example]: ./example.js\n","_attachments":{},"homepage":"https://github.com/mcollina/boot-in-the-arse#readme","bugs":{"url":"https://github.com/mcollina/boot-in-the-arse/issues"},"license":"MIT"}