atc0005 / notes

Various notes, quick references and topics I want to explore further
MIT License
0 stars 0 forks source link

Generate fresh copy of "Command Line Applications in Rust" book #74

Open atc0005 opened 10 months ago

atc0005 commented 10 months ago

Directions

  1. lxc launch ubuntu:22.04 rustbook-builds
  2. lxc exec rustbook-builds -- sudo --login --user ubuntu
  3. sudo apt-get update
  4. sudo apt-get install -y git build-essential
  5. curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
  6. source $HOME/.cargo/env
  7. cargo install mdbook mdbook-epub
  8. git clone https://github.com/rust-cli/book rust-cli-book
  9. cd rust-cli-book
  10. Modify book.toml
    • see below
  11. mdbook build
  12. ls -lh book/epub/
  13. exit
  14. lxc file pull rustbook-builds/home/ubuntu/rust-cli-book/book/epub/'Command Line Applications in Rust.epub' ./

Since I build within an LXD container, the above will generate a new LXD container, build the book and pull the newly generated epub from the container into the host environment.

Modifications to book.toml

ubuntu@rustbook-builds:~/book$ git diff

diff --git a/book.toml b/book.toml
index c7b4b3e..a60cf81 100644
--- a/book.toml
+++ b/book.toml
@@ -15,3 +15,6 @@ site-url = "/book/"

 # Linkcheck doesn't find images/SVG so it's not enabled for now
 # [output.linkcheck]
+
+[output.epub]
+

Output

...
   Compiling shlex v1.2.0
   Compiling mime v0.3.17
   Compiling mdbook v0.4.35
   Compiling ureq v2.8.0
   Compiling epub-builder v0.5.0
   Compiling html_parser v0.7.0
   Compiling structopt v0.3.26
   Compiling const_format v0.2.32
   Compiling mdbook-epub v0.4.34
    Finished release [optimized] target(s) in 3m 26s
  Installing /home/ubuntu/.cargo/bin/mdbook-epub
   Installed package `mdbook-epub v0.4.34` (executable `mdbook-epub`)
     Summary Successfully installed mdbook, mdbook-epub!
ubuntu@rustbook-builds:~$ git clone https://github.com/rust-cli/book rust-cli-book
Cloning into 'rust-cli-book'...
remote: Enumerating objects: 2801, done.
remote: Counting objects: 100% (227/227), done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 2801 (delta 151), reused 188 (delta 126), pack-reused 2574
Receiving objects: 100% (2801/2801), 2.52 MiB | 7.98 MiB/s, done.
Resolving deltas: 100% (1903/1903), done.
ubuntu@rustbook-builds:~$ cd rust-cli-book/
ubuntu@rustbook-builds:~/rust-cli-book$ nano book.toml
ubuntu@rustbook-builds:~/rust-cli-book$ mdbook build
2023-11-13 22:22:45 [INFO] (mdbook::book): Book building has started
2023-11-13 22:22:45 [INFO] (mdbook::book): Running the epub backend
2023-11-13 22:22:45 [INFO] (mdbook::renderer): Invoking the "epub" renderer
Running mdbook-epub as plugin...
2023-11-13 22:22:45 [INFO] (mdbook::book): Running the html backend

References

atc0005 commented 1 month ago

NOTE:

These directions worked flawlessly with these repos also: