diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..ef94219d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[workspace] +members = [ + "examples/cookies", + "examples/errors", + "examples/extended_validation", + "examples/forms", + "examples/hello_person", + "examples/hello_query_params", + "examples/hello_world", + "examples/manual_routes", + "examples/optional_redirect", + "examples/optional_result", + "examples/redirect", + "examples/static_files", + "examples/todo", +] diff --git a/examples/cookies/Cargo.toml b/examples/cookies/Cargo.toml index 161600d5..71e0a7eb 100644 --- a/examples/cookies/Cargo.toml +++ b/examples/cookies/Cargo.toml @@ -2,6 +2,7 @@ name = "cookies" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/errors/Cargo.toml b/examples/errors/Cargo.toml index 7663227a..c4ac005c 100644 --- a/examples/errors/Cargo.toml +++ b/examples/errors/Cargo.toml @@ -2,6 +2,7 @@ name = "errors" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/extended_validation/Cargo.toml b/examples/extended_validation/Cargo.toml index 1aafb436..5c1759fb 100644 --- a/examples/extended_validation/Cargo.toml +++ b/examples/extended_validation/Cargo.toml @@ -2,6 +2,7 @@ name = "extended_validation" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/forms/Cargo.toml b/examples/forms/Cargo.toml index 5dbe518c..468f0e65 100644 --- a/examples/forms/Cargo.toml +++ b/examples/forms/Cargo.toml @@ -2,6 +2,7 @@ name = "forms" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/hello_person/Cargo.toml b/examples/hello_person/Cargo.toml index 21381940..da6ab62b 100644 --- a/examples/hello_person/Cargo.toml +++ b/examples/hello_person/Cargo.toml @@ -2,6 +2,7 @@ name = "hello_person" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/hello_query_params/Cargo.toml b/examples/hello_query_params/Cargo.toml new file mode 100644 index 00000000..88669264 --- /dev/null +++ b/examples/hello_query_params/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hello_query" +version = "0.0.1" +authors = ["Sergio Benitez "] +workspace = "../../" + +[dependencies] +rocket = { path = "../../lib" } +rocket_macros = { path = "../../macros" } diff --git a/examples/hello_query_params/src/main.rs b/examples/hello_query_params/src/main.rs new file mode 100644 index 00000000..6693d1a7 --- /dev/null +++ b/examples/hello_query_params/src/main.rs @@ -0,0 +1,28 @@ +#![feature(plugin)] +#![plugin(rocket_macros)] + +extern crate rocket; + +use rocket::{Rocket, Error}; + +// One idea of what we could get. +// #[route(GET, path = "/hello?{name,age}")] +// fn hello(name: &str, age: &str) -> String { +// "Hello!".to_string() +// // format!("Hello, {} year old named {}!", age, name) +// } + +// Another idea. +// #[route(GET, path = "/hello")] +// fn hello(q: QueryParams) -> IOResult { +// format!("Hello, {} year old named {}!", q.get("name")?, q.get("age")?) +// } + +#[route(GET, path = "/hello")] +fn hello() -> &'static str { + "Hello there! Don't have query params yet, but we're working on it." +} + +fn main() { + Rocket::new("localhost", 8000).mount_and_launch("/", routes![hello]); +} diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index 2e4a531d..34329864 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -2,6 +2,7 @@ name = "hello_world" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/manual_routes/Cargo.toml b/examples/manual_routes/Cargo.toml index b2f846b9..2f950489 100644 --- a/examples/manual_routes/Cargo.toml +++ b/examples/manual_routes/Cargo.toml @@ -2,6 +2,7 @@ name = "manual_routes" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/optional_redirect/Cargo.toml b/examples/optional_redirect/Cargo.toml index df6a2421..6dc71ffb 100644 --- a/examples/optional_redirect/Cargo.toml +++ b/examples/optional_redirect/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "optional_result" +name = "optional_redirect" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/optional_result/Cargo.toml b/examples/optional_result/Cargo.toml index df6a2421..d8160640 100644 --- a/examples/optional_result/Cargo.toml +++ b/examples/optional_result/Cargo.toml @@ -2,6 +2,7 @@ name = "optional_result" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/redirect/Cargo.toml b/examples/redirect/Cargo.toml index 890ea22c..9258f966 100644 --- a/examples/redirect/Cargo.toml +++ b/examples/redirect/Cargo.toml @@ -2,6 +2,7 @@ name = "redirect" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/static_files/Cargo.toml b/examples/static_files/Cargo.toml index 7d6a7512..763474af 100644 --- a/examples/static_files/Cargo.toml +++ b/examples/static_files/Cargo.toml @@ -2,6 +2,7 @@ name = "static_files" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/examples/todo/Cargo.toml b/examples/todo/Cargo.toml index efd9e59f..8ab05601 100644 --- a/examples/todo/Cargo.toml +++ b/examples/todo/Cargo.toml @@ -2,6 +2,7 @@ name = "todo" version = "0.0.1" authors = ["Sergio Benitez "] +workspace = "../../" [dependencies] rocket = { path = "../../lib" } diff --git a/scripts/test.sh b/scripts/test.sh index 9150a245..33ba3497 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -17,7 +17,6 @@ function build_and_test() { pushd ${dir} echo ":: Building '${PWD}'..." - cargo clean cargo build --verbose echo ":: Running unit tests in '${PWD}'..."