Version documentation.

This commit is contained in:
Sergio Benitez 2018-10-06 21:16:02 -07:00
parent 9cb031a47d
commit 8b1e93192e
9 changed files with 46 additions and 32 deletions

View File

@ -3,7 +3,7 @@ name = "rocket_contrib"
version = "0.4.0-dev" version = "0.4.0-dev"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
description = "Community contributed libraries for the Rocket web framework." 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" homepage = "https://rocket.rs"
repository = "https://github.com/SergioBenitez/Rocket" repository = "https://github.com/SergioBenitez/Rocket"
readme = "../../README.md" readme = "../../README.md"

View File

@ -2,8 +2,9 @@
#![feature(never_type)] #![feature(never_type)]
#![feature(doc_cfg)] #![feature(doc_cfg)]
// TODO: Version URLs. #![doc(html_root_url = "https://api.rocket.rs/0.4.0-dev")]
#![doc(html_root_url = "https://api.rocket.rs")] #![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 //! This crate contains officially sanctioned contributor libraries that provide
//! functionality commonly used by Rocket applications. //! functionality commonly used by Rocket applications.
@ -31,7 +32,7 @@
//! //!
//! ```toml //! ```toml
//! [dependencies.rocket_contrib] //! [dependencies.rocket_contrib]
//! version = "*" //! version = "0.4.0-dev"
//! default-features = false //! default-features = false
//! features = ["json"] //! features = ["json"]
//! ``` //! ```

View File

@ -3,7 +3,7 @@ name = "rocket_codegen_next"
version = "0.4.0-dev" version = "0.4.0-dev"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
description = "Procedural macros for the Rocket web framework." 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" homepage = "https://rocket.rs"
repository = "https://github.com/SergioBenitez/Rocket" repository = "https://github.com/SergioBenitez/Rocket"
readme = "../../README.md" readme = "../../README.md"

View File

@ -4,6 +4,10 @@
#![feature(rustc_private)] #![feature(rustc_private)]
#![recursion_limit="128"] #![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 //! # Rocket - Code Generation
//! //!
//! This crate implements the code generation portions of Rocket. This includes //! This crate implements the code generation portions of Rocket. This includes

View File

@ -5,7 +5,7 @@ authors = ["Sergio Benitez <sb@sergio.bz>"]
description = """ description = """
Web framework for nightly with a focus on ease-of-use, expressibility, and speed. 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" homepage = "https://rocket.rs"
repository = "https://github.com/SergioBenitez/Rocket" repository = "https://github.com/SergioBenitez/Rocket"
readme = "../../README.md" readme = "../../README.md"

View File

@ -10,8 +10,7 @@
#![recursion_limit="256"] #![recursion_limit="256"]
// TODO: Version URLs. #![doc(html_root_url = "https://api.rocket.rs/0.4.0-dev")]
#![doc(html_root_url = "https://api.rocket.rs")]
#![doc(html_favicon_url = "https://rocket.rs/favicon.ico")] #![doc(html_favicon_url = "https://rocket.rs/favicon.ico")]
#![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")] #![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 //! detailed guide]. If you'd like pointers on getting started, see the
//! [quickstart] or [getting started] chapters of the guide. //! [quickstart] or [getting started] chapters of the guide.
//! //!
//! You may also be interested in looking at the [`rocket_contrib`] //! You may also be interested in looking at the
//! documentation, which contains automatic JSON (de)serialiazation, templating //! [`rocket_contrib`](../rocket_contrib) documentation, which contains
//! support, static file serving, and other useful features. //! automatic JSON (de)serialiazation, templating support, static file serving,
//! and other useful features.
//! //!
//! [overview]: https://rocket.rs/overview //! [overview]: https://rocket.rs/overview
//! [full, detailed guide]: https://rocket.rs/guide //! [full, detailed guide]: https://rocket.rs/guide
@ -38,7 +38,7 @@
//! Rocket's functionality is split into two crates: //! Rocket's functionality is split into two crates:
//! //!
//! 1. Core - This core library. Needed by every Rocket application. //! 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. //! Rocket applications. Completely optional.
//! //!
//! ## Usage //! ## Usage

View File

@ -4,16 +4,26 @@
# Bumps the version number from <current> to <next> on all libraries. # Bumps the version number from <current> to <next> on all libraries.
# #
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPT_DIR}/config.sh"
if [ -z "${1}" ] || [ -z "${2}" ]; then if [ -z "${1}" ] || [ -z "${2}" ]; then
echo "Usage: $0 <current> <next>" echo "Usage: $0 <current> <next>"
echo "Example: $0 0.1.1 0.1.2" echo "Example: $0 0.1.1 0.1.2"
exit 1 exit 1
fi 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") today=$(date "+%b %d, %Y")
find . -name "lib.rs" | xargs sed -i.bak "s/${1}/${2}/g" find "${PROJECT_ROOT}" -name "lib.rs" | xargs sed -i.bak "s/${1}/${2}/g"
find . -name "*.toml" | xargs sed -i.bak "s/${1}/${2}/g" find "${PROJECT_ROOT}" -name "*.toml" | xargs sed -i.bak "s/${1}/${2}/g"
find site/ -name "*.md" | 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/index.toml sed -i.bak "s/^date.*/date = \"$today\"/" "${SITE_ROOT}/index.toml"
find . -name "*.bak" | xargs rm sed -i.bak "s/${1}/${2}/g" "${SCRIPT_DIR}/config.sh"
find ${PROJECT_ROOT} -name "*.bak" | xargs rm

