blob: 78faf962d6f0dfd0a8314f562375e1cf0515388f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/usr/bin/env ruby
require 'rubygems'
require 'appscript'
include Appscript
SRCDIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
DELAY = 1
BASE_CMD = case ARGV[0]
when "features"
"cd #{SRCDIR} && rake dev:features:start:"
when "dev"
"cd #{SRCDIR} && rake dev:start:"
else
"cd #{SRCDIR} && rake dev:start:"
end
SERVICES = ["couchdb","rabbitmq","chef_solr","chef_solr_indexer","chef_server","chef_webui"]
def auth_up
#system("sudo echo")
end
def create_tab
app("System Events").application_processes["Terminal.app"].keystroke("t", :using=>:command_down)
end
def activate_terminal
app("/Applications/Utilities/Terminal.app").windows.first.activate
app("System Events").application_processes["Terminal.app"].keystroke("n", :using=>:command_down)
app('Terminal')
end
def start_service_in_last_tab(window,service)
# use xterm escape codes to set the tab title to the service running in the tab.
cmd =
"unset PROMPT_COMMAND; echo -e \"\\033]0;#{service}\\007\"; " +
BASE_CMD +
service
app('Terminal').do_script(cmd, :in => window.tabs.last.get)
sleep DELAY
end
def start_services
auth_up
term = activate_terminal
window = term.windows.first.get
SERVICES.each do |service|
create_tab
start_service_in_last_tab(window,service)
end
end
if __FILE__ == $0
start_services
end
|