chg: [tools] Added serve.sh in case gitbook --watch is broken

chg: [doc] Changed the install procedure to reflect current OS versions
chg: [test] First try at fixing Travis, BUT it is an awful fix. See: https://github.com/travis-ci/travis-ci/issues/9594 blame: @travis-ci and @npm
pull/127/head
Steve Clement 2018-09-07 15:09:41 +02:00
parent a5f829068f
commit 659747f3b5
4 changed files with 31 additions and 4 deletions

View File

@ -8,6 +8,7 @@ sudo: required
install:
- sudo apt-get -y install libgif-dev calibre npm
- sudo npm config set strict-ssl false
- sudo npm cache clean -f
- sudo npm install -g n
- sudo n stable
@ -18,6 +19,7 @@ install:
- npm install gitbook-plugin-github
- npm install gitbook-plugin-toc
- npm install gitbook-plugin-anchors
- npm install gitbook-plugin-image-class
script:
- gitbook install

View File

@ -4,14 +4,18 @@ Install notes
:warning: Make sure to be in the *misp-book* repository directory for the *npm magic*.
Also: The *npm* plugin *autocover* is broken. It pulls an incompatible *canvas* module version. Thus patched repository used (forked from original)
Finally: You will get a few errors on Ubuntu 18.04 which you can ignore for now. In the rather near future we need to think about an alternative as gitbook glides towards obsoletion and security risk.
Tested on: *Ubuntu 16.04.4 LTS*
Tested on: *Ubuntu 18.04 LTS* *Debian 9.5/sid/testing*
[Terminal Recording of npm install lines on Ubuntu 18.04](https://asciinema.org/a/84JZMuGu2QlFH59q6mK8jbdQS)
```bash
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
git clone git@github.com:MISP/misp-book.git
cd misp-book
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
sudo apt install -y npm pkg-config libcairo2-dev
sudo apt install -y pkg-config libcairo2-dev libgif-dev
npm install gitbook git+https://github.com/SteveClement/plugin-autocover.git gitbook-plugin-github gitbook-plugin-toc gitbook-plugin-anchors gitbook-plugin-image-class
sudo npm install gitbook-cli -g
gitbook install
@ -101,7 +105,7 @@ xcode-select --install
brew install pkg-config cairo pango libpng jpeg giflib
```
:warning: Make sure to be in the *misp-book* repository directory for the npm magic.
:warning: Make sure to be in the *misp-book* repository directory for the npm magic to work correctly.
Installing gitbook and all dependencies wants to look like this (Tested on *macOS 11.13.3*):
@ -111,6 +115,19 @@ npm install gitbook-cli -g
gitbook install
```
gitbook rebuild on change
=========================
By default gitbook has the '--watch' option enabled.
If this is broken, use the included 'serve.sh' and the 'inoticoming' package.
Start 'gitbook serve &' and run the following command line:
```
inoticoming --foreground . --suffix .md bash serve.sh \;
```
If any md changes, the gitbook process is killed and restarted.
npm salvage
===========

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

8
serve.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# Kill any existing instances of "gitbook serve"
ps -Af | grep node | grep "gitbook serve" | awk '{print $2}' | xargs kill 2>/dev/null
if [ "$1" = "shutdown" ]; then echo "Goodbye!"; exit 0; fi;
# Launch the server
gitbook serve . &