9f4a0dc446f6f840da097174909d799cd6f78bf4
Fix set_local_db/set_dot_env unconditionally stripping (then forcing) the file's trailing newline: they now detect whether the source file originally ended in a newline and reproduce that on write, verified against both the newline and no-newline cases. Replace the reverse-toggle computation for connections.env on `down` with a straight `git checkout`, so the file always ends up byte-for-byte identical to HEAD instead of relying on toggle logic to get it exactly right. Both git call sites now go through a shared helper that checks the process exit status and errors out instead of silently reporting success on a failed checkout/update-index, with test coverage against real temporary git repos.
dev_tools
CLI tool to start and stop a local RCC test environment. It manages a Docker Compose service and toggles environment variable files between local and CI database configurations.
Prerequisites
- Rust toolchain (stable)
- Docker with Compose plugin
Configuration
The tool reads from a dotenv-style file at ~/.config/rcc/dev. The following variables are required:
| Variable | Description |
|---|---|
DOCKER_SERVICE |
Name of the Docker container to check if it is running |
DOCKER_DIR |
Path to the Docker Compose directory, relative to $HOME |
<PROJECT>_DIR |
Absolute path to the project directory (one per project, e.g. FOO_DIR) |
Example ~/.config/rcc/dev:
DOCKER_SERVICE=my-container
DOCKER_DIR=repos/docker/local
FOO_DIR=/home/user/repos/foo
Build & Install
cargo build --release
# or install directly into ~/.cargo/bin
cargo install --path .
Usage
dev_tools <project> <up|down>
| Argument | Description |
|---|---|
project |
Project key (matches <PROJECT>_DIR in the config, case-insensitive) |
up / down |
Start or stop the environment |
Examples
# Start the environment for project "foo"
dev_tools foo up
# Stop it
dev_tools foo down
What it does
- Starts or stops the Docker Compose service defined by
DOCKER_SERVICE/DOCKER_DIR. conf/global/connections.env:uptoggles it to the CI credentials and marks itgit update-index --assume-unchangedto avoid accidental commits;downunmarks it and restores it to its committed state withgit checkout(rather than computing the reverse toggle), so it's guaranteed byte-for-byte identical to HEAD.- Toggles database connection entries in
<PROJECT_DIR>/conf/local/.env:upswitches the connection toci,downswitches it tostaging.
Tests
cargo test
Languages
Rust
100%