diff lib/pmuxinator/assets/template.erb @ 2:67a6071afec7

Rename tmuxinator -> pmuxinator $ zmv **/*tmuxinator* **/*pmuxinator* $ gsed -e 's/tmuxinator/pmuxinator/g' -i **/*.* $ gsed -e 's/Tmuxinator/Pmuxinator/g' -i **/*.*
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Mon, 21 Jul 2014 08:32:00 +0900
parents
children 4d8f8b2bb7a9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/pmuxinator/assets/template.erb	Mon Jul 21 08:32:00 2014 +0900
@@ -0,0 +1,67 @@
+#!<%= ENV["SHELL"] || "/bin/bash" %>
+
+# Clear rbenv variables before starting tmux
+unset RBENV_VERSION
+unset RBENV_DIR
+
+<%= tmux %> start-server\; has-session -t <%= name %> 2>/dev/null
+
+if [ "$?" -eq 1 ]; then
+  cd <%= root || "." %>
+
+  # Run pre command.
+  <%= pre %>
+
+  # Create the session and the first window.
+  TMUX= <%= tmux %> new-session -d -s <%= name %> -n <%= windows.first.name %>
+
+  <%- if Pmuxinator::Config.version < 1.7 -%>
+  # Set the default path for versions prior to 1.7
+  <%- if root? -%>
+  <%= tmux %> set-option -t <%= name %> <%= Pmuxinator::Config.default_path_option %> <%= root.shellescape -%> 1>/dev/null
+  <%- end -%>
+  <%- end -%>
+
+  # Create other windows.
+  <%- windows.drop(1).each do |window| -%>
+  <%= window.tmux_new_window_command %>
+  <%- end -%>
+
+  <%- windows.each do |window| -%>
+
+  # Window "<%= window.name %>"
+    <%- unless window.panes? -%>
+  <%= window.tmux_pre_window_command %>
+      <%- window.commands.each do |command| -%>
+  <%= command %>
+      <%- end -%>
+    <%- else -%>
+      <%- window.panes.each do |pane| -%>
+  <%= pane.tmux_pre_window_command %>
+  <%= pane.tmux_pre_command %>
+        <%- if pane.multiple_commands? %>
+          <%- pane.commands.each do |command| -%>
+  <%= pane.tmux_main_command(command) %>
+          <%- end -%>
+        <%- else -%>
+  <%= pane.tmux_main_command(commands.first) %>
+        <%- end -%>
+
+      <%- unless pane.last? -%>
+  <%= pane.tmux_split_command %>
+      <%- end -%>
+  <%= window.tmux_layout_command %>
+    <%- end -%>
+
+  <%= window.tmux_select_first_pane %>
+    <%- end -%>
+  <%- end -%>
+
+  <%= tmux %> select-window -t <%= base_index %>
+fi
+
+if [ -z "$TMUX" ]; then
+  <%= tmux %> -u attach-session -t <%= name %>
+else
+  <%= tmux %> -u switch-client -t <%= name %>
+fi