Skip to content

Commit

Permalink
fix(ssg): ✅ add new unit tests and bench tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed Dec 27, 2024
1 parent a4b93bc commit ad36a2e
Show file tree
Hide file tree
Showing 7 changed files with 661 additions and 566 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ path = "src/main.rs" # Path to the binary entry point
# -----------------------------------------------------------------------------
[features]
# Optional features that can be enabled or disabled.
default = ["async", "tokio"] # No default features enabled
async = ["tokio"] # This enables tokio when the async feature is enabled
default = ["async", "tokio"] # No default features enabled
async = ["tokio"] # This enables tokio when the async feature is enabled
cli = [] # Enable command-line interface support
benchmark = [] # Enable benchmark-specific functionality

# -----------------------------------------------------------------------------
# Build Dependencies
Expand All @@ -103,6 +104,7 @@ criterion = "0.5.1" # Benchmarking library to test perform
# Required dependencies for building and running the project.
anyhow = "1.0.95"
clap = { version = "4.5.23", features = ["derive", "cargo", "env"] }
colored = "2.2.0"
dtt = "0.0.8"
env_logger = "0.11.6"
http-handle = "0.0.2"
Expand Down
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// Define paths to existing directories
let build_dir = Path::new("./examples/build"); // For temporary build files
let content_dir = Path::new("./examples/content"); // Your markdown content
let public_dir = Path::new("./examples/public"); // Generated site output
let public_dir = Path::new("./examples/public"); // Generated site output
let template_dir = Path::new("./examples/templates"); // HTML templates

// Generate the static site
Expand All @@ -84,8 +84,7 @@ fn main() -> Result<(), Box<dyn Error>> {
Create a new site with the following command:

```bash
ssg --new=docs \
--content=content \
ssg --content=content \
--template=templates \
--output=output \
--serve=public
Expand All @@ -94,14 +93,17 @@ ssg --new=docs \
Or use the shorter form:

```bash
ssg -n=docs -c=content -t=templates -o=output -s=public
ssg -c=content -t=templates -o=output -s=public
```

```bash
cargo run --bin ssg -- -c="./examples/content" -t="./examples/templates" -o="./examples/output" -s="./examples/public"
```

### CLI Options

| Option | Short | Description | Required |
|--------|-------|-------------|----------|
| `--new` | `-n` | Project directory name | Yes |
| `--content` | `-c` | Content directory path | Yes |
| `--template` | `-t` | Template directory path | Yes |
| `--output` | `-o` | Output directory path | Yes |
Expand All @@ -115,10 +117,28 @@ For comprehensive API documentation, visit [docs.rs/crate/ssg/](https://docs.rs/

Explore example implementations:

- Basic Example

```shell
git clone https://github.com/sebastienrousseau/shokunin.git
cd shokunin
cargo run --example basic
```

- Quick Start Example

```shell
git clone https://github.com/sebastienrousseau/shokunin.git
cd shokunin
cargo run --example quickstart
```

- Multilingual Example

```shell
git clone https://github.com/sebastienrousseau/shokunin.git
cd shokunin
cargo run --example basic_site
cargo run --example multilingual
```

## Contributing
Expand Down
Loading

0 comments on commit ad36a2e

Please sign in to comment.