Skip to content

invoke cargo to install mdbook #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: rust
cache: pip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change this to

cache:
- pip
- cargo

It'll let us cache both the ghp-import install and the mdbook install, as well as the cargo registry and cache in ~/.cargo so we don't need to re-download the world every time CI runs.


install:
- bash ci/install.sh
- source ~/.cargo/env || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sure ~/.cargo/bin is on our $PATH (its contents is just export PATH="$HOME/.cargo/bin:$PATH"). If we didn't make sure ~/.cargo/bin is on the $PATH we'd end up with command not found errors.

- bash ci/install.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Looks like I must have messed up the order when copy/pasting across from .travis.yml files in other repositories.


script:
- true
Expand Down
4 changes: 3 additions & 1 deletion ci/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -ex

cargo install cargo install mdbook --vers "0.0.28"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to wrap this in a if command -v ... block. To skip recompiling mdbook every time CI rins, you only want to install it if it isn't already installed. The if command -v foo bit returns 1 if the foo command isn't found and tends to be more reliable than using which foo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming you meant cargo install mdbook ... here, not cargo install cargo install ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, yeah =)


if command -v ghp-import >/dev/null 2>&1; then
pip install ghp-import
fi
fi