summaryrefslogtreecommitdiffstats
path: root/bin/build.js
diff options
context:
space:
mode:
Diffstat (limited to 'bin/build.js')
-rw-r--r--bin/build.js45
1 files changed, 9 insertions, 36 deletions
diff --git a/bin/build.js b/bin/build.js
index 37415bd..257715d 100644
--- a/bin/build.js
+++ b/bin/build.js
@@ -12,12 +12,7 @@ var buildCommand = function(command) {
return command
.option('-o, --output <directory>', 'Path to output directory, defaults to ./_book')
.option('-f, --format <name>', 'Change generation format, defaults to site, availables are: '+_.keys(generators).join(", "))
- .option('-t, --title <name>', 'Name of the book to generate, default is extracted from readme')
- .option('-i, --intro <intro>', 'Description of the book to generate, default is extracted from readme')
- .option('--plugins <plugins>', 'List of plugins to use separated by ","')
- .option('--pluginsConfig <json file>', 'JSON File containing plugins configuration')
- .option('-g, --github <repo_path>', 'ID of github repo like : username/repo')
- .option('--githubHost <url>', 'The url of the github host (defaults to https://github.com/');
+ .option('--config <config file>', 'Configuration file to use, defualt to book.json')
};
@@ -26,37 +21,15 @@ var makeBuildFunc = function(converter) {
dir = dir || process.cwd();
outputDir = options.output;
- // Read plugins config
- var pluginsConfig = {};
- if (options.pluginsConfig) {
- pluginsConfig = JSON.parse(fs.readFileSync(options.pluginsConfig))
- }
-
-
console.log('Starting build ...');
- // Get repo's URL
- return utils.gitURL(dir)
- .then(function(url) {
- // Get ID of repo
- return utils.githubID(url);
- }, function(err) {
- return null;
- })
- .then(function(repoID) {
- return converter(
- _.extend({}, options || {}, {
- input: dir,
- output: outputDir,
- title: options.title,
- description: options.intro,
- github: options.github || repoID,
- githubHost: options.githubHost,
- generator: options.format,
- plugins: options.plugins,
- pluginsConfig: pluginsConfig
- })
- );
- })
+ return converter(
+ _.extend({}, options || {}, {
+ input: dir,
+ output: outputDir,
+ generator: options.format,
+ configFile: options.config
+ })
+ )
.then(function(output) {
console.log("Successfuly built !");
return output;