summaryrefslogtreecommitdiffstats
path: root/lib/index.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-02-16 23:30:08 +0100
committerSamy Pesse <samypesse@gmail.com>2016-02-16 23:30:08 +0100
commitdb3d21db49a7260df03ae987b58c495178193dde (patch)
tree06d14b1dd71f0ba12c03b54986e6bb3dbf3aa5c3 /lib/index.js
parentca85c0ecf35eb2265b35ae480fbe34b12cf4bafe (diff)
downloadgitbook-db3d21db49a7260df03ae987b58c495178193dde.zip
gitbook-db3d21db49a7260df03ae987b58c495178193dde.tar.gz
gitbook-db3d21db49a7260df03ae987b58c495178193dde.tar.bz2
Start commands for plugins installation
Diffstat (limited to 'lib/index.js')
-rw-r--r--lib/index.js36
1 files changed, 35 insertions, 1 deletions
diff --git a/lib/index.js b/lib/index.js
index 59346f2..e0d43eb 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,6 +1,40 @@
var Book = require('./book');
var Output = require('./output');
+var NodeFS = require('./fs/node');
+
+// Setup a Book for the arguments
+function setupBook(args) {
+ var input = args[0] || process.cwd();
+ return new Book({
+ fs: new NodeFS(),
+ root: input
+ });
+}
+
+// Setup an Output for the arguments
+function setupOutput(Out, args) {
+ return new Out(setupBook(args));
+}
module.exports = {
- Book: Book
+ Book: Book,
+ commands: [
+ {
+ name: 'install [book]',
+ description: 'install all plugins dependencies',
+ exec: function(args) {
+ var book = setupBook(args);
+
+ return book.config.load()
+ .then(function() {
+ return book.plugins.install();
+ })
+ .then(function(){
+ console.log('');
+ console.log(color.green('Done, without error'));
+ });
+ }
+ },
+
+ ]
};