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
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
This repository contains a set of crates that help you build robust highly scalable services in Rust.

- [Crates](#crates)
- [About this Repo](#about-this-repo)
- [About This Repo](#about-this-repo)
- [Adding New Crates](#adding-new-crates)
- [Publishing Crates](#publishing-crates)
- [Documenting Crates](#documenting-crates)
Expand All @@ -23,26 +23,19 @@ This repository contains a set of crates that help you build robust highly scala

## Crates

These are the crates built out of this repo:
These are the primary crates built out of this repo:

- [`bytesbuf`](./crates/bytesbuf/README.md) - Types for creating and manipulating byte sequences.
- [`bytesbuf_io`](./crates/bytesbuf_io/README.md) - Asynchronous I/O abstractions expressed via `bytesbuf` types.
- [`data_privacy`](./crates/data_privacy/README.md) - Mechanisms to classify, manipulate, and redact sensitive data.
- [`data_privacy_macros`](./crates/data_privacy_macros/README.md) - Macros for the `data_privacy` crate.
- [`data_privacy_macros_impl`](./crates/data_privacy_macros_impl/README.md) - Macros for the `data_privacy` crate.
- [`fundle`](./crates/fundle/README.md) - Compile-time safe dependency injection for Rust.
- [`fundle_macros`](crates/fundle_macros/README.md) - Macros for the `fundle` crate.
- [`fundle_macros_impl`](crates/fundle_macros_impl/README.md) - Macros for the `fundle` crate.
- [`layered`](./crates/layered/README.md) - A foundational service abstraction for building composable, middleware-driven systems.
- [`ohno`](./crates/ohno/README.md) - High-quality Rust error handling.
- [`ohno_macros`](./crates/ohno_macros/README.md) - Macros for the `ohno` crate.
- [`recoverable`](./crates/recoverable/README.md) - Recovery information and classification for resilience patterns.
- [`thread_aware`](./crates/thread_aware/README.md) - Facilities to support thread-isolated state.
- [`thread_aware_macros`](./crates/thread_aware_macros/README.md) - Macros for the `thread_aware` crate.
- [`thread_aware_macros_impl`](./crates/thread_aware_macros_impl/README.md) - Macros for the `thread_aware` crate.
- [`tick`](./crates/tick/README.md) - Provides primitives to interact with and manipulate machine time.

## About this Repo
## About This Repo

The following sections explain the overall engineering process we use
in this repo.
Expand Down
70 changes: 37 additions & 33 deletions scripts/add-crate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,45 +93,49 @@ Get-ChildItem -Path $destinationDir -Recurse | ForEach-Object {
Set-Content -Path $filePath -Value $content -NoNewline
}

# Update root README.md
$readmePath = Join-Path $repoRoot "README.md"
$readmeLines = Get-Content $readmePath
$cratesList = @{}
$inCratesSection = $false
$readmeInsertionIndex = -1
$readmeEndIndex = -1

for ($i = 0; $i -lt $readmeLines.Length; $i++) {
if ($readmeLines[$i] -eq "## Crates") {
$inCratesSection = $true
continue
}
if ($inCratesSection) {
if ($readmeLines[$i] -match '^- \[`(.*)`\](.*)') {
if($readmeInsertionIndex -eq -1) {
$readmeInsertionIndex = $i
# Update root README.md (skip for macro crates)
if ($crateName -notlike "*_macros*") {
$readmePath = Join-Path $repoRoot "README.md"
$readmeLines = Get-Content $readmePath
$cratesList = @{}
$inCratesSection = $false
$readmeInsertionIndex = -1
$readmeEndIndex = -1

for ($i = 0; $i -lt $readmeLines.Length; $i++) {
if ($readmeLines[$i] -eq "## Crates") {
$inCratesSection = $true
continue
}
if ($inCratesSection) {
if ($readmeLines[$i] -match '^- \[`(.*)`\](.*)') {
if($readmeInsertionIndex -eq -1) {
$readmeInsertionIndex = $i
}
$cratesList[$Matches[1]] = $readmeLines[$i]
$readmeEndIndex = $i
} elseif ($readmeLines[$i].Trim() -ne "" -and $readmeInsertionIndex -ne -1) {
break
}
$cratesList[$Matches[1]] = $readmeLines[$i]
$readmeEndIndex = $i
} elseif ($readmeLines[$i].Trim() -ne "" -and $readmeInsertionIndex -ne -1) {
break
}
}
}

$cratesList[$crateName] = ('- [`{0}`](./crates/{0}/README.md) - {1}' -f $crateName, $crateDescription)
$sortedCrateNames = $cratesList.Keys | Sort-Object
$cratesList[$crateName] = ('- [`{0}`](./crates/{0}/README.md) - {1}' -f $crateName, $crateDescription)
$sortedCrateNames = $cratesList.Keys | Sort-Object

if ($readmeInsertionIndex -ne -1) {
$newLines = @()
foreach ($name in $sortedCrateNames) {
$newLines += $cratesList[$name]
if ($readmeInsertionIndex -ne -1) {
$newLines = @()
foreach ($name in $sortedCrateNames) {
$newLines += $cratesList[$name]
}
$pre = $readmeLines[0..($readmeInsertionIndex-1)]
$post = $readmeLines[($readmeEndIndex+1)..$readmeLines.Length]
$newReadmeContent = ($pre + $newLines + $post) -join [System.Environment]::NewLine
Set-Content -Path $readmePath -Value $newReadmeContent
Write-Host "Updated root README.md"
}
$pre = $readmeLines[0..($readmeInsertionIndex-1)]
$post = $readmeLines[($readmeEndIndex+1)..$readmeLines.Length]
$newReadmeContent = ($pre + $newLines + $post) -join [System.Environment]::NewLine
Set-Content -Path $readmePath -Value $newReadmeContent
Write-Host "Updated root README.md"
} else {
Write-Host "Skipping README.md update for macro crate"
}


Expand Down
Loading