Added features
Added: Project Overview TUI Build Cache / Dirty Detection Post-Build Hooks gbuild status
This commit is contained in:
@@ -1,79 +1,75 @@
|
||||
# gbuild
|
||||
# gbuild
|
||||
|
||||
A C rewrite of the original [gbuild](https://spdlab.hu/gbuild) bash tool.
|
||||
Clone, pull, pick a target, build — all from one command.
|
||||
gbuild started as a bash script to stop me from typing the same git-clone,
|
||||
cd, make sequence over and over. It's since been rewritten in C and grown a
|
||||
few useful features — but the idea is still the same: one command to get
|
||||
the latest code and build it.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
## What it does
|
||||
|
||||
- **Clone or pull** — automatically clones a fresh repo on first run; pulls on subsequent runs
|
||||
- **Interactive target picker** — reads your `Makefile` and presents an ncurses TUI to select the build target; pass `--target` to skip it
|
||||
- **Timestamped log files** — every run writes a log to `~/.local/log/gbuild/` named `<timestamp>_<project>.log`
|
||||
- **Log browser** — built-in two-pane TUI: file list on the left, live preview on the right; open in `less`, delete, or quit
|
||||
- **Configurable** — reads `~/.gconfig`; override with `--url` and `--user` at runtime
|
||||
- **`gconfig` companion** — manages `~/.gconfig` with `init`, `show`, and `help` commands
|
||||
Run `gbuild` with no arguments and you get a project overview — every repo
|
||||
you've built before, when you last built it, whether it passed or failed,
|
||||
and the HEAD hash it was on. Pick one with J/K and hit Enter.
|
||||
|
||||
Run `gbuild myproject` to go straight to a specific project. If it hasn't
|
||||
been cloned yet, gbuild clones it first. If it has, it pulls. Then it reads
|
||||
your Makefile, shows you the targets, and you pick one. Pass `--target` if
|
||||
you already know what you want and don't need the picker.
|
||||
|
||||
Every build gets logged to `~/.local/log/gbuild/`. Run `gbuild --logs` to
|
||||
browse them — file list on the left, preview on the right, open anything in
|
||||
`less` if you need the full output.
|
||||
|
||||
Configuration lives in `~/.gconfig`. Run `gconfig init` to create one, then
|
||||
edit it with your git server URL and credentials. Token and password auth are
|
||||
both supported.
|
||||
|
||||
---
|
||||
|
||||
## Dependencies
|
||||
|
||||
| Library | Purpose |
|
||||
|----------|------------------------------|
|
||||
| ncurses | TUI for picker & log browser |
|
||||
| git | Clone / pull |
|
||||
| make | Build projects |
|
||||
| less | Open logs from browser |
|
||||
You'll need `gcc`, `make`, `git`, `less`, and the ncurses development headers.
|
||||
Most systems have everything except the ncurses headers — the package is
|
||||
usually called `libncurses-dev`, `ncurses-devel`, or just `ncurses` depending
|
||||
on your distribution.
|
||||
|
||||
---
|
||||
|
||||
## Build
|
||||
|
||||
### Linux
|
||||
## Building
|
||||
|
||||
```sh
|
||||
# Install these packages with your package manager
|
||||
libncurses-dev make
|
||||
|
||||
# Clone this repository
|
||||
git clone https://github.com/jokerz/gbuild.git
|
||||
|
||||
# Build both binaries into bin/
|
||||
make
|
||||
|
||||
# Optionally install system-wide
|
||||
sudo make install
|
||||
```
|
||||
|
||||
That puts `gbuild` and `gconfig` in `/usr/local/bin`. If you want them
|
||||
somewhere else, `sudo make install PREFIX=/your/path`.
|
||||
|
||||
There's also `make release` which produces a source tarball, a stripped
|
||||
binary tarball, a `.deb`, and an `.rpm` all in one go under `dist/`.
|
||||
|
||||
---
|
||||
|
||||
## Quick setup
|
||||
## Setup
|
||||
|
||||
```sh
|
||||
# 1. Initialise ~/.gconfig with defaults
|
||||
gconfig init
|
||||
|
||||
# 2. Fill in your values
|
||||
$EDITOR ~/.gconfig
|
||||
|
||||
# 3. Verify
|
||||
gconfig show
|
||||
|
||||
# 4. Build a project
|
||||
gbuild myproject
|
||||
gconfig init # creates ~/.gconfig with defaults
|
||||
$EDITOR ~/.gconfig # fill in your server URL and credentials
|
||||
gconfig show # check it looks right
|
||||
gbuild # open the overview and pick something to build
|
||||
```
|
||||
|
||||
### `~/.gconfig` format
|
||||
Your `~/.gconfig` looks like this:
|
||||
|
||||
```ini
|
||||
# ~/.gconfig — managed by gconfig
|
||||
|
||||
[git]
|
||||
GIT_URL = http://localhost:3000
|
||||
GIT_USER = Username
|
||||
GIT_USER = myuser
|
||||
|
||||
[auth]
|
||||
# Use token-based OR password-based auth; leave the other blank
|
||||
# token or password, leave the other blank
|
||||
GIT_TOKEN =
|
||||
GIT_PASSWORD =
|
||||
|
||||
@@ -89,70 +85,50 @@ LOG_DIR = ~/.local/log/gbuild
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
gbuild [options] <project>
|
||||
gbuild --logs
|
||||
|
||||
Options:
|
||||
--url <url> Override Git base URL (default: ~/.gconfig)
|
||||
--user <name> Override Git username (default: ~/.gconfig)
|
||||
--target <tgt> Run target directly, skip interactive picker
|
||||
--logs Open the interactive log browser
|
||||
-h, --help Print this help and exit
|
||||
gbuild open the project overview
|
||||
gbuild <project> clone/pull and build
|
||||
gbuild --target <t> <p> skip the picker, run target t
|
||||
gbuild --logs open the log browser
|
||||
gbuild --no-tui print usage (useful in scripts)
|
||||
gbuild --url --user [username] [projectname] one-off config override
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
# Build with defaults
|
||||
gbuild myproject
|
||||
|
||||
# Skip the target picker
|
||||
gbuild --target clean myproject
|
||||
|
||||
# Different server and user for this run
|
||||
gbuild --url http://10.0.0.5:3000 --user alice myproject
|
||||
|
||||
# Browse past build logs
|
||||
gbuild --logs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `gconfig` commands
|
||||
|
||||
| Command | Description |
|
||||
|---------------------|-------------------------------------------------------------|
|
||||
| `gconfig init` | Create `~/.gconfig` with defaults (skips if already exists) |
|
||||
| `gconfig init --force` | Overwrite; backs up old file as `~/.gconfig.bak.<ts>` |
|
||||
| `gconfig show` | Print current config (auth fields masked) |
|
||||
| `gconfig help` | Print usage |
|
||||
|
||||
## gconfig
|
||||
```
|
||||
gconfig init create ~/.gconfig (won't overwrite)
|
||||
gconfig init --force overwrite, backs up the old file first
|
||||
gconfig show print config, masks auth fields
|
||||
gconfig help
|
||||
```
|
||||
---
|
||||
|
||||
## Project layout
|
||||
|
||||
```
|
||||
gbuild/
|
||||
├── Makefile
|
||||
├── README.md
|
||||
├── include/
|
||||
│ ├── config.h — GConfig struct, INI load/save/init/show
|
||||
│ ├── git_ops.h — clone / pull
|
||||
│ ├── logger.h — timestamped coloured logging
|
||||
│ ├── make_ops.h — Makefile target parser + build runner
|
||||
│ └── tui.h — ncurses target picker + log browser
|
||||
│ ├── config.h ~/.gconfig read/write
|
||||
│ ├── git_ops.h clone, pull, HEAD hash
|
||||
│ ├── index.h ~/.gbuild_index — persistent build history
|
||||
│ ├── logger.h terminal output + log files
|
||||
│ ├── make_ops.h Makefile parser and build runner
|
||||
│ └── tui.h all three ncurses screens
|
||||
├── pkg/
|
||||
│ ├── deb/ .deb package templates
|
||||
│ └── rpm/ .rpm spec template
|
||||
└── src/
|
||||
├── config.c
|
||||
├── gbuild.c — gbuild main()
|
||||
├── gconfig.c — gconfig main()
|
||||
├── git_ops.c
|
||||
├── logger.c
|
||||
├── make_ops.c
|
||||
└── tui.c
|
||||
├── gbuild.c
|
||||
├── gconfig.c
|
||||
├── config.c
|
||||
├── git_ops.c
|
||||
├── index.c
|
||||
├── logger.c
|
||||
├── make_ops.c
|
||||
└── tui.c
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
MIT License — maintained by jokerz / spdlab.hu
|
||||
MIT Copyright (c) Schmidt Peter Daniel 2026
|
||||
|
||||
Reference in New Issue
Block a user