Skip to content

Commit 29b65f6

Browse files
committed
docs(guide): build and test markdown files in doc directory
1 parent 220d09f commit 29b65f6

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ script:
2222
- ./.travis/readme.py
2323
- cargo build --verbose $FEATURES
2424
- cargo test --verbose $FEATURES
25-
- 'if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo bench --no-run; fi'
25+
- 'for f in ./doc/**/*.md; do rustdoc --test $f; done'
2626

2727
addons:
2828
apt:
@@ -40,7 +40,6 @@ after_success: |
4040
./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/hyper-* &&
4141
[ $TRAVIS_PULL_REQUEST = false ] &&
4242
{ [ "$TRAVIS_TAG" != "" ] || [ "$TRAVIS_BRANCH" == "master" ]; } &&
43-
cargo doc --no-deps &&
4443
./.travis/docs.sh &&
4544
echo "\nDocs published.\n"
4645

.travis/docs.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
set -o errexit
44

5+
shopt -s globstar
6+
7+
cargo doc --no-deps
8+
9+
for f in ./doc/**/*.md; do
10+
rustdoc $f -L ./target/debug -L ./target/debug/deps -o "$(dirname $f)";
11+
done
12+
13+
cp --parent ./doc/**/*.md ./target
14+
515
git clone --branch gh-pages "https://$TOKEN@github.com/${TRAVIS_REPO_SLUG}.git" deploy_docs
616
cd deploy_docs
717

doc/guide/server.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
% Server Guide
2+
3+
## The `Handler`
4+
5+
```ignore,no_run
6+
extern crate hyper;
7+
use hyper::server::{Handler, Request, Response, Decoder, Encoder, Next, HttpStream as Http};
8+
9+
struct Hello;
10+
11+
impl Handler<Http> for Hello {
12+
fn on_request(&mut self, req: Request<Http>) -> Next {
13+
14+
}
15+
16+
fn on_request_readable(&mut self, decoder: &mut Decoder<Http>) -> Next {
17+
18+
}
19+
20+
fn on_response(&mut self, res: &mut Response) -> Next {
21+
22+
}
23+
24+
fn on_response_writable(&mut self, encoder: &mut Encoder<Http>) -> Next {
25+
26+
}
27+
}
28+
29+
# fn main() {}
30+
```

0 commit comments

Comments
 (0)