Skip to content

Instantly share code, notes, and snippets.

@ewieberappc
Last active December 5, 2017 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewieberappc/9af26a81b57bfabe3c3f to your computer and use it in GitHub Desktop.
Save ewieberappc/9af26a81b57bfabe3c3f to your computer and use it in GitHub Desktop.
Clean your system of the Appcelerator and/or Titanium environment
if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo -e '\n Usage: '$'\e[36m''soap [options]'$'\e[0m''\n\n Cleans your system of the Appcelerator/Titanium environment, prompting to confirm removal of each component\n\n Options:\n\n\t-f, --force\t'$'\e[36m''Cleans all parts of the Appcelerator/Titanium environment, without prompting for confirmation'$'\e[0m''\n\t-h, --help\t'$'\e[36m''Output usage information\n'$'\e[0m'; exit; fi; sudo echo; WD=$(pwd); cd; FORCE=false; if [[ "$1" == "-f" ]] || [[ "$1" == "--force" ]]; then FORCE=true; fi; if [ -e /Applications/Appcelerator\ Studio/configuration/config.ini ]; then ALOC="$(sed -n 's/.*osgi.instance.area.default=\(.*\)/\1/1p' /Applications/Appcelerator\ Studio/configuration/config.ini )"; ALOC=${ALOC/@user.home/~}; if $FORCE; then sudo rm -rf $ALOC; echo -e $'\e[32m''\tAppcelerator Workspace removed'$'\e[0m'; else read -p $'\e[32m''?'$'\e[0m'' Remove Appcelerator workspace: '$'\e[36m'$ALOC$'\e[0m'' ? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tAppcelerator Workspace not removed\n'$'\e[0m'; else sudo rm -rf $ALOC; echo -e $'\e[32m''\tAppcelerator Workspace removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tAppcelerator Workspace not found'$'\e[0m'; fi; if [ -e /Applications/Titanium\ Studio/configuration/config.ini ]; then TLOC="$(sed -n 's/.*osgi.instance.area.default=\(.*\)/\1/1p' /Applications/Titanium\ Studio/configuration/config.ini )"; TLOC=${TLOC/@user.home/~}; if $FORCE; then sudo rm -rf $TLOC; echo -e $'\e[32m''\tTitanium Workspace removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Titanium workspace: '$'\e[36m'$TLOC$'\e[0m'' ? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tTitanium Workspace not removed\n'$'\e[0m'; else sudo rm -rf $TLOC; echo -e $'\e[32m''\tTitanium Workspace removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tTitanium Workspace not found'$'\e[0m'; fi; Remove=''; if [ -e /Applications/Appcelerator\ Studio ]; then Remove='sudo rm -rf /Applications/Appcelerator\ Studio /usr/local/bin/titanium-code-processor /usr/local/lib/node_modules/titanium-code-processor;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tAppcelerator Studio removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Appcelerator Studio? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tAppcelerator Studio not removed\n'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tAppcelerator Studio removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tAppcelerator Studio not found'$'\e[0m'; fi; if [ -e /Applications/Titanium\ Studio ]; then Remove='sudo rm -rf /Applications/Titanium\ Studio /usr/local/bin/titanium-code-processor /usr/local/lib/node_modules/titanium-code-processor;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tTitanium Studio removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Titanium Studio? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tTitanium Studio not removed\n'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tTitanium Studio removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tTitanium Studio not found'$'\e[0m'; fi; if [ -e /usr/local/bin/appcelerator ]; then Remove='sudo npm uninstall -g appcelerator; sudo rm -rf ~/.appcelerator;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tAppcelerator CLI removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Appcelerator CLI? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tAppcelerator CLI not removed\n'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tAppcelerator CLI removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tAppcelerator CLI not found'$'\e[0m'; fi; if [ -e /usr/local/bin/titanium ]; then Remove='sudo rm -rf ~/.titanium /usr/local/bin/titanium /usr/local/bin/ti /usr/local/lib/node_modules/titanium;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tTitanium CLI removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Titanium CLI? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tTitanium CLI not removed\n'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tTitanium CLI removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tTitanium CLI not found'$'\e[0m'; fi; if [ -e ~/Library/Application\ Support/Titanium ]; then Remove='sudo rm -rf ~/Library/Application\ Support/Titanium;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tTitanium SDK removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Titanium SDK? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tTitanium SDK not removed\n'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tTitanium SDK removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tTitanium SDK not found'$'\e[0m'; fi; if [ -e /usr/local/bin/alloy ]; then Remove='sudo rm -rf /usr/local/bin/alloy /usr/local/lib/node_modules/alloy;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tGlobal Alloy removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Global Alloy? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tGlobal Alloy not removed\n'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tGlobal Alloy removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tGlobal Alloy not found'$'\e[0m'; fi; if [ -e /usr/local/bin/acs ]; then Remove='sudo rm -rf /usr/local/bin/acs /usr/local/bin/acs-debug ~/.acs /usr/local/lib/node_modules/acs;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tGlobal ACS removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove Global ACS? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tGlobal ACS not removed\n'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tGlobal ACS removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tGlobal ACS not found'$'\e[0m'; fi; if [ -e /usr/local/bin/node ]; then Remove='sudo rm -rf ~/.npm ~/.node-gyp ~/.npm /usr/local/include/node /usr/local/lib/node_modules /usr/local/bin/node /usr/local/bin/npm;'; if $FORCE; then eval "$( echo $Remove )"; echo -e $'\e[32m''\tNode removed'$'\e[0m'; else echo; read -p $'\e[32m''?'$'\e[0m'' Remove node? (y/N) ' -r; if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo -e $'\e[31m''\tNode not removed'$'\e[0m'; else eval "$( echo $Remove )"; echo -e $'\e[32m''\tNode removed\n'$'\e[0m'; fi; fi; else echo -e $'\e[33m''\tNode not found'$'\e[0m'; fi; echo; cd $WD 2>/dev/null || echo -e 'Working directory removed. Now in '$'\e[36m'$(pwd)$'\e[0m''\n';
USAGE:
$ soap - Cleans your system of the Appcelerator/Titanium environment, prompting to confirm removal of each component
$ soap --force - Cleans all parts of the Appcelerator/Titanium environment, without prompting for confirmation
$ soap -f - Same as above
INSTALLATION:
1. Download the executable file to a folder (recommended '~/bin')
2. Add the path to the folder to your PATH in your .bash_profile (export PATH=$PATH:~/bin)
3. Restart your terminal or run '. ~/.bash_profile'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment