Skip to content

Self-Hosting Demo

In computer programming, self-hosting is the use of a program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code.

Watch Renamify rename itself to awesome_file_renaming_tool, then use the new binary to rename itself back again.

Terminal window
# Clone and build
git clone https://github.com/DocSpring/renamify
cd renamify
cargo build
# Use renamify to rename itself to awesome_file_renaming_tool
./target/debug/renamify rename renamify awesome_file_renaming_tool --preview table --yes
# Make sure the old compiled binary is gone
rm -rf target
# Run the full test suite using the new name
cargo test
# Build the "awesome_file_renaming_tool" binary
cargo build
# Use the new binary to rename itself back to renamify
./target/debug/awesome_file_renaming_tool rename awesome_file_renaming_tool renamify --preview table --yes
# Back to the original name
rm -rf target
cargo test
cargo build
./target/debug/renamify --help
# Everything is completely restored. No changes to any files after the round-trip
git status
# On branch main
# Your branch is up to date with 'origin/main'.
# nothing to commit, working tree clean


P.S. We run all these steps on CI as an end-to-end integration test: