From 8b1e93192ee6ee8f6067b0be1e65993092bb06ff Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sat, 6 Oct 2018 21:16:02 -0700 Subject: [PATCH] Version documentation. --- contrib/lib/Cargo.toml | 2 +- contrib/lib/src/lib.rs | 7 ++++--- core/codegen_next/Cargo.toml | 2 +- core/codegen_next/src/lib.rs | 4 ++++ core/lib/Cargo.toml | 2 +- core/lib/src/lib.rs | 12 ++++++------ scripts/bump_version.sh | 20 +++++++++++++++----- scripts/config.sh | 13 +++++++++---- scripts/mk-docs.sh | 16 +++++----------- 9 files changed, 46 insertions(+), 32 deletions(-) diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml index 70cd6183..4e346981 100644 --- a/contrib/lib/Cargo.toml +++ b/contrib/lib/Cargo.toml @@ -3,7 +3,7 @@ name = "rocket_contrib" version = "0.4.0-dev" authors = ["Sergio Benitez "] description = "Community contributed libraries for the Rocket web framework." -documentation = "https://api.rocket.rs/rocket_contrib/" +documentation = "https://api.rocket.rs/0.4.0-dev/rocket_contrib/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/contrib/lib/src/lib.rs b/contrib/lib/src/lib.rs index ba77f858..a084a42b 100644 --- a/contrib/lib/src/lib.rs +++ b/contrib/lib/src/lib.rs @@ -2,8 +2,9 @@ #![feature(never_type)] #![feature(doc_cfg)] -// TODO: Version URLs. -#![doc(html_root_url = "https://api.rocket.rs")] +#![doc(html_root_url = "https://api.rocket.rs/0.4.0-dev")] +#![doc(html_favicon_url = "https://rocket.rs/favicon.ico")] +#![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")] //! This crate contains officially sanctioned contributor libraries that provide //! functionality commonly used by Rocket applications. @@ -31,7 +32,7 @@ //! //! ```toml //! [dependencies.rocket_contrib] -//! version = "*" +//! version = "0.4.0-dev" //! default-features = false //! features = ["json"] //! ``` diff --git a/core/codegen_next/Cargo.toml b/core/codegen_next/Cargo.toml index e352f30b..fa21f52e 100644 --- a/core/codegen_next/Cargo.toml +++ b/core/codegen_next/Cargo.toml @@ -3,7 +3,7 @@ name = "rocket_codegen_next" version = "0.4.0-dev" authors = ["Sergio Benitez "] description = "Procedural macros for the Rocket web framework." -documentation = "https://api.rocket.rs/rocket_codegen/" +documentation = "https://api.rocket.rs/0.4.0-dev/rocket_codegen_next/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/core/codegen_next/src/lib.rs b/core/codegen_next/src/lib.rs index 2089f0fc..9b9cda08 100644 --- a/core/codegen_next/src/lib.rs +++ b/core/codegen_next/src/lib.rs @@ -4,6 +4,10 @@ #![feature(rustc_private)] #![recursion_limit="128"] +#![doc(html_root_url = "https://api.rocket.rs/0.4.0-dev")] +#![doc(html_favicon_url = "https://rocket.rs/favicon.ico")] +#![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")] + //! # Rocket - Code Generation //! //! This crate implements the code generation portions of Rocket. This includes diff --git a/core/lib/Cargo.toml b/core/lib/Cargo.toml index d9d59e83..567b3abe 100644 --- a/core/lib/Cargo.toml +++ b/core/lib/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Sergio Benitez "] description = """ Web framework for nightly with a focus on ease-of-use, expressibility, and speed. """ -documentation = "https://api.rocket.rs/rocket/" +documentation = "https://api.rocket.rs/0.4.0-dev/rocket/" homepage = "https://rocket.rs" repository = "https://github.com/SergioBenitez/Rocket" readme = "../../README.md" diff --git a/core/lib/src/lib.rs b/core/lib/src/lib.rs index a5b8700c..199198c0 100644 --- a/core/lib/src/lib.rs +++ b/core/lib/src/lib.rs @@ -10,8 +10,7 @@ #![recursion_limit="256"] -// TODO: Version URLs. -#![doc(html_root_url = "https://api.rocket.rs")] +#![doc(html_root_url = "https://api.rocket.rs/0.4.0-dev")] #![doc(html_favicon_url = "https://rocket.rs/favicon.ico")] #![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")] @@ -24,9 +23,10 @@ //! detailed guide]. If you'd like pointers on getting started, see the //! [quickstart] or [getting started] chapters of the guide. //! -//! You may also be interested in looking at the [`rocket_contrib`] -//! documentation, which contains automatic JSON (de)serialiazation, templating -//! support, static file serving, and other useful features. +//! You may also be interested in looking at the +//! [`rocket_contrib`](../rocket_contrib) documentation, which contains +//! automatic JSON (de)serialiazation, templating support, static file serving, +//! and other useful features. //! //! [overview]: https://rocket.rs/overview //! [full, detailed guide]: https://rocket.rs/guide @@ -38,7 +38,7 @@ //! Rocket's functionality is split into two crates: //! //! 1. Core - This core library. Needed by every Rocket application. -//! 2. [Contrib](rocket_contrib) - Provides useful functionality for many +//! 2. [Contrib](../rocket_contrib) - Provides useful functionality for many //! Rocket applications. Completely optional. //! //! ## Usage diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh index 8beffc8b..9c471d4b 100755 --- a/scripts/bump_version.sh +++ b/scripts/bump_version.sh @@ -4,16 +4,26 @@ # Bumps the version number from to on all libraries. # +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" 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 +fi + today=$(date "+%b %d, %Y") -find . -name "lib.rs" | xargs sed -i.bak "s/${1}/${2}/g" -find . -name "*.toml" | xargs sed -i.bak "s/${1}/${2}/g" -find site/ -name "*.md" | xargs sed -i.bak "s/${1}/${2}/g" -sed -i.bak "s/^date.*/date = \"$today\"/" site/index.toml -find . -name "*.bak" | xargs rm +find "${PROJECT_ROOT}" -name "lib.rs" | xargs sed -i.bak "s/${1}/${2}/g" +find "${PROJECT_ROOT}" -name "*.toml" | xargs sed -i.bak "s/${1}/${2}/g" +find "${SITE_ROOT}" -name "*.md" | xargs sed -i.bak "s/${1}/${2}/g" +sed -i.bak "s/^date.*/date = \"$today\"/" "${SITE_ROOT}/index.toml" +sed -i.bak "s/${1}/${2}/g" "${SCRIPT_DIR}/config.sh" +find ${PROJECT_ROOT} -name "*.bak" | xargs rm diff --git a/scripts/config.sh b/scripts/config.sh index c5bf8531..62120698 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -23,17 +23,21 @@ function relative() { fi } +ROCKET_VERSION="0.4.0-dev" +CURRENT_RELEASE=false + # Root of workspace-like directories. PROJECT_ROOT=$(relative "") || exit $? CORE_ROOT=$(relative "core") || exit $? CONTRIB_ROOT=$(relative "contrib") || exit $? +SITE_ROOT=$(relative "site") || exit $? # Root of project-like directories. CORE_LIB_ROOT=$(relative "core/lib") || exit $? -# CORE_CODEGEN_ROOT=$(relative "core/codegen") || exit $? CORE_CODEGEN_NEXT_ROOT=$(relative "core/codegen_next") || exit $? CORE_HTTP_ROOT=$(relative "core/http") || exit $? CONTRIB_LIB_ROOT=$(relative "contrib/lib") || exit $? +CONTRIB_CODEGEN_ROOT=$(relative "contrib/codegen") || exit $? # Root of infrastructure directories. EXAMPLES_DIR=$(relative "examples") || exit $? @@ -41,10 +45,10 @@ DOC_DIR=$(relative "target/doc") || exit $? ALL_PROJECT_DIRS=( "${CORE_LIB_ROOT}" - # "${CORE_CODEGEN_ROOT}" "${CORE_CODEGEN_NEXT_ROOT}" "${CORE_HTTP_ROOT}" "${CONTRIB_LIB_ROOT}" + "${CONTRIB_CODEGEN_ROOT}" ) if [ "${1}" = "-p" ]; then @@ -52,12 +56,13 @@ if [ "${1}" = "-p" ]; then echo "PROJECT_ROOT: ${PROJECT_ROOT}" echo "CORE_ROOT: ${CORE_ROOT}" echo "CONTRIB_ROOT: ${CONTRIB_ROOT}" + echo "SITE_ROOT: ${SITE_ROOT}" echo "CORE_LIB_ROOT: ${CORE_LIB_ROOT}" - # echo "CORE_CODEGEN_ROOT: ${CORE_CODEGEN_ROOT}" echo "CORE_CODEGEN_NEXT_ROOT: ${CORE_CODEGEN_NEXT_ROOT}" echo "CORE_HTTP_ROOT: ${CORE_HTTP_ROOT}" echo "CONTRIB_LIB_ROOT: ${CONTRIB_LIB_ROOT}" + echo "CONTRIB_CODEGEN_ROOT: ${CONTRIB_CODEGEN_ROOT}" echo "EXAMPLES_DIR: ${EXAMPLES_DIR}" echo "DOC_DIR: ${DOC_DIR}" - echo "ALL_PROJECT_DIRECTORIES: ${ALL_PROJECT_DIRECTORIES[*]}" + echo "ALL_PROJECT_DIRS: ${ALL_PROJECT_DIRS[*]}" fi diff --git a/scripts/mk-docs.sh b/scripts/mk-docs.sh index c981373f..1fb7ce49 100755 --- a/scripts/mk-docs.sh +++ b/scripts/mk-docs.sh @@ -9,23 +9,17 @@ set -e SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "${SCRIPT_DIR}/config.sh" -function mk_doc() { - local dir=$1 - pushd "${dir}" > /dev/null 2>&1 - echo ":: Documenting '${dir}'..." - cargo doc --no-deps --all-features - popd > /dev/null 2>&1 -} - # We need to clean-up beforehand so we don't get all of the dependencies. echo ":::: Cleaning up before documenting..." cargo clean cargo update # Generate the rustdocs for all of the crates. -for dir in "${ALL_PROJECT_DIRS[@]}"; do - mk_doc "${dir}" -done +echo ":::: Generating the docs..." +pushd "${PROJECT_ROOT}" > /dev/null 2>&1 +RUSTDOCFLAGS="-Z unstable-options --crate-version ${ROCKET_VERSION}" \ + cargo doc -p rocket -p rocket_contrib -p rocket_codegen_next --no-deps --all-features +popd > /dev/null 2>&1 # Blank index, for redirection. touch "${DOC_DIR}/index.html"