class Tomago::ProjectLauncher

Attributes

primary_window[R]
secondary_windows[R]
windows[R]

Public Class Methods

new(name, debug: false) click to toggle source
# File lib/tomago/project_launcher.rb, line 9
def initialize(name, debug: false)
  @project_name = name
  load_windows

  content = File.read("#{File.dirname(__FILE__)}/templates/launch.ssh.erb")
  if debug
    puts(::Erubis::Eruby.new(content).result(binding))
  else
    Kernel.exec(::Erubis::Eruby.new(content).result(binding))
  end
end

Public Instance Methods

has_on_project_start?() click to toggle source
# File lib/tomago/project_launcher.rb, line 21
def has_on_project_start?
  !on_project_start.nil?
end
on_project_start() click to toggle source
# File lib/tomago/project_launcher.rb, line 25
def on_project_start
  project_config["on_project_start"]
end

Private Instance Methods

load_windows() click to toggle source
# File lib/tomago/project_launcher.rb, line 49
def load_windows
  windows = project_config["windows"].clone
  @primary_window = Tomago::Models::Window.new(1, windows.shift)
  @secondary_windows = windows.each_with_index.map do |w, i|
    Tomago::Models::Window.new(i + 2, w)
  end
  @windows = [@primary_window] + @secondary_windows
end
project_config() click to toggle source
# File lib/tomago/project_launcher.rb, line 31
def project_config
  @project_config ||= YAML.load(File.read(project_file))
end
root_directory() click to toggle source
# File lib/tomago/project_launcher.rb, line 35
def root_directory
  project_config["root"]
end
socket() click to toggle source
# File lib/tomago/project_launcher.rb, line 39
def socket
  project_config["name"]
end
window_names() click to toggle source
# File lib/tomago/project_launcher.rb, line 43
def window_names
  @windows.map{|w|w.name}
end