Class: I2Cssh
- Inherits:
-
Object
- Object
- I2Cssh
- Defined in:
- lib/i2cssh.rb
Instance Method Summary collapse
-
#initialize(servers, ssh_options, i2_options, ssh_environment) ⇒ I2Cssh
constructor
A new instance of I2Cssh.
Constructor Details
#initialize(servers, ssh_options, i2_options, ssh_environment) ⇒ I2Cssh
Returns a new instance of I2Cssh.
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 |
# File 'lib/i2cssh.rb', line 3 def initialize servers, , , ssh_environment @ssh_prefix = "ssh " + .join(' ') @ssh_options = @i2_options = .clone @servers = servers @ssh_environment = ssh_environment app_name = (.first[:iterm2]) ? 'iTerm2' : ((.first[:itermname]) ? .first[:itermname] : '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) @pane_menu = @sys_events.processes[app_name].[1].["Window"].["Window"].["Select Split Pane"].["Select Split Pane"] @shell_menu = @sys_events.processes[app_name].[1].["Shell"].["Shell"] @term = @iterm.make(:new => :terminal) @profile = .first[:profile] || "Default" @term.launch_(:session => "Default Session") maximize(app_name) if .first[:fullscreen] while !@servers.empty? do compute_geometry split_session start_ssh enable_broadcast if .first[:broadcast] @servers.shift @i2_options.shift @ssh_environment.shift if !@servers.empty? && .first[:tabs] then # By default, a new session = a new tab @term.launch_(:session => "Default Session") end end @term.select(@term.sessions[1]) end |