Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Titanium build server
use strict;
use warnings;
use AnyEvent;
use AnyEvent::HTTPD;
use AnyEvent::Util qw(run_cmd);
use Cwd;
my $httpd = AnyEvent::HTTPD->new (port => 9090);
my $last_pid = undef;
my $last_cv = undef;
$httpd->reg_cb (
'/run' => sub {
my ($httpd, $req) = @_;
if ($last_pid) {
kill 2, $last_pid;
my $pid;
$last_cv = run_cmd [
"/Library/Application Support/Titanium/mobilesdk/osx/1.4.2/iphone/",
], '$$' => \$pid;
$last_pid = $pid;
if ($req->parm('debug')) {
system('osascript', '-e', "tell application \"iTerm\"", '-e', "activate", '-e', "end tell");
$req->respond ({ content => ['text/plain', "ok" ]});
warn 'starting server at localhost:9090';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment