Skip to content

Instantly share code, notes, and snippets.

@JamieAP
Created January 16, 2019 19:49
Show Gist options
  • Save JamieAP/fd9555d4eef7e78ca907d180a1b9868c to your computer and use it in GitHub Desktop.
Save JamieAP/fd9555d4eef7e78ca907d180a1b9868c to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
###
# In order to free up some space by removing unused languages from Semaphore environment
# Add the line below to your setup command in Project Settings
#
# wget https://gist.githubusercontent.com/mimimalizam/e3fd7084f88384f4b2dfca035e3da2d4/raw/remove_unused_languages.sh && bash remove_unused_languages.sh
#
# These commands will:
# remove all the Ruby, Node.js, PHP versions except the default
# alternatively you can add following commands to the setup of your build
find ~/.rbenv/versions -maxdepth 1 -type d | grep -v "$(rbenv version | awk '{print $1}')" | tail -n +2 | xargs rm -rf
find ~/.nvm/versions/node -maxdepth 1 -type d | grep -v "$(node -v)" | tail -n +2 | xargs rm -rf
find ~/.phpbrew/php -maxdepth 1 -type d | grep -v "$(php -v | cut -d ' ' -f2 | head -n1)" | tail -n +2 | xargs rm -rf
echo "-------------------------------------------------------"
echo "Removed unused languages from the Semaphore environment"
echo "-------------------------------------------------------"
df -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment