Update docs/hero_create_mdbook.md

added info on sync_production.sh
This commit is contained in:
mik-tf 2024-04-03 13:05:21 +00:00
parent 13e3050e34
commit 14a9ca5943

View File

@ -22,7 +22,7 @@ For this guide, we will show how to add an mdbook to the TFGrid repository `info
## Prerequisites
Before proceeding further, make sure you read and completed the [guide on how to use Hero and mdbook](https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/docs/hero_mdbook_fullvm.md).
Before proceeding further, make sure you read and completed the [guide on how to use Hero and mdbook](./hero_fullvm.md).
## Creating a New mdbook
@ -49,7 +49,8 @@ We first show the directory tree template to give an overview of the project. Wi
```
├── books
│   └── new_mdbook
│   └── SUMMARY.md
│   ├── SUMMARY.md
│   └── sync_production.sh
├── collections
│   └── new_mdbook
│   ├── .collection
@ -67,7 +68,7 @@ We first show the directory tree template to give an overview of the project. Wi
Hero uses three main directories to build an mdbook `books`, `collections` and `heroscript`. Let's have a look at each of them.
- `books`
- This directory contains the file `SUMMARY.md` of every mdbook. Each summary file is within the proper mdbook directory (here we have `new_mdbook`).
- This directory contains the file `SUMMARY.md` of every mdbook as well as a script file called `sync_production.sh`. Each summary file is within the proper mdbook directory (here we have `new_mdbook`).
- In our case, we will have `books/new_mdbook/SUMMARY.md`.
- The summary file will point to the markdown files we want our mdbook populated with.
- We note that the SUMMARY.md file needs to point to a directory contained within the `collections` directory, as shown just below.
@ -75,12 +76,17 @@ Hero uses three main directories to build an mdbook `books`, `collections` and `
- [Example 1](new_mdbook/new_mdbook_example1.md)
- [Example 2](new_mdbook/new_mdbook_example2.md)
```
- The script file named `sync_production.sh` should contain the following content (make sure to adjust with the proper book name):
```
#!/bin/bash
rsync -rv ~/hero/www/info/new_mdbook/ root@info.ourworld.tf:/root/hero/www/info/new_mdbook/
```
- `collections`
- This directory contains all the markdown files needed to build all the books in the repository.
- In our case, we will put two markdown files:
- In our case, we will put two markdown files in the new collections named `new_mdbook`
- `collections/new_mdbook/new_mdbook_example1.md`
- `collections/new_mdbook/new_mdbook_example2.md`
- There also needs to be a file within that directory called `.collection`. This file should be empty.
- Note that each collections directory should contain a file called `.collection`. This file should be empty.
```
touch .collection
```
@ -141,7 +147,7 @@ Then you can open the mdbook locally:
hero mdbook -p /root/code/git.ourworld.tf/tfgrid/info_tfgrid/heroscript/new_mdbook -o
```
If you're using a remote VM for Hero, you can run the following line to see the book on your local browser. Check the [Hero Full VM guide](https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/docs/hero_mdbook_fullvm.md) for more information on this.
If you're using a remote VM for Hero, you can run the following line to see the book on your local browser. Check the [Hero Full VM guide](./hero_fullvm.md) for more information on this.
```
pushd /root/hero/www/info/new_mdbook/; python3 -m http.server 5173; popd;