Class: Godo::TerminalSession
Instance Attribute Summary
Attributes inherited from Session
#path
Instance Method Summary
collapse
Methods inherited from Session
#counter, #create, #set_label
Constructor Details
Returns a new instance of TerminalSession.
8
9
10
11
12
|
# File 'lib/sessions/terminal_session.rb', line 8
def initialize( path )
super( path )
@@terminal ||= Appscript::app('Terminal')
@window = nil
end
|
Instance Method Details
#execute(command) ⇒ Object
29
30
31
|
# File 'lib/sessions/terminal_session.rb', line 29
def execute( command )
@@terminal.do_script(command, :in => @window.tabs.last.get)
end
|
#start ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/sessions/terminal_session.rb', line 14
def start
if @window
@window.frontmost.set(true)
Appscript::app('Terminal').activate
Appscript::app("System Events").application_processes["Terminal.app"].keystroke("t", :using => :command_down)
while (@window.tabs.last.busy.get)
sleep 0.1
end
else
first_tab = @@terminal.do_script('')
@window = eval('Appscript::' + first_tab.to_s.gsub(/\.tabs.*$/, ''))
end
end
|