Adding mdbook configuration and deployment to gh-pages (#111)

This commit is contained in:
simonsan 2021-01-01 12:27:42 +01:00 committed by GitHub
parent 1d606a5116
commit 3f3ae4ae73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 112 additions and 0 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
MDBOOK_VERSION=0.4.4

31
.github/workflows/gh-pages.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: github pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Read .env
id: mdbook-version
run: |
. ./.env
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"
- name: Setup mdbook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}'
- run: mdbook build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Generated output of mdbook
/book

View File

@ -78,3 +78,20 @@ We suggest leaving a comment on the [issue tracker](https://github.com/rust-unof
so that other people don't start working on the same topic.
Correction and elaboration PRs are very welcome.
## Building with mdbook
This book is built with [mdbook](https://rust-lang.github.io/mdBook/). You can install it by running `cargo install mdbook`.
If you want to build it locally you can run one of these two commands in the root directory of the repository:
- `mdbook build`
Builds static html pages as output and place them in the `/book` directory by default.
- `mdbook serve`
Serves the book at `http://localhost:3000` (port is changeable, take a look at the terminal output
to be sure) and reloads the browser when a change occurs.

32
SUMMARY.md Normal file
View File

@ -0,0 +1,32 @@
# Summary
- [Introduction](./intro.md)
- [Idioms](./idioms/README.md)
- [Concatenating Strings with `format!`](./idioms/concat-format.md)
- [Constructor](./idioms/ctor.md)
- [The `Default` Trait](./idioms/default.md)
- [Collections Are Smart Pointers](./idioms/deref.md)
- [Finalisation in Destructors](./idioms/dtor-finally.md)
- [`mem::replace(_)`](./idioms/mem-replace.md)
- [On-Stack Dynamic Dispatch](./idioms/on-stack-dyn-dispatch.md)
- [Iterating over an `Option`](./idioms/option-iter.md)
- [Pass Variables to Closure](./idioms/pass-var-to-closure.md)
- [Privacy For Extensibility](./idioms/priv-extend.md)
- [Easy doc initialization](./idioms/rustdoc-init.md)
- [Temporary mutability](./idioms/temporary-mutability.md)
- [Design Patterns](./patterns/README.md)
- [Builder](./patterns/builder.md)
- [Compose Structs](./patterns/compose-structs.md)
- [Entry API](./patterns/entry.md)
- [Fold](./patterns/fold.md)
- [Late Bound Bounds](./patterns/late-bounds.md)
- [Newtype](./patterns/newtype.md)
- [RAII Guards](./patterns/RAII.md)
- [Prefer Small Crates](./patterns/small-crates.md)
- [Contain unsafety in small modules](./patterns/unsafe-mods.md)
- [Visitor](./patterns/visitor.md)
- [Anti-patterns](./anti_patterns/README.md)
- [`#[deny(warnings)]`](./anti_patterns/deny-warnings.md)
- [Deref Polymorphism](./anti_patterns/deref.md)

3
anti_patterns/README.md Normal file
View File

@ -0,0 +1,3 @@
# Anti-patterns
TODO: add description/explanation

20
book.toml Normal file
View File

@ -0,0 +1,20 @@
[book]
title = "Rust Design Patterns"
authors = ["the rust-unofficial authors"]
description = "A catalogue of Rust design patterns, anti-patterns and idioms"
language = "en"
multilingual = false
src = "."
[build]
create-missing = false
[rust]
edition = "2018"
[output.html]
default-theme = "rust"
git-repository-url = "https://github.com/rust-unofficial/patterns"
git-repository-icon = "fa-github"
# [output.linkcheck] # enable the "mdbook-linkcheck" renderer, disabled due to gh-actions

3
idioms/README.md Normal file
View File

@ -0,0 +1,3 @@
# Idioms
TODO: add description/explanation

3
patterns/README.md Normal file
View File

@ -0,0 +1,3 @@
# Design Patterns
TODO: add description/explanation