1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

add optional skeptic

This commit is contained in:
Nikolay Kim 2017-10-26 06:12:23 -07:00
parent 86583049fa
commit 488fb256b4
6 changed files with 31 additions and 20 deletions

View File

@ -7,9 +7,11 @@ readme = "README.md"
keywords = ["actor", "http", "web"] keywords = ["actor", "http", "web"]
homepage = "https://github.com/actix/actix-web" homepage = "https://github.com/actix/actix-web"
repository = "https://github.com/actix/actix-web.git" repository = "https://github.com/actix/actix-web.git"
documentation = "https://docs.rs/actix-web/"
categories = ["network-programming", "asynchronous"] categories = ["network-programming", "asynchronous"]
license = "Apache-2.0" license = "Apache-2.0"
exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"] exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
build = "build.rs"
[badges] [badges]
travis-ci = { repository = "actix/actix-web", branch = "master" } travis-ci = { repository = "actix/actix-web", branch = "master" }
@ -58,6 +60,10 @@ features = []
[dev-dependencies] [dev-dependencies]
env_logger = "0.4" env_logger = "0.4"
reqwest = "0.8" reqwest = "0.8"
skeptic = "0.13"
[build-dependencies]
skeptic = "0.13"
[profile.release] [profile.release]
lto = true lto = true

View File

@ -10,6 +10,9 @@ build:
test: build clippy test: build clippy
cargo test $(CARGO_FLAGS) cargo test $(CARGO_FLAGS)
skeptic:
USE_SKEPTIC=1 cargo test $(CARGO_FLAGS)
# cd examples/word-count && python setup.py install && pytest -v tests # cd examples/word-count && python setup.py install && pytest -v tests
clippy: clippy:
@ -17,22 +20,3 @@ clippy:
doc: build doc: build
cargo doc --no-deps $(CARGO_FLAGS) cargo doc --no-deps $(CARGO_FLAGS)
clean:
rm -r target
gh-pages:
git clone --branch gh-pages git@github.com:fafhrd91/ctx.git gh-pages
.PHONY: gh-pages-doc
gh-pages-doc: doc | gh-pages
cd gh-pages && git pull
rm -r gh-pages/doc
cp -r target/doc gh-pages/
rm gh-pages/doc/.lock
cd gh-pages && git add .
cd gh-pages && git commit -m "Update documentation"
publish: default gh-pages-doc
cargo publish
cd gh-pages && git push

View File

@ -110,6 +110,7 @@ fn main() {
.serve::<_, ()>("127.0.0.1:8080").unwrap(); .serve::<_, ()>("127.0.0.1:8080").unwrap();
println!("Started http server: 127.0.0.1:8080"); println!("Started http server: 127.0.0.1:8080");
Arbiter::system().send(msgs::SystemExit(0));
let _ = sys.run(); let _ = sys.run();
} }
``` ```

18
build.rs Normal file
View File

@ -0,0 +1,18 @@
extern crate skeptic;
use std::{env, fs};
#[cfg(unix)]
fn main() {
if env::var("USE_SKEPTIC").is_ok() {
// generates doc tests for `README.md`.
skeptic::generate_doc_tests(&["README.md"]);
} else {
let f = env::var("OUT_DIR").unwrap() + "/skeptic-tests.rs";
let _ = fs::File::create(f);
}
}
#[cfg(not(unix))]
fn main() {
}

View File

@ -44,7 +44,7 @@ fn main() {
.body(Body::Empty) .body(Body::Empty)
})) }))
// static files // static files
.route_handler("/static", StaticFiles::new("static/", true))) .route_handler("/static", StaticFiles::new("examples/static/", true)))
.serve::<_, ()>("127.0.0.1:8080").unwrap(); .serve::<_, ()>("127.0.0.1:8080").unwrap();
println!("Started http server: 127.0.0.1:8080"); println!("Started http server: 127.0.0.1:8080");

2
tests/skeptic.rs Normal file
View File

@ -0,0 +1,2 @@
#[cfg(unix)]
include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs"));