- Commit
- 18ae8e74e90aef70f33e5afa2f8193297a38828c
- Parent
- 9adc7abcae52ce57ca0c3148b1c453dd5c782e4a
- Author
- Pablo <pablo-pie@riseup.net>
- Date
Merged build-man-page
Yet another static site generator for Git 🙀️
Merged build-man-page
5 files changed, 109 insertions, 78 deletions
Status | Name | Changes | Insertions | Deletions |
Modified | .gitignore | 2 files changed | 2 | 0 |
Modified | Cargo.toml | 2 files changed | 4 | 0 |
Added | build.rs | 1 file changed | 25 | 0 |
Added | src/yagit.1 | 1 file changed | 78 | 0 |
Deleted | yagit.1 | 1 file changed | 0 | 78 |
diff --git a/.gitignore b/.gitignore @@ -2,6 +2,8 @@ /test Cargo.lock +yagit.1 + /profiling perf.data perf.data.old
diff --git a/Cargo.toml b/Cargo.toml @@ -3,6 +3,7 @@ name = "yagit" version = "0.1.0" edition = "2021" description = "Yet another static site generator for Git" +build = "build.rs" [dependencies] git2 = "0.20.0" @@ -10,5 +11,8 @@ libc = "0.2.170" pulldown-cmark = { version = "0.13.0", features = ["simd"] } static-toml = "1.3.0" +[build-dependencies] +static-toml = "1.3.0" + [profile.release] debug = true
diff --git /dev/null b/build.rs @@ -0,0 +1,25 @@ +use std::{fs::File, io::Write}; + +static_toml::static_toml! { + static CONFIG = include_toml!("config.toml"); +} + +const STORE_PATH: &str = CONFIG.git.release.store_path; +const PRIVATE_STORE_PATH: &str = CONFIG.git.release.private_store_path; +const OUTPUT_PATH: &str = CONFIG.output.release.path; +const PRIVATE_OUTPUT_ROOT: &str = CONFIG.output.private_output_root; + +const MAN_SRC: &str = include_str!("src/yagit.1"); + +fn main() { + let man_src = MAN_SRC + .replace("PRIVATE_STORE_PATH", PRIVATE_STORE_PATH) + .replace("STORE_PATH", STORE_PATH) + .replace("OUTPUT_PATH", OUTPUT_PATH) + .replace("PRIVATE_OUTPUT_ROOT", PRIVATE_OUTPUT_ROOT); + + let mut man_page = File::create("yagit.1") + .expect("Could not create \"yagit.1\""); + + write!(&mut man_page, "{}", man_src).expect("Could not write to \"yagit.1\""); +}
diff --git /dev/null b/src/yagit.1 @@ -0,0 +1,78 @@ +.Dd April 2, 2025 +.Dt yagit 1 +.Au Pablo +.Sh NAME +.Nm yagit +.Nd Yet another static site generator for Git +.Sh SYNOPSIS +.Nm +.Op Fl \-\-private +.Op Fl \-\-full\-build +render-batch +.Nm +.Op Fl \-\-private +.Op Fl \-\-full\-build +render +.Ar repo-name +.Nm +.Op Fl \-\-private +\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ init\ \ +.Ar repo-name +.Nm +.Op Fl \-\-private +\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ delete +.Ar repo-name +.Sh DESCRIPTION +.Nm +maintains a store of Git repositories at +.Ar STORE_PATH +and renders HTML pages for such repositories at the location +.Ar OUTPUT_PATH. + +By default, +.Nm +renders HTML pages in incremental mode: pages for Git +commits and blobs are only renderer if the relevant commits are newer than the +page's last modification date. This option can be disabled with the +.Fl --full-build +flag. + +.Nm +also maintains a store of Git repositories at +.Ar PRIVATE_STORE_PATH, +which can be switched on using the +.Fl --private +flag. The HTML pages for repositories at +.Ar PRIVATE_STORE_PATH +are rendered at +.Ar OUTPUT_PATH/PRIVATE_OUTPUT_ROOT +.Sh COMMANDS +.Bl -tag -width Ds +.It \fBrender\-batch\fR +Renders the HTML pages for all repositories at +.Ar STORE_PATH +and updates the index page +.It \fBrender\fR Ar repo\-name +Renders the HTML pages for a repository at +.Ar STORE_PATH/repo\-name +and updates the index page +.It \fBinit\fR Ar repo\-name Ar description +Initializes and configures a Git repo at +.Ar STORE_PATH/repo\-name +.It \fBdelete\fR Ar repo\-name +Deletes the Git repository at +.Ar STORE_PATH/repo\-name +and re-renders the global repository index +.El +.Sh FLAGS +.Bl -tag -width Ds +.It Fl --full-build +Disables incremental builds (re\-renders all HTML pages) +.It Fl --private +Use the +.Ar PRIVATE_STORE_PATH +store instead of +.Ar STORE_PATH +.El +.Sh AUTHORS +.An Pablo Aq Mt pablo-pie@riseup.net
diff --git a/yagit.1 /dev/null @@ -1,78 +0,0 @@ -.Dd April 2, 2025 -.Dt yagit 1 -.Au Pablo -.Sh NAME -.Nm yagit -.Nd Yet another static site generator for Git -.Sh SYNOPSIS -.Nm -.Op Fl \-\-private -.Op Fl \-\-full\-build -render-batch -.Nm -.Op Fl \-\-private -.Op Fl \-\-full\-build -render -.Ar repo-name -.Nm -.Op Fl \-\-private -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ init\ \ -.Ar repo-name -.Nm -.Op Fl \-\-private -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ delete -.Ar repo-name -.Sh DESCRIPTION -.Nm -maintains a store of Git repositories at -.Ar REPOS_DIR/ -and renders HTML pages for such repositories at the location -.Ar OUTPUT_DIR/. - -By default, -.Nm -renders HTML pages in incremental mode: pages for Git -commits and blobs are only renderer if the relevant commits are newer than the -page's last modification date. This option can be disabled with the -.Fl --full-build -flag. - -.Nm -also maintains a store of Git repositories at -.Ar PRIVATE_REPOS_DIR/, -which can be switched on using the -.Fl --private -flag. The HTML pages for repositories at -.Ar PRIVATE_REPOS_DIR/ -are rendered at -.Ar OUTPUT_PATH/PRIVATE_OUTPUT_ROOT/ -.Sh COMMANDS -.Bl -tag -width Ds -.It \fBrender\-batch\fR -Renders the HTML pages for all repositories at -.Ar REPOS_DIR/ -and updates the index page -.It \fBrender\fR Ar repo\-name -Renders the HTML pages for a repository at -.Ar REPOS_DIR/repo\-name -and updates the index page -.It \fBinit\fR Ar repo\-name Ar description -Initializes and configures a Git repo at -.Ar REPOS_DIR/repo\-name -.It \fBdelete\fR Ar repo\-name -Deletes the Git repository at -.Ar REPOS_DIR/repo\-name -and re-renders the global repository index -.El -.Sh FLAGS -.Bl -tag -width Ds -.It Fl --full-build -Disables incremental builds (re\-renders all HTML pages) -.It Fl --private -Use the -.Ar PRIVATE_REPOS_DIR/ -store instead of -.Ar REPOS_DIR/ -.El -.Sh AUTHORS -.An Pablo Aq Mt pablo-pie@riseup.net