View File

@ -23,17 +23,21 @@ function relative() {
fi fi
} }
ROCKET_VERSION="0.4.0-dev"
CURRENT_RELEASE=false
# Root of workspace-like directories. # Root of workspace-like directories.
PROJECT_ROOT=$(relative "") || exit $? PROJECT_ROOT=$(relative "") || exit $?
CORE_ROOT=$(relative "core") || exit $? CORE_ROOT=$(relative "core") || exit $?
CONTRIB_ROOT=$(relative "contrib") || exit $? CONTRIB_ROOT=$(relative "contrib") || exit $?
SITE_ROOT=$(relative "site") || exit $?
# Root of project-like directories. # Root of project-like directories.
CORE_LIB_ROOT=$(relative "core/lib") || exit $? CORE_LIB_ROOT=$(relative "core/lib") || exit $?
# CORE_CODEGEN_ROOT=$(relative "core/codegen") || exit $?
CORE_CODEGEN_NEXT_ROOT=$(relative "core/codegen_next") || exit $? CORE_CODEGEN_NEXT_ROOT=$(relative "core/codegen_next") || exit $?
CORE_HTTP_ROOT=$(relative "core/http") || exit $? CORE_HTTP_ROOT=$(relative "core/http") || exit $?
CONTRIB_LIB_ROOT=$(relative "contrib/lib") || exit $? CONTRIB_LIB_ROOT=$(relative "contrib/lib") || exit $?
CONTRIB_CODEGEN_ROOT=$(relative "contrib/codegen") || exit $?
# Root of infrastructure directories. # Root of infrastructure directories.
EXAMPLES_DIR=$(relative "examples") || exit $? EXAMPLES_DIR=$(relative "examples") || exit $?
@ -41,10 +45,10 @@ DOC_DIR=$(relative "target/doc") || exit $?
ALL_PROJECT_DIRS=( ALL_PROJECT_DIRS=(
"${CORE_LIB_ROOT}" "${CORE_LIB_ROOT}"
# "${CORE_CODEGEN_ROOT}"
"${CORE_CODEGEN_NEXT_ROOT}" "${CORE_CODEGEN_NEXT_ROOT}"
"${CORE_HTTP_ROOT}" "${CORE_HTTP_ROOT}"
"${CONTRIB_LIB_ROOT}" "${CONTRIB_LIB_ROOT}"
"${CONTRIB_CODEGEN_ROOT}"
) )
if [ "${1}" = "-p" ]; then if [ "${1}" = "-p" ]; then
@ -52,12 +56,13 @@ if [ "${1}" = "-p" ]; then
echo "PROJECT_ROOT: ${PROJECT_ROOT}" echo "PROJECT_ROOT: ${PROJECT_ROOT}"
echo "CORE_ROOT: ${CORE_ROOT}" echo "CORE_ROOT: ${CORE_ROOT}"
echo "CONTRIB_ROOT: ${CONTRIB_ROOT}" echo "CONTRIB_ROOT: ${CONTRIB_ROOT}"
echo "SITE_ROOT: ${SITE_ROOT}"
echo "CORE_LIB_ROOT: ${CORE_LIB_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_CODEGEN_NEXT_ROOT: ${CORE_CODEGEN_NEXT_ROOT}"
echo "CORE_HTTP_ROOT: ${CORE_HTTP_ROOT}" echo "CORE_HTTP_ROOT: ${CORE_HTTP_ROOT}"
echo "CONTRIB_LIB_ROOT: ${CONTRIB_LIB_ROOT}" echo "CONTRIB_LIB_ROOT: ${CONTRIB_LIB_ROOT}"
echo "CONTRIB_CODEGEN_ROOT: ${CONTRIB_CODEGEN_ROOT}"
echo "EXAMPLES_DIR: ${EXAMPLES_DIR}" echo "EXAMPLES_DIR: ${EXAMPLES_DIR}"
echo "DOC_DIR: ${DOC_DIR}" echo "DOC_DIR: ${DOC_DIR}"
echo "ALL_PROJECT_DIRECTORIES: ${ALL_PROJECT_DIRECTORIES[*]}" echo "ALL_PROJECT_DIRS: ${ALL_PROJECT_DIRS[*]}"
fi fi

View File

@ -9,23 +9,17 @@ set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPT_DIR}/config.sh" 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. # We need to clean-up beforehand so we don't get all of the dependencies.
echo ":::: Cleaning up before documenting..." echo ":::: Cleaning up before documenting..."
cargo clean cargo clean
cargo update cargo update
# Generate the rustdocs for all of the crates. # Generate the rustdocs for all of the crates.
for dir in "${ALL_PROJECT_DIRS[@]}"; do echo ":::: Generating the docs..."
mk_doc "${dir}" pushd "${PROJECT_ROOT}" > /dev/null 2>&1
done 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. # Blank index, for redirection.
touch "${DOC_DIR}/index.html" touch "${DOC_DIR}/index.html"