From 7c69197d0c3a6aaed368eb5bebc7c3d7094e0dd7 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 10 Apr 2018 09:51:34 -0600 Subject: [PATCH] fix: Reduce deps for users Markdown parsers and more are foited onto clients because of Skeptic. This is inspired by the conversation at budziq/rust-skeptic#60 regarding a "skeptic-lite" using rustdoc. --- Cargo.toml | 4 ---- README.md | 17 +++++------------ README.md.skt.md | 0 build.rs | 5 ----- tests/skeptic.rs | 40 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 44 insertions(+), 22 deletions(-) delete mode 100644 README.md.skt.md delete mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index 686359686..57524a117 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,6 @@ categories = ["template-engine"] keywords = ["liquid", "template", "templating", "language", "html"] license = "MIT" -build = "build.rs" - [badges] travis-ci = { repository = "cobalt-org/liquid-rust" } appveyor = { repository = "cobalt-org/liquid-rust" } @@ -46,10 +44,8 @@ serde_yaml = { version = "0.7", optional = true } serde_json = { version = "1.0", optional = true } [build-dependencies] -skeptic = "0.13.2" serde = { version = "1.0", features = ["derive"] } [dev-dependencies] difference = "2.0" -skeptic = "0.13.2" serde_yaml = "0.7" diff --git a/README.md b/README.md index 2520aeb46..844a2984a 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,17 @@ To include liquid in your project add the following to your Cargo.toml: liquid = "0.14" ``` -Now you can use the crate in your code +Now you can use the crate in your code: + ```rust extern crate liquid; ``` Example: + ```rust +extern crate liquid; + let template = liquid::ParserBuilder::with_liquid() .build() .parse("Liquid! {{num | minus: 2}}").unwrap(); @@ -73,14 +77,3 @@ See [comment_block.rs](https://github.com/cobalt-org/liquid-rust/blob/master/src/tags/comment_block.rs) for what a block implementation looks like. You can then register it by calling `liquid::ParserBuilder::block`. - ----------- - - diff --git a/README.md.skt.md b/README.md.skt.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/build.rs b/build.rs deleted file mode 100644 index a780b3d35..000000000 --- a/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate skeptic; - -fn main() { - skeptic::generate_doc_tests(&["README.md"]); -} diff --git a/tests/skeptic.rs b/tests/skeptic.rs index ff46c9c01..3eefa11e8 100644 --- a/tests/skeptic.rs +++ b/tests/skeptic.rs @@ -1 +1,39 @@ -include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs")); +use std::env; +use std::env::consts::EXE_EXTENSION; +use std::path::Path; +use std::process::Command; + +#[test] +fn readme_test() { + let rustdoc = Path::new("rustdoc").with_extension(EXE_EXTENSION); + let readme = Path::new(file!()) + .parent() + .unwrap() + .parent() + .unwrap() + .join("README.md"); + let exe = env::current_exe().unwrap(); + let depdir = exe.parent().unwrap(); + let outdir = depdir.parent().unwrap(); + let extern_arg = format!( + "read_process_memory={}", + outdir.join("libread_process_memory.rlib").to_string_lossy() + ); + let mut cmd = Command::new(rustdoc); + cmd.args(&["--verbose", "--test", "-L"]) + .arg(&outdir) + .arg("-L") + .arg(&depdir) + .arg("--extern") + .arg(&extern_arg) + .arg(&readme); + println!("Running `{:?}`", cmd); + let result = cmd.spawn() + .expect("Failed to spawn process") + .wait() + .expect("Failed to run process"); + assert!( + result.success(), + "Failed to run rustdoc tests on README.md!" + ); +}