Created
August 28, 2021 20:53
-
-
Save robbyrussell/a518acb2a1e810a8d78fa39bb0500d45 to your computer and use it in GitHub Desktop.
Planet Argon - Tidy up your Rails development/test.log files and brew cleanup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A little shell script to help you reclaim disk space by doing the | |
# following things on your Mac OS development machine. | |
# * Empty all of your local development.log files | |
# * Empty all of your local test.log files | |
# * Removes unused Homebrew packages | |
# Install: | |
# * Save this to ~/bin/argonista-disk-space-reclaimer.sh | |
# * Run % chmod +x ~/bin/argonista-disk-space-reclaimer.sh | |
# Usage: | |
# Within a directory where all of your apps are nested, run: | |
# % cd ~/projects | |
# % ~/bin/argonista-disk-space-reclaimer.sh | |
echo "\n== 🔬 Tracking down all of your local dev/test log files ==" | |
LOGFILES=`find . -type f -name 'development.log' -o -name 'test.log'` | |
for logfile in $LOGFILES; do | |
du -kh $logfile; | |
done | |
echo "\n\n== 🧹 Sweeping up your local dev/test log files ==" | |
for logfile in $LOGFILES; do | |
cat /dev/null > $logfile; | |
echo "✅ Cleaned: $logfile" | |
done | |
echo "\n\n== 🍺 Running Homebrew's cleanup tool on unused packages ==" | |
brew cleanup | |
echo "\n\n== 🎈 ...and now our machine is floating, again ==\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment