diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-02-16 23:30:08 +0100 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-02-16 23:30:08 +0100 |
commit | db3d21db49a7260df03ae987b58c495178193dde (patch) | |
tree | 06d14b1dd71f0ba12c03b54986e6bb3dbf3aa5c3 /lib | |
parent | ca85c0ecf35eb2265b35ae480fbe34b12cf4bafe (diff) | |
download | gitbook-db3d21db49a7260df03ae987b58c495178193dde.zip gitbook-db3d21db49a7260df03ae987b58c495178193dde.tar.gz gitbook-db3d21db49a7260df03ae987b58c495178193dde.tar.bz2 |
Start commands for plugins installation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/index.js | 36 | ||||
-rw-r--r-- | lib/output/base.js | 4 | ||||
-rw-r--r-- | lib/output/conrefs.js | 7 | ||||
-rw-r--r-- | lib/output/json.js | 5 | ||||
-rw-r--r-- | lib/output/website/index.js | 5 | ||||
-rw-r--r-- | lib/plugins/index.js | 8 |
6 files changed, 56 insertions, 9 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')); + }); + } + }, + + ] }; diff --git a/lib/output/base.js b/lib/output/base.js index fede3da..ce0a9c6 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -150,4 +150,8 @@ Output.prototype.finish = function() { }; +Output.createMixin = function(def) { + +}; + module.exports = Output; diff --git a/lib/output/conrefs.js b/lib/output/conrefs.js index 98230d9..c91885e 100644 --- a/lib/output/conrefs.js +++ b/lib/output/conrefs.js @@ -1,4 +1,3 @@ -var util = require('util'); var path = require('path'); var Output = require('./base'); @@ -10,11 +9,9 @@ var pathUtil = require('../utils/path'); Middleware for output to resolve git conrefs */ -function ConrefsLoader() { - Output.apply(this, arguments); +var ConrefsLoader = Output.createMixin(function() { this.git = new Git(); -} -util.inherits(ConrefsLoader, Output); +}); // Read a template by its source URL ConrefsLoader.prototype.onGetTemplate = function(sourceURL) { diff --git a/lib/output/json.js b/lib/output/json.js index a77b45a..f146023 100644 --- a/lib/output/json.js +++ b/lib/output/json.js @@ -1,10 +1,13 @@ var util = require('util'); +var FolderOutput = require('./folder'); var ConrefsLoader = require('./conrefs'); var gitbook = require('../gitbook'); function JSONOutput() { - ConrefsLoader.apply(this, arguments); + FolderOutput.apply(this, arguments); + ConrefsLoader.apply(this); } +util.inherits(JSONOutput, FolderOutput); util.inherits(JSONOutput, ConrefsLoader); JSONOutput.prototype.name = 'json'; diff --git a/lib/output/website/index.js b/lib/output/website/index.js index 7322a57..fc9bc6b 100644 --- a/lib/output/website/index.js +++ b/lib/output/website/index.js @@ -1,11 +1,14 @@ var util = require('util'); +var FolderOutput = require('../folder'); var ConrefsLoader = require('../conrefs'); var Theme = require('./theme'); function WebsiteOutput() { - ConrefsLoader.apply(this, arguments); + FolderOutput.apply(this, arguments); + ConrefsLoader.apply(this); } +util.inherits(WebsiteOutput, FolderOutput); util.inherits(WebsiteOutput, ConrefsLoader); WebsiteOutput.prototype.name = 'website'; diff --git a/lib/plugins/index.js b/lib/plugins/index.js index ac595ac..14a323a 100644 --- a/lib/plugins/index.js +++ b/lib/plugins/index.js @@ -2,7 +2,7 @@ var _ = require('lodash'); var Promise = require('../utils/promise'); var BookPlugin = require('./plugin'); - +var registry = require('./registry'); /* PluginsManager is an interface to work with multiple plugins at once: @@ -13,6 +13,7 @@ PluginsManager is an interface to work with multiple plugins at once: function PluginsManager(output) { this.output = output; this.book = output.book; + this.log = this.book.log; this.plugins = []; } @@ -62,4 +63,9 @@ PluginsManager.prototype._setup = function(plugin) { }; +// Install all plugins for the book +PluginsManager.prototype.install = function() { + +}; + module.exports = PluginsManager; |