Skip to content

Commit 61ca302

Browse files
committed
Auto merge of #4455 - behnam:book-enh, r=alexcrichton
[doc/book] Add introduction page and other enhancements Preview: http://code.behnam.es/rust-cargo/book/ * Reorganize files to use folders instead of numbered files. This will allow us to add new sections and pages without breaking a numbering system or the URLs. * Rename "Cargo In Depth" to "Cargo Reference", as those pages are considered *the* reference for cargo behaviors. * Add `introduction.md`, as the landing page with the book title and Cargo logo on top. * Expand `installation.md`: Import install text and links from <https://crates.io/install>, as we want to drop that page and redirect it to here. (See <rust-lang/crates.io#1029>) * Sync `SUMMARY.md` titles (and sub-pages lists in section pages) with page titles and fix some wordings and casings. * Expand Introduction and section pages with some intro text. * Set lang for some of the code blocks. * Add `book.toml` to get the title in HTML head title, etc. Tracker: <#4040>
2 parents 97452de + 2ad45a5 commit 61ca302

34 files changed

+247
-281
lines changed

src/doc/MIGRATION_MAP

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
build-script.md book/src/03-05-build-scripts.md
2-
config.md book/src/03-03-config.md
3-
crates-io.md book/src/03-06-crates-io.md
4-
environment-variables.md book/src/03-04-environment-variables.md
5-
external-tools.md book/src/03-09-external-tools.md
1+
index.md book/src/SUMMARY.md book/src/getting-started.md book/src/getting-started/*.md
2+
guide.md book/src/guide.md book/src/guide/*.md
3+
build-script.md book/src/reference/build-scripts.md
4+
config.md book/src/reference/config.md
5+
crates-io.md book/src/reference/crates-io.md
6+
environment-variables.md book/src/reference/environment-variables.md
7+
external-tools.md book/src/reference/external-tools.md
8+
manifest.md book/src/reference/manifest.md
9+
pkgid-spec.md book/src/reference/pkgid-spec.md
10+
policies.md book/src/reference/policies.md
11+
source-replacement.md book/src/reference/source-replacement.md
12+
specifying-dependencies.md book/src/reference/specifying-dependencies.md
613
faq.md book/src/faq.md
7-
guide.md book/src/guide.md book/src/02-*.md
8-
index.md book/src/SUMMARY.md book/src/01-*.md
9-
manifest.md book/src/03-02-manifest.md
10-
pkgid-spec.md book/src/03-07-pkgid-spec.md
11-
policies.md book/src/03-10-policies.md
12-
source-replacement.md book/src/03-08-source-replacement.md
13-
specifying-dependencies.md book/src/03-01-specifying-dependencies.md

src/doc/book/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@ Building the book requires [mdBook]. To get it:
77

88
[mdBook]: https://github.com/azerupi/mdBook
99

10-
```bash
10+
```shell
1111
$ cargo install mdbook
1212
```
1313

1414
### Building
1515

1616
To build the book:
1717

18-
```bash
18+
```shell
1919
$ mdbook build
2020
```
2121

2222
The output will be in the `book` subdirectory. To check it out, open it in
2323
your web browser.
2424

2525
_Firefox:_
26-
```bash
26+
```shell
2727
$ firefox book/index.html # Linux
2828
$ open -a "Firefox" book/index.html # OS X
2929
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
3030
$ start firefox.exe .\book\index.html # Windows (Cmd)
3131
```
3232

3333
_Chrome:_
34-
```bash
34+
```shell
3535
$ google-chrome book/index.html # Linux
3636
$ open -a "Google Chrome" book/index.html # OS X
3737
$ Start-Process "chrome.exe" .\book\index.html # Windows (PowerShell)

src/doc/book/book.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
title = "The Cargo Manual"
2+
author = "Alex Crichton, Steve Klabnik and Carol Nichols, with Contributions from the Rust Community"

src/doc/book/src/01-01-installation.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/doc/book/src/02-05-project-layout.md

Lines changed: 0 additions & 140 deletions
This file was deleted.

src/doc/book/src/SUMMARY.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
# Summary
22

3+
[Introduction](introduction.md)
4+
35
* [Getting Started](getting-started.md)
4-
* [Installation](01-01-installation.md)
5-
* [First Steps with Cargo](01-02-first-steps.md)
6+
* [Installation](getting-started/installation.md)
7+
* [First Steps with Cargo](getting-started/first-steps.md)
68

79
* [Cargo Guide](guide.md)
8-
* [Why Cargo Exists](02-01-why-cargo-exists.md)
9-
* [Creating a New Project](02-02-creating-a-new-project.md)
10-
* [Working on an Existing Project](02-03-working-on-an-existing-project.md)
11-
* [Dependencies](02-04-dependencies.md)
12-
* [Project Layout](02-05-project-layout.md)
13-
* [Cargo.toml vs Cargo.lock](02-06-cargo-toml-vs-cargo-lock.md)
14-
* [Tests](02-07-tests.md)
15-
* [Continuous Integration](02-08-continuous-integration.md)
10+
* [Why Cargo Exists](guide/why-cargo-exists.md)
11+
* [Creating a New Project](guide/creating-a-new-project.md)
12+
* [Working on an Existing Project](guide/working-on-an-existing-project.md)
13+
* [Dependencies](guide/dependencies.md)
14+
* [Project Layout](guide/project-layout.md)
15+
* [Cargo.toml vs Cargo.lock](guide/cargo-toml-vs-cargo-lock.md)
16+
* [Tests](guide/tests.md)
17+
* [Continuous Integration](guide/continuous-integration.md)
1618

17-
* [Cargo In Depth](cargo-in-depth.md)
18-
* [Specifying Dependencies](03-01-specifying-dependencies.md)
19-
* [Cargo.toml Format](03-02-manifest.md)
20-
* [Configuration](03-03-config.md)
21-
* [Environment Variables](03-04-environment-variables.md)
22-
* [Build Scripts](03-05-build-scripts.md)
23-
* [Publishing on crates.io](03-06-crates-io.md)
24-
* [Package ID specs](03-07-pkgid-spec.md)
25-
* [Source Replacement](03-08-source-replacement.md)
26-
* [External Tools](03-09-external-tools.md)
27-
* [Policies](03-10-policies.md)
19+
* [Cargo Reference](reference.md)
20+
* [Specifying Dependencies](reference/specifying-dependencies.md)
21+
* [The Manifest Format](reference/manifest.md)
22+
* [Configuration](reference/config.md)
23+
* [Environment Variables](reference/environment-variables.md)
24+
* [Build Scripts](reference/build-scripts.md)
25+
* [Publishing on crates.io](reference/crates-io.md)
26+
* [Package ID Specifications](reference/pkgid-spec.md)
27+
* [Source Replacement](reference/source-replacement.md)
28+
* [External Tools](reference/external-tools.md)
29+
* [Crates.io Package Policies](reference/policies.md)
2830

2931
* [FAQ](faq.md)

src/doc/book/src/cargo-in-depth.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/doc/book/src/faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Cargo handles compiling Rust code, but we know that many Rust projects
5050
link against C code. We also know that there are decades of tooling
5151
built up around compiling languages other than Rust.
5252

53-
Our solution: Cargo allows a package to [specify a script](03-05-build-scripts.html)
53+
Our solution: Cargo allows a package to [specify a script](reference/build-scripts.html)
5454
(written in Rust) to run before invoking `rustc`. Rust is leveraged to
5555
implement platform-specific configuration and refactor out common build
5656
functionality among packages.
@@ -74,7 +74,7 @@ on the platform. Cargo also supports [platform-specific
7474
dependencies][target-deps], and we plan to support more per-platform
7575
configuration in `Cargo.toml` in the future.
7676

77-
[target-deps]: 03-02-manifest.html#the-dependencies-section
77+
[target-deps]: reference/manifest.html#the-dependencies-section
7878

7979
In the longer-term, we’re looking at ways to conveniently cross-compile
8080
projects using Cargo.
@@ -83,7 +83,7 @@ projects using Cargo.
8383

8484
We support environments through the use of [profiles][profile] to support:
8585

86-
[profile]: 03-02-manifest.html#the-profile-sections
86+
[profile]: reference/manifest.html#the-profile-sections
8787

8888
* environment-specific flags (like `-g --opt-level=0` for development
8989
and `--opt-level=3` for production).
@@ -190,4 +190,4 @@ shouldn't be necessary.
190190
For more information about vendoring, see documentation on [source
191191
replacement][replace].
192192

193-
[replace]: 03-08-source-replacement.html
193+
[replace]: reference/source-replacement.html

src/doc/book/src/getting-started.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## Getting Started
22

3-
* [Installation](01-01-installation.html)
4-
* [First steps with Cargo](01-02-first-steps.html)
3+
To get started with Cargo, install Cargo (and Rust) and set up your first crate.
4+
5+
* [Installation](getting-started/installation.html)
6+
* [First steps with Cargo](getting-started/first-steps.html)

src/doc/book/src/01-02-first-steps.md renamed to src/doc/book/src/getting-started/first-steps.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ needs to compile your project.
3636

3737
Here’s what’s in `src/main.rs`:
3838

39-
```
39+
```rust
4040
fn main() {
4141
println!("Hello, world!");
4242
}
@@ -65,6 +65,6 @@ $ cargo run
6565
Hello, world!
6666
```
6767

68-
## Going further
68+
### Going further
6969

7070
For more details on using Cargo, check out the [Cargo Guide](guide.html)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Installation
2+
3+
### Install Stable Rust and Cargo
4+
5+
The easiest way to get Cargo is to get the current stable release of [Rust] by
6+
using the `rustup` script:
7+
8+
```shell
9+
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
10+
```
11+
12+
After this, you can use the `rustup` command to also install `beta` or `nightly`
13+
channels for Rust and Cargo.
14+
15+
### Install Nightly Cargo
16+
17+
To install just Cargo, the current recommended installation method is through
18+
the official nightly builds. Note that Cargo will also require that [Rust] is
19+
already installed on the system.
20+
21+
| Platform | 64-bit | 32-bit |
22+
|------------------|-------------------|-------------------|
23+
| Linux binaries | [tar.gz][linux64] | [tar.gz][linux32] |
24+
| MacOS binaries | [tar.gz][mac64] | [tar.gz][mac32] |
25+
| Windows binaries | [tar.gz][win64] | [tar.gz][win32] |
26+
27+
### Build and Install Cargo from Source
28+
29+
Alternatively, you can [build Cargo from source][compiling-from-source].
30+
31+
[rust]: https://www.rust-lang.org/
32+
[linux64]: https://static.rust-lang.org/cargo-dist/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz
33+
[linux32]: https://static.rust-lang.org/cargo-dist/cargo-nightly-i686-unknown-linux-gnu.tar.gz
34+
[mac64]: https://static.rust-lang.org/cargo-dist/cargo-nightly-x86_64-apple-darwin.tar.gz
35+
[mac32]: https://static.rust-lang.org/cargo-dist/cargo-nightly-i686-apple-darwin.tar.gz
36+
[win64]: https://static.rust-lang.org/cargo-dist/cargo-nightly-x86_64-pc-windows-gnu.tar.gz
37+
[win32]: https://static.rust-lang.org/cargo-dist/cargo-nightly-i686-pc-windows-gnu.tar.gz
38+
[compiling-from-source]: https://github.com/rust-lang/cargo#compiling-from-source

0 commit comments

Comments
 (0)