#!/usr/bin/env ruby require 'yaml' require 'tins' filename = ARGV.shift || 'Procfile' procfile = YAML.load_file(filename) unless ENV['TMUX'] name = File.basename(Dir.pwd) exec 'tmux', 'new-session', '-s', name, '-n', ?s, '-A', $0, filename end tmux_pane = ENV.fetch('TMUX_PANE') lines = Tins::Terminal.lines procfile.each_value do |process| system "(tmux select-pane -t #{tmux_pane} \\; split-window -l #{lines / procfile.size} #{process}) &" end exec 'tmux', 'new-window', '-n', 'e', 'edit', ?;, 'split-window', '-h', 'bundle', 'exec', 'probe', '-l'