diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..174b956 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install mdbook + run: | + mkdir mdbook + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH + - name: Deploy GitHub Pages + run: | + # This assumes your book is in the root of your repository. + # Just add a `cd` here if you need to change to another directory. + mdbook build + git worktree add gh-pages + git config user.name "Deploy from CI" + git config user.email "" + cd gh-pages + # Delete the ref to avoid keeping history. + git update-ref -d refs/heads/gh-pages + rm -rf * + mv ../book/* . + git add . + git commit -m "Deploy $GITHUB_SHA to gh-pages" + git push --force --set-upstream origin gh-pages \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6b07e6d..7585238 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ -book -_book -target -Cargo.lock -*.pdf +book diff --git a/compiling_and_linking/index.md b/05_compiling_and_linking/index.md similarity index 97% rename from compiling_and_linking/index.md rename to 05_compiling_and_linking/index.md index 3cbd8ca..b81a226 100644 --- a/compiling_and_linking/index.md +++ b/05_compiling_and_linking/index.md @@ -1,6 +1,6 @@ # Compiling and Linking in More Detail -## Your main\(\) entry point +## Your main() entry point Rust has a main function just like C/C++ which is usually called `main()`. [^1] @@ -253,4 +253,3 @@ Also note that once we build, cargo creates a `Cargo.lock` file in our root dire This file is made so that if `cargo build` is invoked again it has an exact list of what packages need to be pulled and compiled. It stops situations where the code under our feet \(so to speak\) moves and suddenly our project no longer builds. So if the lock file exists, the same dependency configuration can be reproduced even from a clean. If you want to force the cargo to rebuild a new lock file, e.g. after changing `Cargo.toml`, you can type `cargo update`. [^1]: You can change the main entry point using a special `#[start]` directive if you want on another function but the default is main\(\) - diff --git a/07_namespacing_with_modules/index.md b/07_namespacing_with_modules/index.md index 7a20560..8ae6506 100644 --- a/07_namespacing_with_modules/index.md +++ b/07_namespacing_with_modules/index.md @@ -111,4 +111,3 @@ TODO ## External crates TODO - diff --git a/SUMMARY.md b/SUMMARY.md index 4eb06dd..aeba0c6 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -12,7 +12,7 @@ * [Compiling and Linking in More Detail](05_compiling_and_linking/index.md) * [Source Layout and Other General Points](06_source_layout/index.md) * [Namespacing With Modules](07_namespacing_with_modules/index.md) -* [Porting Code](08_porting-code/index.md) +* [Porting Code](08_porting_code/index.md) * [Features of Rust compared with C++](09_features_compared/index.md) * [Types](09_features_compared/types.md) * [Strings](09_features_compared/strings.md) diff --git a/book.json b/book.json deleted file mode 100644 index bb146e4..0000000 --- a/book.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "title": "A Guide to Porting C/C++ to Rust", - "author": "Adam Lock", - "description": "A book that explains how to port code from C++ to Rust.", - "dest": "output/cpp-to-rust" -} diff --git a/book.toml b/book.toml new file mode 100644 index 0000000..b7a4c51 --- /dev/null +++ b/book.toml @@ -0,0 +1,7 @@ +[book] +authors = ["Adam Lock"] +language = "en" +multilingual = false +src = "." +title = "A Guide to Porting C/C++ to Rust" +description = "A book that explains how to port code from C++ to Rust." \ No newline at end of file diff --git a/foreword.md b/foreword.md index 9c23c4b..9668ba3 100644 --- a/foreword.md +++ b/foreword.md @@ -1,6 +1,6 @@ # Foreword -**BEGIN DRAFT BOOK DISCLAIMER ** +**BEGIN DRAFT BOOK DISCLAIMER** * Some of the samples will not compile or may not have been syntax checked * C and Rust code snippets are not distinguished very well yet (styling) diff --git a/styles/website.css b/styles/website.css deleted file mode 100644 index 6c18c43..0000000 --- a/styles/website.css +++ /dev/null @@ -1,3 +0,0 @@ -.language-rust { - background-color: #ff0000; -}