Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "MIT OR Apache-2.0"
edition = "2024"
rust-version = "1.88.0"
repository = "https://github.com/innoave/asserting"
readme = "docs/cratesio/README.md"

description = """
Fluent assertions for tests in Rust that are convenient to write and easy to extend.
Expand Down
364 changes: 9 additions & 355 deletions README.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//! This file is used to generate the README.md file for crates.io.
#![allow(clippy::expect_used)]

const README_PATH: &str = "README.md";
const CRATESIO_README_PATH: &str = "docs/cratesio/README.md";
const REPOSITORY_URL: &str = "https://github.com/innoave/asserting/tree/v";

use std::{env, fs};

fn main() {
rewrite_readme_for_cratesio_with_absolute_urls();
}

fn rewrite_readme_for_cratesio_with_absolute_urls() {
let version = env::var("CARGO_PKG_VERSION").expect("CARGO_PKG_VERSION must be set");

println!("cargo:rerun-if-changed={README_PATH}");

if let Ok(content) = fs::read_to_string(README_PATH) {
let target_url = format!("]({REPOSITORY_URL}{version}/docs/");
let updated_content = content.replace("](docs/", &target_url);

// Write README with absolute URLs for crates.io
let _ = fs::write(CRATESIO_README_PATH, updated_content);
}
}
Loading
Loading