diff --git a/README.md b/README.md index 530b59d6..8c3db519 100644 --- a/README.md +++ b/README.md @@ -112,11 +112,13 @@ API documentation is built with `./scripts/mk-docs.sh`. The resulting assets are uploaded to [api.rocket.rs](https://api.rocket.rs/). Documentation for a released version `${x}` can be found at -`https://api.rocket.rs/v${x}`. For instance, the documentation for `0.4` can be -found at https://api.rocket.rs/v0.4. Documentation for unreleased versions in -branch `${branch}` be found at `https://api.rocket.rs/${branch}`. For instance, -the documentation for the `master` branch can be found at -https://api.rocket.rs/master. Documentation for unreleased branches is updated +`https://api.rocket.rs/v${x}` and `https://rocket.rs/v${x}`. For instance, the +documentation for `0.4` can be found at https://api.rocket.rs/v0.4 and +https://rocket.rs/v0.4. Documentation for unreleased versions in branch +`${branch}` be found at `https://api.rocket.rs/${branch}` and +`https://rocket.rs/${branch}`. For instance, the documentation for the `master` +branch can be found at https://api.rocket.rs/master and +https://rocket.rs/master. Documentation for unreleased branches is updated periodically. ## Contributing diff --git a/contrib/codegen/Cargo.toml b/contrib/codegen/Cargo.toml index d2bda731..83f5e1f3 100644 --- a/contrib/codegen/Cargo.toml +++ b/contrib/codegen/Cargo.toml @@ -3,7 +3,7 @@ name = "rocket_contrib_codegen" version = "0.5.0-dev" authors = ["Sergio Benitez "] description = "Procedural macros for the Rocket contrib libraries." -documentation = "https://api.rocket.rs/v0.5/rocket_contrib/" +documentation = "https://api.rocket.rs/master/rocket_contrib/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml index c7cfabff..6f67aa23 100644 --- a/contrib/lib/Cargo.toml +++ b/contrib/lib/Cargo.toml @@ -3,7 +3,7 @@ name = "rocket_contrib" version = "0.5.0-dev" authors = ["Sergio Benitez "] description = "Community contributed libraries for the Rocket web framework." -documentation = "https://api.rocket.rs/v0.5/rocket_contrib/" +documentation = "https://api.rocket.rs/master/rocket_contrib/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/contrib/lib/src/databases.rs b/contrib/lib/src/databases.rs index b5d771b3..7b10af50 100644 --- a/contrib/lib/src/databases.rs +++ b/contrib/lib/src/databases.rs @@ -165,7 +165,7 @@ //! Lastly, databases can be configured via environment variables by specifying //! the `databases` table as detailed in the [Environment Variables //! configuration -//! guide](https://rocket.rs/v0.5/guide/configuration/#environment-variables): +//! guide](https://rocket.rs/master/guide/configuration/#environment-variables): //! //! ```bash //! ROCKET_DATABASES='{my_db={url="db.sqlite"}}' diff --git a/contrib/lib/src/helmet/mod.rs b/contrib/lib/src/helmet/mod.rs index eda475d0..cbe8dc2f 100644 --- a/contrib/lib/src/helmet/mod.rs +++ b/contrib/lib/src/helmet/mod.rs @@ -4,7 +4,7 @@ //! takes some inspiration from [helmetjs], a similar piece of middleware for //! [express]. //! -//! [fairing]: https://rocket.rs/v0.5/guide/fairings/ +//! [fairing]: https://rocket.rs/master/guide/fairings/ //! [helmetjs]: https://helmetjs.github.io/ //! [express]: https://expressjs.com //! [`SpaceHelmet`]: helmet::SpaceHelmet diff --git a/contrib/lib/src/lib.rs b/contrib/lib/src/lib.rs index 72271f1c..bc722956 100644 --- a/contrib/lib/src/lib.rs +++ b/contrib/lib/src/lib.rs @@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://api.rocket.rs/v0.5")] +#![doc(html_root_url = "https://api.rocket.rs/master")] #![doc(html_favicon_url = "https://rocket.rs/images/favicon.ico")] #![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")] diff --git a/contrib/lib/src/templates/mod.rs b/contrib/lib/src/templates/mod.rs index 44ed31a4..10f8cd8a 100644 --- a/contrib/lib/src/templates/mod.rs +++ b/contrib/lib/src/templates/mod.rs @@ -56,7 +56,7 @@ //! template directory is configured via the `template_dir` configuration //! parameter and defaults to `templates/`. The path set in `template_dir` is //! relative to the Rocket configuration file. See the [configuration -//! chapter](https://rocket.rs/v0.5/guide/configuration/#extras) of the guide +//! chapter](https://rocket.rs/master/guide/configuration/#extras) of the guide //! for more information on configuration. //! //! The corresponding templating engine used for a given template is based on a diff --git a/core/codegen/Cargo.toml b/core/codegen/Cargo.toml index 821f7b73..29a1e5c0 100644 --- a/core/codegen/Cargo.toml +++ b/core/codegen/Cargo.toml @@ -3,7 +3,7 @@ name = "rocket_codegen" version = "0.5.0-dev" authors = ["Sergio Benitez "] description = "Procedural macros for the Rocket web framework." -documentation = "https://api.rocket.rs/v0.5/rocket_codegen/" +documentation = "https://api.rocket.rs/master/rocket_codegen/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/core/codegen/src/lib.rs b/core/codegen/src/lib.rs index 9730ba2a..27ed82e8 100644 --- a/core/codegen/src/lib.rs +++ b/core/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![recursion_limit="128"] -#![doc(html_root_url = "https://api.rocket.rs/v0.5")] +#![doc(html_root_url = "https://api.rocket.rs/master")] #![doc(html_favicon_url = "https://rocket.rs/images/favicon.ico")] #![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")] @@ -11,7 +11,7 @@ //! This crate implements the code generation portions of Rocket. This includes //! custom derives, custom attributes, and procedural macros. The documentation //! here is purely technical. The code generation facilities are documented -//! thoroughly in the [Rocket programming guide](https://rocket.rs/v0.5/guide). +//! thoroughly in the [Rocket programming guide](https://rocket.rs/master/guide). //! //! # Usage //! diff --git a/core/http/Cargo.toml b/core/http/Cargo.toml index 2d8321d9..b4bd1c31 100644 --- a/core/http/Cargo.toml +++ b/core/http/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Sergio Benitez "] description = """ Types, traits, and parsers for HTTP requests, responses, and headers. """ -documentation = "https://api.rocket.rs/v0.5/rocket_http/" +documentation = "https://api.rocket.rs/master/rocket_http/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/core/lib/Cargo.toml b/core/lib/Cargo.toml index 24036b16..b91df794 100644 --- a/core/lib/Cargo.toml +++ b/core/lib/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Sergio Benitez "] description = """ Web framework with a focus on usability, security, extensibility, and speed. """ -documentation = "https://api.rocket.rs/v0.5/rocket/" +documentation = "https://api.rocket.rs/master/rocket/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/core/lib/src/config/config.rs b/core/lib/src/config/config.rs index 031e31a0..0f4d3167 100644 --- a/core/lib/src/config/config.rs +++ b/core/lib/src/config/config.rs @@ -14,7 +14,7 @@ use crate::data::Limits; /// See the [module level docs](crate::config) as well as the [configuration /// guide] for further details. /// -/// [configuration guide]: https://rocket.rs/v0.5/guide/configuration/ +/// [configuration guide]: https://rocket.rs/master/guide/configuration/ /// /// # Defaults /// diff --git a/core/lib/src/config/mod.rs b/core/lib/src/config/mod.rs index 610e22bd..748cf286 100644 --- a/core/lib/src/config/mod.rs +++ b/core/lib/src/config/mod.rs @@ -2,7 +2,7 @@ //! //! See the [configuration guide] for full details. //! -//! [configuration guide]: https://rocket.rs/v0.5/guide/configuration/ +//! [configuration guide]: https://rocket.rs/master/guide/configuration/ //! //! ## Extracting Configuration Parameters //! diff --git a/core/lib/src/config/secret_key.rs b/core/lib/src/config/secret_key.rs index 13b7f3ca..6688b6bf 100644 --- a/core/lib/src/config/secret_key.rs +++ b/core/lib/src/config/secret_key.rs @@ -40,8 +40,8 @@ enum Kind { /// # */ /// ``` /// -/// [private cookies]: https://rocket.rs/v0.5/guide/requests/#private-cookies -/// [configuration guide]: https://rocket.rs/v0.5/guide/configuration/#secret-key +/// [private cookies]: https://rocket.rs/master/guide/requests/#private-cookies +/// [configuration guide]: https://rocket.rs/master/guide/configuration/#secret-key #[derive(PartialEq, Clone)] pub struct SecretKey { key: Key, diff --git a/core/lib/src/fairing/mod.rs b/core/lib/src/fairing/mod.rs index 559683df..df2ebf7a 100644 --- a/core/lib/src/fairing/mod.rs +++ b/core/lib/src/fairing/mod.rs @@ -365,7 +365,7 @@ pub use self::info_kind::{Info, Kind}; /// } /// ``` /// -/// [request-local state]: https://rocket.rs/v0.5/guide/state/#request-local-state +/// [request-local state]: https://rocket.rs/master/guide/state/#request-local-state #[crate::async_trait] pub trait Fairing: Send + Sync + 'static { /// Returns an [`Info`] structure containing the `name` and [`Kind`] of this diff --git a/core/lib/src/lib.rs b/core/lib/src/lib.rs index 1ea2fa52..f4ccc085 100644 --- a/core/lib/src/lib.rs +++ b/core/lib/src/lib.rs @@ -1,6 +1,6 @@ #![recursion_limit="256"] -#![doc(html_root_url = "https://api.rocket.rs/v0.5")] +#![doc(html_root_url = "https://api.rocket.rs/master")] #![doc(html_favicon_url = "https://rocket.rs/images/favicon.ico")] #![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")] #![cfg_attr(nightly, feature(doc_cfg))] @@ -21,10 +21,10 @@ //! automatic JSON (de)serialiazation, templating support, static file serving, //! and other useful features. //! -//! [overview]: https://rocket.rs/v0.5/overview -//! [full, detailed guide]: https://rocket.rs/v0.5/guide -//! [quickstart]: https://rocket.rs/v0.5/guide/quickstart -//! [getting started]: https://rocket.rs/v0.5/guide/getting-started +//! [overview]: https://rocket.rs/master/overview +//! [full, detailed guide]: https://rocket.rs/master/guide +//! [quickstart]: https://rocket.rs/master/guide/quickstart +//! [getting started]: https://rocket.rs/master/guide/getting-started //! //! ## Libraries //! @@ -43,7 +43,7 @@ //! rocket = "0.5.0-dev" //! ``` //! -//! See the [guide](https://rocket.rs/v0.5/guide) for more information on how to +//! See the [guide](https://rocket.rs/master/guide) for more information on how to //! write Rocket applications. Here's a simple example to get you started: //! //! ```rust,no_run @@ -74,8 +74,8 @@ //! rocket = { version = "0.5.0-dev", features = ["secrets", "tls"] } //! ``` //! -//! [private cookies]: https://rocket.rs/v0.5/guide/requests/#private-cookies -//! [TLS]: https://rocket.rs/v0.5/guide/configuration/#tls +//! [private cookies]: https://rocket.rs/master/guide/requests/#private-cookies +//! [TLS]: https://rocket.rs/master/guide/configuration/#tls //! //! ## Configuration //! @@ -84,7 +84,7 @@ //! configure Rocket, see the [configuration section] of the guide as well as //! the [`config`] module documentation. //! -//! [configuration section]: https://rocket.rs/v0.5/guide/configuration/ +//! [configuration section]: https://rocket.rs/master/guide/configuration/ //! //! ## Testing //! @@ -93,7 +93,7 @@ //! documentation and the [testing chapter of the guide] include detailed //! examples. //! -//! [testing chapter of the guide]: https://rocket.rs/v0.5/guide/testing/#testing +//! [testing chapter of the guide]: https://rocket.rs/master/guide/testing/#testing #[allow(unused_imports)] #[macro_use] extern crate rocket_codegen; pub use rocket_codegen::*; diff --git a/core/lib/src/local/mod.rs b/core/lib/src/local/mod.rs index 6a8daf10..4c2a101f 100644 --- a/core/lib/src/local/mod.rs +++ b/core/lib/src/local/mod.rs @@ -80,7 +80,7 @@ //! //! For more details on testing, see the [testing guide]. //! -//! [testing guide]: https://rocket.rs/v0.5/guide/testing/ +//! [testing guide]: https://rocket.rs/master/guide/testing/ //! [`Client`]: crate::local::asynchronous::Client //! //! # `Client` diff --git a/core/lib/src/request/from_request.rs b/core/lib/src/request/from_request.rs index 5e37f566..69f7316d 100644 --- a/core/lib/src/request/from_request.rs +++ b/core/lib/src/request/from_request.rs @@ -369,7 +369,7 @@ impl IntoOutcome for Result { /// Notice that these request guards provide access to *borrowed* data (`&'a /// User` and `Admin<'a>`) as the data is now owned by the request's cache. /// -/// [request-local state]: https://rocket.rs/v0.5/guide/state/#request-local-state +/// [request-local state]: https://rocket.rs/master/guide/state/#request-local-state #[crate::async_trait] pub trait FromRequest<'a, 'r>: Sized { /// The associated error to be returned if derivation fails. diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh index 27d54ff6..2eb72d12 100755 --- a/scripts/bump_version.sh +++ b/scripts/bump_version.sh @@ -1,40 +1,41 @@ #! /usr/bin/env bash # -# Bumps the version number from to on all libraries. +# Bumps the version number to ${1}. # SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "${SCRIPT_DIR}/config.sh" -if [ -z "${1}" ] || [ -z "${2}" ]; then - echo "Usage: $0 " - echo "Example: $0 0.1.1 0.1.2" +if [ -z "${1}" ] ; then + echo "Usage: $0 " + echo "Example: $0 0.6.1" exit 1 fi -if ! git grep -c "${1}" > /dev/null; then - echo "The version '${1}' doesn't appear to be correct." - echo "Exiting." - exit 1 +function do_replace_docs() { + sd "${1}" "${2}" $(fd -t f -e toml -E '/news/*' . "${PROJECT_ROOT}") + sd "${1}" "${2}" $(fd -t f -e md -E '/news/*' . "${SITE_ROOT}") +} + +function do_replace_all() { + sd "${1}" "${2}" $(fd -t f -e rs . "${PROJECT_ROOT}") + do_replace_docs "${1}" "${2}" +} + +NEW_VERSION="${1}" +TODAY=$(date "+%b %d, %Y") + +if $PRE_RELEASE; then + do_replace_all "/${PHYSICAL_CODENAME}" "/${CODENAME}" + do_replace_docs "${PHYSICAL_CODENAME}" "${CODENAME}" +else + NEW_CODENAME="v$(echo "${NEW_VERSION}" | cut -d'.' -f1-2)" + do_replace_all "/${VIRTUAL_CODENAME}" "/${CODENAME}" + do_replace_all "/${CODENAME}" "/${NEW_CODENAME}" + do_replace_docs "${VIRTUAL_CODENAME}" "${CODENAME}" + do_replace_docs "${CODENAME}" "${NEW_CODENAME}" fi -function major() { - echo "${1}" | cut -d'.' -f1-2 -} - -function do_replace() { - find "${PROJECT_ROOT}" -name "*.rs" | xargs sed -i.bak "s/${1}/${2}/g" - find "${PROJECT_ROOT}" -name "*.toml" -not -path "*/news/*" | xargs sed -i.bak "s/${1}/${2}/g" - find "${SITE_ROOT}" -name "*.md" -not -path "*/news/*" | xargs sed -i.bak "s/${1}/${2}/g" - sed -i.bak "s/${1}/${2}/g" "${SCRIPT_DIR}/config.sh" - sed -i.bak "s/${1}/${2}/g" "${PROJECT_ROOT}/README.md" -} - -do_replace "v$(major ${1})" "v$(major ${2})" -do_replace "${1}" "${2}" - -today=$(date "+%b %d, %Y") -sed -i.bak "s/^date.*/date = \"$today\"/" "${SITE_ROOT}/index.toml" - -find ${PROJECT_ROOT} -name "*.bak" | xargs rm +do_replace_all "${VERSION}" "${NEW_VERSION}" +sd "^date.*" "date = \"${TODAY}\"" "${SITE_ROOT}/index.toml" diff --git a/scripts/config.sh b/scripts/config.sh index be7d48a5..26b9b7a8 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -35,22 +35,6 @@ function future_date() { fi } -# Versioning information. These are toggled as versions change. -CURRENT_RELEASE=false -PRE_RELEASE=true - -# A generated codename for this version. Use the git branch for pre-releases. -case $PRE_RELEASE in - true) - VERSION_CODENAME="$(git branch --show-current)" - ROCKET_VERSION="${VERSION_CODENAME}-$(future_date)" - ;; - false) - ROCKET_VERSION="0.5.0-dev" - VERSION_CODENAME="$(echo "v${ROCKET_VERSION}" | cut -d'.' -f1-2)" - ;; -esac - # Root of workspace-like directories. PROJECT_ROOT=$(relative "") || exit $? CORE_ROOT=$(relative "core") || exit $? @@ -68,6 +52,26 @@ CONTRIB_CODEGEN_ROOT=$(relative "contrib/codegen") || exit $? EXAMPLES_DIR=$(relative "examples") || exit $? DOC_DIR=$(relative "target/doc") || exit $? +# Versioning information. These are changed as versions change. +VERSION=$(git grep -h "^version" "${CORE_LIB_ROOT}" | head -n 1 | cut -d '"' -f2) +MAJOR_VERSION=$(echo "${VERSION}" | cut -d'.' -f1-2) +VIRTUAL_CODENAME="$(git branch --show-current)" +PHYSICAL_CODENAME="v${MAJOR_VERSION}" +CURRENT_RELEASE=false +PRE_RELEASE=true + +# A generated codename for this version. Use the git branch for pre-releases. +case $PRE_RELEASE in + true) + CODENAME="${VIRTUAL_CODENAME}" + DOC_VERSION="${CODENAME}-$(future_date)" + ;; + false) + CODENAME="${PHYSICAL_CODENAME}" + DOC_VERSION="${VERSION}" + ;; +esac + ALL_PROJECT_DIRS=( "${CORE_HTTP_ROOT}" "${CORE_CODEGEN_ROOT}" @@ -77,10 +81,12 @@ ALL_PROJECT_DIRS=( ) function print_environment() { - echo " ROCKET_VERSION: ${ROCKET_VERSION}" + echo " VERSION: ${VERSION}" + echo " MAJOR_VERSION: ${MAJOR_VERSION}" + echo " CODENAME: ${CODENAME}" + echo " DOC_VERSION: ${DOC_VERSION}" echo " CURRENT_RELEASE: ${CURRENT_RELEASE}" echo " PRE_RELEASE: ${PRE_RELEASE}" - echo " VERSION_CODENAME: ${VERSION_CODENAME}" echo " SCRIPT_DIR: ${SCRIPT_DIR}" echo " PROJECT_ROOT: ${PROJECT_ROOT}" echo " CORE_ROOT: ${CORE_ROOT}" diff --git a/scripts/mk-docs.sh b/scripts/mk-docs.sh index 6fe39768..ed244bf8 100755 --- a/scripts/mk-docs.sh +++ b/scripts/mk-docs.sh @@ -19,7 +19,7 @@ fi # Generate the rustdocs for all of the crates. echo ":::: Generating the docs..." pushd "${PROJECT_ROOT}" > /dev/null 2>&1 -RUSTDOCFLAGS="-Z unstable-options --crate-version ${ROCKET_VERSION}" \ +RUSTDOCFLAGS="-Z unstable-options --crate-version ${DOC_VERSION}" \ cargo doc -p rocket -p rocket_contrib --no-deps --all-features popd > /dev/null 2>&1 diff --git a/site/README.md b/site/README.md index d56b05ea..72bf7944 100644 --- a/site/README.md +++ b/site/README.md @@ -13,7 +13,7 @@ This directory contains the following: * `news/*.md` - News articles linked to from `news/index.toml`. * `guide/*.md` - Guide pages linked to from `guide.md`. -[Rocket Programming Guide]: https://rocket.rs/v0.5/guide/ +[Rocket Programming Guide]: https://rocket.rs/master/guide/ ### Guide Links diff --git a/site/guide/1-quickstart.md b/site/guide/1-quickstart.md index 6964defc..c48cb815 100644 --- a/site/guide/1-quickstart.md +++ b/site/guide/1-quickstart.md @@ -14,7 +14,7 @@ For instance, the following set of commands runs the `hello_world` example: ```sh git clone https://github.com/SergioBenitez/Rocket cd Rocket -git checkout v0.5.0-dev +git checkout master cd examples/hello_world cargo run ``` diff --git a/site/guide/3-overview.md b/site/guide/3-overview.md index fedf3c1e..e8986959 100644 --- a/site/guide/3-overview.md +++ b/site/guide/3-overview.md @@ -200,8 +200,8 @@ You can find async-ready libraries on [crates.io](https://crates.io) with the ! note - Rocket 0.5 uses the tokio (0.2) runtime. The runtime is started for you if you - use `#[launch]` or `#[rocket::main]`, but you can still `launch()` a + Rocket master uses the tokio (0.2) runtime. The runtime is started for you if + you use `#[launch]` or `#[rocket::main]`, but you can still `launch()` a rocket instance on a custom-built `Runtime`. ### Cooperative Multitasking diff --git a/site/guide/5-responses.md b/site/guide/5-responses.md index b0241a12..7d2b3241 100644 --- a/site/guide/5-responses.md +++ b/site/guide/5-responses.md @@ -111,7 +111,7 @@ generated by `Status` for these and other codes: | 100, [200, 205] | Empty with given status. | | All others. | Invalid. Errors to `500` catcher. | -[`Status`]: https://api.rocket.rs/v0.5/rocket/http/struct.Status.html +[`Status`]: https://api.rocket.rs/master/rocket/http/struct.Status.html ## Custom Responders diff --git a/site/guide/index.md b/site/guide/index.md index fc20528d..bab9ded5 100644 --- a/site/guide/index.md +++ b/site/guide/index.md @@ -2,7 +2,7 @@ Welcome to Rocket! -This is the official guide for Rocket v0.5. It is designed to serve as a +This is the official guide for Rocket master. It is designed to serve as a starting point to writing web applications with Rocket and Rust. The guide is also designed to be a reference for experienced Rocket developers. This guide is conversational in tone. For purely technical documentation with examples, see diff --git a/site/index.toml b/site/index.toml index 32671951..f9c59d3d 100644 --- a/site/index.toml +++ b/site/index.toml @@ -4,7 +4,7 @@ [release] version = "0.5.0-dev" -date = "May 13, 2019" +date = "Oct 21, 2020" ############################################################################### # Top features: displayed in the header under the introductory text.