Prepare for 0.2.0 release

This commit is contained in:
Zhaofeng Li 2021-11-18 13:15:20 -08:00
parent e5665775b2
commit fae58994e4
4 changed files with 63 additions and 7 deletions

23
Cargo.lock generated
View file

@ -120,13 +120,14 @@ dependencies = [
[[package]] [[package]]
name = "colmena" name = "colmena"
version = "0.1.0" version = "0.2.0-pre"
dependencies = [ dependencies = [
"ansi-to-html", "ansi-to-html",
"async-trait", "async-trait",
"atty", "atty",
"clap", "clap",
"console 0.13.0", "console 0.13.0",
"const_format",
"env_logger", "env_logger",
"futures", "futures",
"glob", "glob",
@ -179,6 +180,26 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "const_format"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22bc6cd49b0ec407b680c3e380182b6ac63b73991cb7602de350352fc309b614"
dependencies = [
"const_format_proc_macros",
]
[[package]]
name = "const_format_proc_macros"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]] [[package]]
name = "doc-comment" name = "doc-comment"
version = "0.3.3" version = "0.3.3"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "colmena" name = "colmena"
version = "0.1.0" version = "0.2.0-pre"
authors = ["Zhaofeng Li <hello@zhaofeng.li>"] authors = ["Zhaofeng Li <hello@zhaofeng.li>"]
edition = "2018" edition = "2018"
@ -12,6 +12,7 @@ async-trait = "0.1.42"
atty = "0.2" atty = "0.2"
clap = "2.33.3" clap = "2.33.3"
console = "0.13.0" console = "0.13.0"
const_format = "0.2.22"
env_logger = "0.8.2" env_logger = "0.8.2"
futures = "0.3.8" futures = "0.3.8"
glob = "0.3.0" glob = "0.3.0"

View file

@ -11,15 +11,15 @@ in {
stdenv = pkgs.stdenv; stdenv = pkgs.stdenv;
rustPlatform = pkgs.rustPlatform; rustPlatform = pkgs.rustPlatform;
in rustPlatform.buildRustPackage { in rustPlatform.buildRustPackage {
name = "colmena-dev"; name = "colmena";
version = "0.1.0"; version = "0.2.0-pre";
src = lib.cleanSourceWith { src = lib.cleanSourceWith {
filter = name: type: !(type == "directory" && builtins.elem (baseNameOf name) [ "target" "manual" ]); filter = name: type: !(type == "directory" && builtins.elem (baseNameOf name) [ "target" "manual" ]);
src = lib.cleanSource ./.; src = lib.cleanSource ./.;
}; };
cargoSha256 = "sha256-JDJQnKO0j1DegOyuZi3WU4wVnotucSVPbwbn25R8Jb8="; cargoSha256 = "sha256-cpxvhP9TVEaIaiIZ+X22bDREqALpgWtW6koucVfMLwY=";
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
mkdir completions mkdir completions

View file

@ -1,16 +1,49 @@
//! Global CLI Setup. //! Global CLI Setup.
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
use const_format::concatcp;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use crate::command; use crate::command;
/// Base URL of the manual, without the trailing slash.
const MANUAL_URL_BASE: &'static str = "https://zhaofengli.github.io/colmena";
/// URL to the manual.
///
/// We maintain CLI and Nix API stability for each minor version.
/// This ensures that the user always sees accurate documentations, and we can
/// easily perform updates to the manual after a release.
const MANUAL_URL: &'static str = concatcp!(MANUAL_URL_BASE, "/", env!("CARGO_PKG_VERSION_MAJOR"), ".", env!("CARGO_PKG_VERSION_MINOR"));
/// The note shown when the user is using a pre-release version.
///
/// API stability cannot be guaranteed for pre-release versions.
/// Links to the version currently in development automatically
/// leads the user to the unstable manual.
const MANUAL_DISCREPANCY_NOTE: &'static str = "Note: You are using a pre-release version of Colmena, so the supported options may be different from what's in the manual.";
lazy_static! { lazy_static! {
static ref LONG_ABOUT: String = {
let mut message = format!(r#"NixOS deployment tool
Colmena helps you deploy to multiple hosts running NixOS.
For more details, read the manual at <{}>.
"#, MANUAL_URL);
if env!("CARGO_PKG_VERSION_PRE").len() != 0 {
message += &MANUAL_DISCREPANCY_NOTE;
}
message
};
static ref CONFIG_HELP: String = { static ref CONFIG_HELP: String = {
format!(r#"If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly. format!(r#"If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly.
For a sample configuration, see <https://zhaofengli.github.io/colmena/{}>. For a sample configuration, check the manual at <{}>.
"#, env!("CARGO_PKG_VERSION")) "#, MANUAL_URL)
}; };
} }
@ -42,6 +75,7 @@ pub fn build_cli(include_internal: bool) -> App<'static, 'static> {
.version(version) .version(version)
.author("Zhaofeng Li <hello@zhaofeng.li>") .author("Zhaofeng Li <hello@zhaofeng.li>")
.about("NixOS deployment tool") .about("NixOS deployment tool")
.long_about(LONG_ABOUT.as_str())
.global_setting(AppSettings::ColoredHelp) .global_setting(AppSettings::ColoredHelp)
.setting(AppSettings::ArgRequiredElseHelp) .setting(AppSettings::ArgRequiredElseHelp)
.arg(Arg::with_name("config") .arg(Arg::with_name("config")