class Consular::AnotherGnomeTerminal

Constants

TERMINAL_CMD
VERSION

Public Class Methods

new(path) click to toggle source
Calls superclass method
# File lib/consular/another-gnome-terminal.rb, line 21
def initialize(path)
  super
  @tabidx = nil
end
platform() click to toggle source
# File lib/consular/another-gnome-terminal.rb, line 11
def platform
  RUBY_PLATFORM
end
valid_system?() click to toggle source
# File lib/consular/another-gnome-terminal.rb, line 15
def valid_system?
  !!(platform =~ /linux/ && !`which #{TERMINAL_CMD}`.empty?)
end

Public Instance Methods

get_name_cmd_option(item) click to toggle source
# File lib/consular/another-gnome-terminal.rb, line 30
def get_name_cmd_option item
  options = item[:options] || {}
  name = options[:name]
  name ? "-t '#{name}'" : ""
end
process!() click to toggle source
# File lib/consular/another-gnome-terminal.rb, line 36
def process!
  windows = @termfile[:windows]
  default = windows.delete('default')

  raise NotImplementedError, "Tabs aren't supported for current window" \
    if default[:tabs].keys.count > 1

  #run commands from default section
  commands = default[:tabs].values.first[:commands] || []
  STDOUT.puts `#{commands.join('; ')}` if commands.any?

  windows.each do |wname, window|
    cmd = [ TERMINAL_CMD ]
    cmd << get_name_cmd_option(window)

    before = window[:before]
    window[:tabs].each do |tname, tab|
      commands = tab[:commands]
      commands = before + commands if before

      cmd << "--tab #{get_name_cmd_option(tab)} -e 'bash -c '\\''#{commands.join('; ')}; exec bash'\\'"
    end
    
    `#{cmd.join(' ')}`
  end
end
setup!() click to toggle source
# File lib/consular/another-gnome-terminal.rb, line 26
def setup!
  raise NotImplementedError
end