Class: I2Cssh

Inherits:
Object
  • Object
show all
Defined in:
lib/i2cssh.rb

Instance Method Summary collapse

Constructor Details

#initialize(servers, ssh_options, i2_options) ⇒ I2Cssh

Returns a new instance of I2Cssh.



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
# File 'lib/i2cssh.rb', line 4

def initialize servers, ssh_options, i2_options
    @ssh_prefix  = "ssh " + ssh_options.join(' ')
    @ssh_options = ssh_options
    @i2_options  = i2_options
    @servers     = servers

    app_name = (i2_options[:iterm2]) ? 'iTerm2' : 'iTerm'

    raise Exception.new 'No servers given' if servers.empty?

    @sys_events = Appscript.app.by_name('System Events')
    @iterm = Appscript.app.by_name(app_name)
    @term = @iterm.make(:new => :terminal)

    @profile = i2_options[:profile] || "Default"

    session = @term.sessions.after.make :new => :session
    session.exec :command => "/bin/bash -l"

    compute_geometry
    split_session
    maximize if i2_options[:fullscreen]
    
    start_ssh
    enable_broadcast if i2_options[:broadcast]
end