mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Start commands for plugins installation
This commit is contained in:
+35
-1
@@ -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'));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
};
|
||||
|
||||
@@ -150,4 +150,8 @@ Output.prototype.finish = function() {
|
||||
|
||||
};
|
||||
|
||||
Output.createMixin = function(def) {
|
||||
|
||||
};
|
||||
|
||||
module.exports = Output;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+4
-1
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user