#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, shutil

# Fix the bloated every build ever bug in Organizer, other cleanup.

def main():
	if raw_input("Remove previous builds from organizer? y/n ") != 'y' :
		return
		 
	for toremove in ['Archives', 'DerivedData', 'Products']:
		target = os.path.join( os.path.expanduser('~/Library/Developer/Xcode'), toremove )
		print target
		shutil.rmtree( target )
	
	os.system( 'rm /tmp/spaceship*.log' )
	#os.system( 'sudo gem cleanup' )
	return 0

if __name__ == '__main__':
	main()
