mirror of https://github.com/rwf2/Rocket.git
Test all contrib features individually.
This commit is contained in:
parent
9966a07c58
commit
58519e495e
|
@ -5,6 +5,7 @@ cache: cargo
|
||||||
env:
|
env:
|
||||||
- TEST_FLAGS=
|
- TEST_FLAGS=
|
||||||
- TEST_FLAGS=--release
|
- TEST_FLAGS=--release
|
||||||
|
- TEST_FLAGS=--contrib
|
||||||
rust:
|
rust:
|
||||||
- nightly
|
- nightly
|
||||||
script: ./scripts/test.sh $TEST_FLAGS
|
script: ./scripts/test.sh $TEST_FLAGS
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![doc(cfg(feature = "diesel_sqlite_pool"))]
|
||||||
//! Traits, utilities, and a macro for easy database connection pooling.
|
//! Traits, utilities, and a macro for easy database connection pooling.
|
||||||
//!
|
//!
|
||||||
//! # Overview
|
//! # Overview
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#![feature(use_extern_macros)]
|
#![feature(use_extern_macros)]
|
||||||
#![feature(crate_visibility_modifier)]
|
#![feature(crate_visibility_modifier)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
#![feature(doc_cfg)]
|
||||||
|
|
||||||
// TODO: Version URLs.
|
// TODO: Version URLs.
|
||||||
#![doc(html_root_url = "https://api.rocket.rs")]
|
#![doc(html_root_url = "https://api.rocket.rs")]
|
||||||
|
|
|
@ -13,6 +13,7 @@ pub trait Engine: Send + Sync + 'static {
|
||||||
fn render<C: Serialize>(&self, name: &str, context: C) -> Option<String>;
|
fn render<C: Serialize>(&self, name: &str, context: C) -> Option<String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(cfg(feature = "tera_templates"))]
|
||||||
/// A structure exposing access to templating engines.
|
/// A structure exposing access to templating engines.
|
||||||
///
|
///
|
||||||
/// Calling methods on the exposed template engine types may require importing
|
/// Calling methods on the exposed template engine types may require importing
|
||||||
|
|
|
@ -9,8 +9,8 @@ use super::ContextManager;
|
||||||
///
|
///
|
||||||
/// # Usage
|
/// # Usage
|
||||||
///
|
///
|
||||||
/// First, ensure that the template [fairing](`rocket::fairing`) is attached to
|
/// First, ensure that the template [fairing](`rocket::fairing`),
|
||||||
/// your Rocket application:
|
/// [`Template::fairing()`] is attached to your Rocket application:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate rocket;
|
/// # extern crate rocket;
|
||||||
|
@ -26,8 +26,8 @@ use super::ContextManager;
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `TemplateMetadata` type implements Rocket's `FromRequest` trait, so it can
|
/// The `TemplateMetadata` type implements Rocket's `FromRequest` trait, so it
|
||||||
/// be used as a request guard in any request handler.
|
/// can be used as a request guard in any request handler.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # #![feature(plugin, decl_macro)]
|
/// # #![feature(plugin, decl_macro)]
|
||||||
|
@ -40,11 +40,13 @@ use super::ContextManager;
|
||||||
///
|
///
|
||||||
/// #[get("/")]
|
/// #[get("/")]
|
||||||
/// fn homepage(metadata: TemplateMetadata) -> Template {
|
/// fn homepage(metadata: TemplateMetadata) -> Template {
|
||||||
|
/// # use std::collections::HashMap;
|
||||||
|
/// # let context: HashMap<String, String> = HashMap::new();
|
||||||
/// // Conditionally render a template if it's available.
|
/// // Conditionally render a template if it's available.
|
||||||
/// if metadata.contains_template("some-template") {
|
/// if metadata.contains_template("some-template") {
|
||||||
/// Template::render("some-template", json!({ /* .. */ }))
|
/// Template::render("some-template", &context)
|
||||||
/// } else {
|
/// } else {
|
||||||
/// Template::render("fallback", json!({ /* .. */ }))
|
/// Template::render("fallback", &context)
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
@ -79,8 +79,38 @@ ensure_trailing_whitespace_free
|
||||||
echo ":: Updating dependencies..."
|
echo ":: Updating dependencies..."
|
||||||
cargo update
|
cargo update
|
||||||
|
|
||||||
echo ":: Bootstrapping examples..."
|
if [ "$1" = "--contrib" ]; then
|
||||||
bootstrap_examples
|
FEATURES=(
|
||||||
|
json
|
||||||
|
msgpack
|
||||||
|
tera_templates
|
||||||
|
handlebars_templates
|
||||||
|
static_files
|
||||||
|
diesel_postgres_pool
|
||||||
|
diesel_sqlite_pool
|
||||||
|
diesel_mysql_pool
|
||||||
|
postgres_pool
|
||||||
|
mysql_pool
|
||||||
|
sqlite_pool
|
||||||
|
cypher_pool
|
||||||
|
redis_pool
|
||||||
|
)
|
||||||
|
|
||||||
echo ":: Building and testing libraries..."
|
pushd "${CONTRIB_LIB_ROOT}" > /dev/null 2>&1
|
||||||
CARGO_INCREMENTAL=0 cargo test --all-features --all $@
|
|
||||||
|
echo ":: Building and testing contrib [default]..."
|
||||||
|
CARGO_INCREMENTAL=0 cargo test
|
||||||
|
|
||||||
|
for feature in "${FEATURES[@]}"; do
|
||||||
|
echo ":: Building and testing contrib [${feature}]..."
|
||||||
|
CARGO_INCREMENTAL=0 cargo test --no-default-features --features "${feature}"
|
||||||
|
done
|
||||||
|
|
||||||
|
popd > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
echo ":: Bootstrapping examples..."
|
||||||
|
bootstrap_examples
|
||||||
|
|
||||||
|
echo ":: Building and testing libraries..."
|
||||||
|
CARGO_INCREMENTAL=0 cargo test --all-features --all $@
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue