Skip to content

Commit

Permalink
support for specific gitbook version
Browse files Browse the repository at this point in the history
  • Loading branch information
todvora committed Feb 29, 2016
1 parent 14d6b92 commit 1289ff3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions lib/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;});
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"author": "Tomas Dvorak <todvora@gmail.com>",
"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",
Expand Down

0 comments on commit 1289ff3

Please sign in to comment.