Created
November 2, 2011 05:05
-
-
Save alterakey/1332909 to your computer and use it in GitHub Desktop.
Loopy ant launcher
This file contains hidden or 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
#!/usr/bin/python | |
# -*- mode: python -*- | |
# Usage: | |
# $ run-test-ant test-unit-quick u:test-unit-quick U:test-unit-clean i:test-integ-quick I:test-integ-clean a:test-accept-quick A:test-accept-clean l:'debug install run' L:'clean debug uninstall install run' | |
# | |
import os | |
import sys | |
# http://stackoverflow.com/questions/1394956/how-to-do-hit-any-key-in-python | |
try: | |
# Win32 | |
from msvcrt import getch | |
except ImportError: | |
# UNIX | |
def getch(): | |
import sys, tty, termios | |
fd = sys.stdin.fileno() | |
old = termios.tcgetattr(fd) | |
try: | |
tty.setraw(fd) | |
ch = sys.stdin.read(1) | |
if ch == "\003": | |
raise KeyboardInterrupt | |
return ch | |
finally: | |
termios.tcsetattr(fd, termios.TCSADRAIN, old) | |
targets = dict() | |
for desc in sys.argv[1:]: | |
if ':' not in desc: | |
targets["(default)"] = desc | |
else: | |
key, target = desc.split(':') | |
targets[key] = target | |
target_keys = sorted(targets.keys()) | |
while True: | |
print 'Enter target (? to help):' | |
char = getch() | |
if char == "": | |
break | |
if char == "\014": | |
os.system('clear') | |
continue | |
if char == "\015": | |
char = "(default)" | |
if char == "?" or char not in target_keys: | |
for k in target_keys: | |
print "%s: %s" % (k, targets[k]) | |
continue | |
try: | |
os.system('clear') | |
target = targets[char] | |
print ">>> %s" % target | |
os.system('ant "%s"' % target) | |
finally: | |
os.system('killall "Flash Player Debugger" >/dev/null 2>&1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment