diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-09 10:43:12 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-09 10:43:12 +0100 |
commit | 34fc2831e0cf0fed01c71cec28d93472d87f455b (patch) | |
tree | a803cc907c20491ba02863b5d3dd5aedf6bfed10 /bin/build.js | |
parent | e1594cde2c32e4ff48f6c4eff3d3d461743d74e1 (diff) | |
parent | 1bf68a5aa0703b5a1815cfe4ebb731b5fb6ed9d2 (diff) | |
download | gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.zip gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.tar.gz gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.tar.bz2 |
Merge branch 'version/2.0'
Diffstat (limited to 'bin/build.js')
-rw-r--r-- | bin/build.js | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/bin/build.js b/bin/build.js deleted file mode 100644 index 28d7641..0000000 --- a/bin/build.js +++ /dev/null @@ -1,56 +0,0 @@ -var path = require('path'); -var Q = require('q'); -var _ = require('lodash'); -var fs = require('fs'); - -var utils = require('./utils'); -var generate = require("../lib/generate"); -var parse = require("../lib/parse"); -var generators = require("../lib/generate").generators; - -var buildCommand = function(command) { - return command - .option('-v, --verbose', 'Activate verbose mode, useful for debugging errors') - .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('--config <config file>', 'Configuration file to use, defaults to book.js or book.json'); -}; - - -var buildEbookCommand = function(command) { - return buildCommand(command) - .option('-c, --cover <path>', 'Cover image, default is cover.jpg if exists'); -}; - -var makeBuildFunc = function(converter) { - return function(dir, options) { - dir = dir || process.cwd(); - outputDir = options.output; - - // Set debugging - if(options.verbose) { - process.env.DEBUG = "true"; - } - - console.log('Starting build ...'); - return converter( - _.extend({}, options || {}, { - input: dir, - output: outputDir, - generator: options.format, - configFile: options.config - }) - ) - .then(function(output) { - console.log("Successfully built!"); - return output; - }); - }; -}; - -module.exports = { - folder: makeBuildFunc(generate.folder), - file: makeBuildFunc(generate.file), - command: buildCommand, - commandEbook: buildEbookCommand -}; |