Skip to main content

rtb_forge/
lib.rs

1//! Release-provider abstractions and git operations for the
2//! phpboyscout Rust toolkit.
3//!
4//! Formerly `rtb-vcs` in the
5//! [rust-tool-base](https://gitlab.com/phpboyscout/rust-tool-base)
6//! monorepo — renamed to `rtb-forge` at extraction for name
7//! convergence with the GTB family. Only the crate identity changed:
8//! types, modules, Cargo features, and the `RTB_VCS_GIT_TOKEN` auth
9//! environment variable are exactly those of `rtb-vcs` 0.7.0.
10//!
11//! # What this crate is
12//!
13//! Two independent slices:
14//!
15//! - **Release providers.** A narrow, read-only abstraction over
16//!   release-source APIs. Tool authors pick one of six backends —
17//!   GitHub, GitLab, Bitbucket, Gitea, Codeberg, or Direct (bare HTTPS
18//!   URL) — and `rtb-update` consumes the trait to list, fetch, and
19//!   download release artefacts. Each backend is behind its own Cargo
20//!   feature, all default-on.
21//! - **Git operations.** The `git` module's `Repo` type: init, open,
22//!   clone, fetch, status, commit, checkout, walk, diff, blame and
23//!   push. Behind the default-on `git` feature.
24//!
25//! # What this crate is not
26//!
27//! - **Not a release writer.** `ReleaseProvider` has four methods, all
28//!   of them read-only. Creating releases, uploading assets, and
29//!   editing tags are deliberately out of scope.
30//! - **Not a general git library.** `Repo` covers the operations above
31//!   and stops: no branch, merge, rebase, stash, tag or remote
32//!   management.
33//! - **Not a caching layer.** Every call hits the wire. Downstream
34//!   tools add HTTP caching via `reqwest::ClientBuilder::middleware`
35//!   if they need it.
36
37// `deny`, not `forbid`: `linkme`'s `#[distributed_slice]` emits
38// `#[link_section]`, which Rust 1.95+ reports under `unsafe_code`, and
39// only `deny` lets each registration module carry a local
40// `#![allow(unsafe_code)]`. Any rtb-* crate with a `linkme` site makes
41// the same trade. No hand-written `unsafe` block exists in this crate.
42#![deny(unsafe_code)]
43
44pub mod config;
45pub mod release;
46
47// v0.5 git-operations slice — entire module gated on the `git` feature.
48// See spec 0023: https://gitlab.com/phpboyscout/rust-tool-base/-/wikis/specs/0023-v0.5-scope
49#[cfg(feature = "git")]
50pub mod git;
51
52// Shared HTTP helpers for the REST-API backends. `pub(crate)` —
53// downstream custom backends roll their own.
54#[cfg(feature = "_http")]
55pub(crate) mod http;
56
57#[cfg(feature = "bitbucket")]
58pub mod bitbucket;
59#[cfg(feature = "codeberg")]
60pub mod codeberg;
61#[cfg(feature = "direct")]
62pub mod direct;
63#[cfg(feature = "gitea")]
64pub mod gitea;
65#[cfg(feature = "github")]
66pub mod github;
67#[cfg(feature = "gitlab")]
68pub mod gitlab;
69
70pub use config::{
71    BitbucketParams, CodebergParams, DirectParams, GiteaParams, GithubParams, GitlabParams,
72    ReleaseSourceConfig,
73};
74pub use release::{
75    lookup, registered_types, ProviderError, ProviderFactory, ProviderRegistration,
76    RegisteredProvider, Release, ReleaseAsset, ReleaseProvider, RELEASE_PROVIDERS,
77};