diff --git a/README.md b/README.md index c72bc1e..84a982e 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,12 @@ should output JavaScript object like ``` +## Force a specific gitbook version +You can test your plugin against a specific gitbook version by providing ENV variable like ```GITBOOK_VERSION=2.6.7```. This could be used for example in [Travis-CI build matrix](https://docs.travis-ci.com/user/customizing-the-build/#Build-Matrix). + +## Debugging +If you wish to see detailed output of the build and gitbook logs itself, provide ENV variable ```DEBUG=true```. + ## Complete test example How to write simple test, using node-jasmine. ```js diff --git a/lib/tester.js b/lib/tester.js index 65368fe..22e654f 100644 --- a/lib/tester.js +++ b/lib/tester.js @@ -34,7 +34,7 @@ var createBook = function(content, children) { }); var summaryContent = '# Summary\n\n* [Introduction](README.md)' +'\n'+ summaryPages.join('\n'); - + var summary = Q.nfcall(fs.writeFile, path.join(dirPath, 'SUMMARY.md'), summaryContent); var readme = Q.nfcall(fs.writeFile, path.join(dirPath, 'README.md'), content); @@ -135,7 +135,13 @@ var includeFiles = function(bookPath, files) { // execute 'gitbook build /temp/path/to/generated/book' var build = function(bookPath) { - return runCommand(gitbookRunnablePath(), ['build', bookPath]) + var command = ['build', bookPath]; + var gitbookVersion = process.env.GITBOOK_VERSION; + if(gitbookVersion) { + winston.info('Using gitbook version ' + gitbookVersion); + command.push('--gitbook=' + gitbookVersion); + } + return runCommand(gitbookRunnablePath(), command) .then(function(){return bookPath;}); }; diff --git a/package.json b/package.json index 6104e48..f448e3c 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "author": "Tomas Dvorak ", "license": "Apache 2", "dependencies": { - "cheerio": "0.19.0", + "cheerio": "0.20.0", "child-process-promise": "~1.1.0", "findit": "2.0.0", - "gitbook-cli": "1.0.1", + "gitbook-cli": "2.0.1", "lodash": "^4.2.0", "mkdirp": "^0.5.1", "q": "~1.4.1",