diff --git a/Cargo.lock b/Cargo.lock index 0c07d3886..416f48f79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -644,7 +644,6 @@ dependencies = [ name = "bottlerocket-variant" version = "0.1.0" dependencies = [ - "generate-readme", "serde", "snafu", ] @@ -725,20 +724,6 @@ dependencies = [ "either", ] -[[package]] -name = "cargo-readme" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10217a8c6eb2ad03cacb4ef2e2839b69abcc7cefb37a83906b331418eb8f6f0a" -dependencies = [ - "clap 4.4.3", - "lazy_static", - "percent-encoding", - "regex", - "serde", - "toml 0.7.8", -] - [[package]] name = "cc" version = "1.0.83" @@ -1305,14 +1290,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generate-readme" -version = "0.1.0" -dependencies = [ - "cargo-readme", - "snafu", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2070,7 +2047,6 @@ name = "parse-datetime" version = "0.1.0" dependencies = [ "chrono", - "generate-readme", "snafu", ] @@ -3295,18 +3271,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", -] - [[package]] name = "toml" version = "0.8.0" @@ -3316,7 +3280,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.0", + "toml_edit", ] [[package]] @@ -3328,19 +3292,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.0.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.20.0" diff --git a/Cargo.toml b/Cargo.toml index 58fbb9244..c935eb3a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,6 @@ resolver = "2" members = [ "tools/bottlerocket-variant", "tools/buildsys", - "tools/generate-readme", "tools/parse-datetime", "tools/pubsys", "tools/pubsys-config", diff --git a/tools/bottlerocket-variant/Cargo.toml b/tools/bottlerocket-variant/Cargo.toml index db2be2888..f94a12416 100644 --- a/tools/bottlerocket-variant/Cargo.toml +++ b/tools/bottlerocket-variant/Cargo.toml @@ -12,5 +12,3 @@ exclude = ["README.md"] serde = "1" snafu = "0.7" -[build-dependencies] -generate-readme = { version = "0.1", path = "../generate-readme" } diff --git a/tools/bottlerocket-variant/README.md b/tools/bottlerocket-variant/README.md deleted file mode 100644 index cd958fbcf..000000000 --- a/tools/bottlerocket-variant/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# bottlerocket-variant - -Current version: 0.1.0 - -This library provides a structure for representing a Bottlerocket variant as well as functionality -useful in build scripts and other tooling that is variant-aware. - -## Colophon - -This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`. diff --git a/tools/bottlerocket-variant/README.tpl b/tools/bottlerocket-variant/README.tpl deleted file mode 100644 index 91fb62910..000000000 --- a/tools/bottlerocket-variant/README.tpl +++ /dev/null @@ -1,9 +0,0 @@ -# {{crate}} - -Current version: {{version}} - -{{readme}} - -## Colophon - -This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`. diff --git a/tools/bottlerocket-variant/build.rs b/tools/bottlerocket-variant/build.rs deleted file mode 100644 index 42defdba2..000000000 --- a/tools/bottlerocket-variant/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - generate_readme::from_lib().unwrap(); -} diff --git a/tools/generate-readme/Cargo.toml b/tools/generate-readme/Cargo.toml deleted file mode 100644 index 1ff41345a..000000000 --- a/tools/generate-readme/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "generate-readme" -version = "0.1.0" -authors = ["Matt Briggs "] -license = "Apache-2.0 OR MIT" -edition = "2021" -publish = false - -[dependencies] -cargo-readme = "3" -snafu = "0.7" diff --git a/tools/generate-readme/src/lib.rs b/tools/generate-readme/src/lib.rs deleted file mode 100644 index 6ab92d58c..000000000 --- a/tools/generate-readme/src/lib.rs +++ /dev/null @@ -1,97 +0,0 @@ -/*! -This small lib is used to generate README files for the crates in the `sources` workspace. These -functions are called in a crate's build.rs file to generate a README from Rust doc comments. -!*/ - -use snafu::ResultExt; -use std::fs::File; -use std::io::Write; -use std::path::{Path, PathBuf}; - -pub type Result = std::result::Result; - -pub mod error { - use snafu::Snafu; - use std::path::PathBuf; - - #[derive(Debug, Snafu)] - #[snafu(visibility(pub(super)))] - pub enum Error { - #[snafu(display("Unable to create the 'README.md' file: {}", source))] - ReadmeCreate { source: std::io::Error }, - - #[snafu(display("Unable to generate the 'README.md' file contents: {}", error))] - ReadmeGenerate { error: String }, - - #[snafu(display("Unable to open '{}': {}", file.display(), source))] - ReadmeSourceOpen { - file: PathBuf, - source: std::io::Error, - }, - - #[snafu(display("Unable to open 'README.tpl': {}", source))] - ReadmeTemplateOpen { source: std::io::Error }, - - #[snafu(display("Unable to write to the 'README.md' file: {}", source))] - ReadmeWrite { source: std::io::Error }, - } -} - -/// When this function is called in a `build.rs` file, it will generate a `README.md` (as a sibling -/// to `build.rs`). It uses the doc comments found in `src/main.rs` and the `cargo-readme` crate to -/// do so. The template for `cargo-readme` is expected to be `README.tpl` as a sibling file to -/// `build.rs`. -pub fn from_main() -> Result<()> { - from_file("src/main.rs") -} - -/// When this function is called in a `build.rs` file, it will generate a `README.md` (as a sibling -/// to `build.rs`). It uses the doc comments found in `src/lib.rs` and the `cargo-readme` crate to -/// do so. The template for `cargo-readme` is expected to be `README.tpl` as a sibling file to -/// `build.rs`. -pub fn from_lib() -> Result<()> { - from_file("src/lib.rs") -} - -/// When this function is called in a `build.rs` file, it will generate a `README.md` (as a sibling -/// to `build.rs`). It uses the doc comments found in `rust_file` and the `cargo-readme` crate to do -/// so. The template for `cargo-readme` is expected to be `README.tpl` as a sibling file to -/// `build.rs`. -pub fn from_file

(rust_file: P) -> Result<()> -where - P: AsRef, -{ - // Check for environment variable "SKIP_README". If it is set, - // skip README generation - if std::env::var_os("SKIP_README").is_some() { - return Ok(()); - } - - let mut source = File::open(rust_file.as_ref()).context(error::ReadmeSourceOpenSnafu { - file: rust_file.as_ref(), - })?; - let mut template = File::open("README.tpl").context(error::ReadmeTemplateOpenSnafu)?; - - let mut content = cargo_readme::generate_readme( - &PathBuf::from("."), // root - &mut source, // source - Some(&mut template), // template - // The "add x" arguments don't apply when using a template. - true, // add title - false, // add badges - false, // add license - true, // indent headings - ) - .map_err(|e| error::ReadmeGenerateSnafu { error: e }.build())?; - - // Make sure the end of the file has a newline - if content.chars().last().unwrap_or_default() != '\n' { - content += "\n"; - } - - let mut readme = File::create("README.md").context(error::ReadmeCreateSnafu)?; - readme - .write_all(content.as_bytes()) - .context(error::ReadmeWriteSnafu)?; - Ok(()) -} diff --git a/tools/parse-datetime/Cargo.toml b/tools/parse-datetime/Cargo.toml index 22c13f81c..823094013 100644 --- a/tools/parse-datetime/Cargo.toml +++ b/tools/parse-datetime/Cargo.toml @@ -11,6 +11,3 @@ exclude = ["README.md"] [dependencies] chrono = { version = "0.4", default-features = false, features = ["std", "clock"] } snafu = { version = "0.7", features = ["backtraces-impl-backtrace-crate"] } - -[build-dependencies] -generate-readme = { version = "0.1", path = "../generate-readme" } diff --git a/tools/parse-datetime/README.md b/tools/parse-datetime/README.md deleted file mode 100644 index 0c5b491d2..000000000 --- a/tools/parse-datetime/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# parse-datetime - -Current version: 0.1.0 - -## Background - -This library parses a `DateTime` from a string. - -The string can be: - -* an `RFC3339` formatted date / time -* a string with the form `"[in] "` where 'in' is optional - * `` may be any unsigned integer and - * `` may be either the singular or plural form of the following: `hour | hours`, `day | days`, `week | weeks` - -Examples: - -* `"in 1 hour"` -* `"in 2 hours"` -* `"in 6 days"` -* `"in 2 weeks"` -* `"1 hour"` -* `"7 days"` - -## Colophon - -This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`. diff --git a/tools/parse-datetime/README.tpl b/tools/parse-datetime/README.tpl deleted file mode 100644 index 91fb62910..000000000 --- a/tools/parse-datetime/README.tpl +++ /dev/null @@ -1,9 +0,0 @@ -# {{crate}} - -Current version: {{version}} - -{{readme}} - -## Colophon - -This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`. diff --git a/tools/parse-datetime/build.rs b/tools/parse-datetime/build.rs deleted file mode 100644 index 42defdba2..000000000 --- a/tools/parse-datetime/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - generate_readme::from_lib().unwrap(); -}