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.
# Clone and buildgit clone https://github.com/DocSpring/renamifycd renamifycargo 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 gonerm -rf target
# Run the full test suite using the new namecargo test
# Build the "awesome_file_renaming_tool" binarycargo 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 namerm -rf targetcargo testcargo build./target/debug/renamify --help
# Everything is completely restored. No changes to any files after the round-tripgit 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:
scripts/e2e-test.sh View the script we use in our GitHub Actions workflow