base_index()
click to toggle source
def base_index
get_pane_base_index ? get_pane_base_index.to_i : get_base_index.to_i
end
deprecations()
click to toggle source
def deprecations
deprecations = []
deprecations << "DEPRECATION: rbenv/rvm specific options have been replaced by the pre_tab option and will not be supported in 0.8.0." if yaml["rbenv"] || yaml["rvm"]
deprecations << "DEPRECATION: The tabs option has been replaced by the windows option and will not be supported in 0.8.0." if yaml["tabs"]
deprecations << "DEPRECATION: The cli_args option has been replaced by the tmux_options option and will not be supported in 0.8.0." if yaml["cli_args"]
deprecations
end
get_base_index()
click to toggle source
def get_base_index
tmux_config["base-index"]
end
get_pane_base_index()
click to toggle source
def get_pane_base_index
tmux_config["pane-base-index"]
end
name()
click to toggle source
def name
yaml["project_name"] && yaml["project_name"].shellescape || yaml["name"].shellescape
end
name?()
click to toggle source
pre()
click to toggle source
def pre
pre_config = yaml["pre"]
if pre_config.is_a?(Array)
pre_config.join("; ")
else
pre_config
end
end
pre_window()
click to toggle source
def pre_window
if rbenv?
"rbenv shell #{yaml["rbenv"]}"
elsif rvm?
"rvm use #{yaml["rvm"]}"
elsif pre_tab?
yaml["pre_tab"]
else
yaml["pre_window"]
end
end
render()
click to toggle source
def render
template = File.read(Tmuxinator::Config.template)
Erubis::Eruby.new(template).result(binding)
end
root()
click to toggle source
def root
yaml["project_root"] || File.expand_path(yaml["root"])
end
root?()
click to toggle source
send_keys(cmd, window_index)
click to toggle source
def send_keys(cmd, window_index)
if cmd.empty?
""
else
"#{tmux} send-keys -t #{window(window_index)} #{cmd.shellescape} C-m"
end
end
send_pane_command(cmd, window_index, pane_index)
click to toggle source
def send_pane_command(cmd, window_index, pane_index)
if cmd.empty?
""
else
"#{tmux} send-keys -t #{window(window_index)} #{cmd.shellescape} C-m"
end
end
show_tmux_options()
click to toggle source
def show_tmux_options
"#{tmux} start-server\\; show-option -g"
end
socket()
click to toggle source
def socket
if socket_path
" -S #{socket_path}"
elsif socket_name
" -L #{socket_name}"
else
nil
end
end
socket_name()
click to toggle source
def socket_name
yaml["socket_name"]
end
socket_path()
click to toggle source
def socket_path
yaml["socket_path"]
end
tmux()
click to toggle source
def tmux
"#{tmux_command}#{tmux_options}#{socket}"
end
tmux_command()
click to toggle source
def tmux_command
yaml["tmux_command"] || "tmux"
end
tmux_options()
click to toggle source
def tmux_options
if cli_args?
" #{yaml["cli_args"].to_s.strip}"
elsif tmux_options?
" #{yaml["tmux_options"].to_s.strip}"
else
""
end
end
tmux_options?()
click to toggle source
def tmux_options?
yaml["tmux_options"]
end
window(i)
click to toggle source
def window(i)
"#{name}:#{i}"
end
windows()
click to toggle source
def windows
windows_yml = yaml["tabs"] || yaml["windows"]
@windows ||= windows_yml.map.with_index do |window_yml, index|
Tmuxinator::Window.new(window_yml, index, self)
end
end
windows?()
click to toggle source
def windows?
windows.any?
end