diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-19 17:57:40 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-19 17:57:40 +0200 |
commit | cc8516df8315875adc9403881cddaf8ba06fd411 (patch) | |
tree | 32bdf3a977ec8c2d52c132194b760ed6e4bc9de5 /lib | |
parent | c6a624bc6b8e95d186a268c724031087cca8d681 (diff) | |
download | gitbook-cc8516df8315875adc9403881cddaf8ba06fd411.zip gitbook-cc8516df8315875adc9403881cddaf8ba06fd411.tar.gz gitbook-cc8516df8315875adc9403881cddaf8ba06fd411.tar.bz2 |
Load plugins during generation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/generate/generator.js | 8 | ||||
-rw-r--r-- | lib/generate/index.js | 3 | ||||
-rw-r--r-- | lib/generate/plugin.js | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/generate/generator.js b/lib/generate/generator.js index d9ec286..9d50c92 100644 --- a/lib/generate/generator.js +++ b/lib/generate/generator.js @@ -9,6 +9,14 @@ var BaseGenerator = function(options) { this.options = options; this.options.plugins = Plugin.normalizeNames(this.options.plugins); + this.plugins = []; +}; + +BaseGenerator.prototype.loadPlugins = function() { + return Plugin.fromList(this.options.plugins) + .then(function(_plugins) { + this.plugins = _plugins; + }.bind(this)); }; BaseGenerator.prototype.convertFile = function(content, input) { diff --git a/lib/generate/index.js b/lib/generate/index.js index f0e945f..b82a8ca 100644 --- a/lib/generate/index.js +++ b/lib/generate/index.js @@ -71,9 +71,10 @@ var generate = function(options) { }) }) - // Create the generator + // Create the generator and load plugins .then(function() { generator = new generators[options.generator](options); + return generator.loadPlugins(); }) // Detect multi-languages book diff --git a/lib/generate/plugin.js b/lib/generate/plugin.js index 27c1cc9..1271eb3 100644 --- a/lib/generate/plugin.js +++ b/lib/generate/plugin.js @@ -83,7 +83,7 @@ Plugin.fromList = function(names) { .value(); return Q({ - 'plugins': plugins, + 'list': plugins, 'resources': resources }); }; |