tmuxinator 0.6.6.pre → 0.6.6.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +19 -0
- data/README.md +24 -0
- data/lib/tmuxinator/assets/template.erb +9 -3
- data/lib/tmuxinator/pane.rb +8 -4
- data/lib/tmuxinator/project.rb +4 -21
- data/lib/tmuxinator/version.rb +1 -1
- data/lib/tmuxinator/window.rb +11 -7
- data/spec/fixtures/sample.yml +3 -0
- data/spec/lib/tmuxinator/window_spec.rb +46 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bcc4780395d82023d5e13e4bf7a9b71233a7f2c
|
4
|
+
data.tar.gz: 0a2cfa85b61822b272935a58306340f022567d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62293ddba08471509037579f4ed99f2d042bc985990bf0de5d41ebb52889f540b8f2fd08f4453d1b72c438abd8ba250fe707d5421220d0127d831c9ef6f8526e
|
7
|
+
data.tar.gz: 3ef6e0f06d6717b052d7bad8ed5cf3ca0f3b3a0ea0f85efc7901b90506f1453f54b8e166420a1c51343cdd51230f092a5ce200e45ef46a1e94a29473ee9f781c
|
data/.travis.yml
CHANGED
@@ -2,4 +2,23 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- "1.9.3"
|
4
4
|
- "2.0.0"
|
5
|
+
env:
|
6
|
+
- TMUX_VERSION=master
|
7
|
+
- TMUX_VERSION=1.8
|
8
|
+
- TMUX_VERSION=1.7
|
9
|
+
- TMUX_VERSION=1.6
|
10
|
+
- TMUX_VERSION=1.5
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
- env: TMUX_VERSION=1.7
|
14
|
+
before_install:
|
15
|
+
- sudo apt-get update -qq
|
16
|
+
- sudo apt-get install -qq libevent-dev libncurses-dev
|
17
|
+
- git clone git://git.code.sf.net/p/tmux/tmux-code tmux
|
18
|
+
- cd tmux
|
19
|
+
- git checkout $TMUX_VERSION
|
20
|
+
- sh autogen.sh
|
21
|
+
- ./configure && make && sudo make install
|
22
|
+
- cd ..
|
23
|
+
- tmux -V
|
5
24
|
script: bundle exec rspec spec
|
data/README.md
CHANGED
@@ -144,6 +144,30 @@ pre_window: rbenv shell 2.0.0-p247
|
|
144
144
|
|
145
145
|
These command(s) will run before any subsequent commands in all panes and windows.
|
146
146
|
|
147
|
+
## Passing directly to send-keys
|
148
|
+
|
149
|
+
tmuxinator passes commands directly to send keys. This differs from simply chaining commands together using `&&` or `;`, in that
|
150
|
+
tmux will directly send the commands to shell as if you typed them in. This allows commands to be executed on a remote server over
|
151
|
+
SSH for example.
|
152
|
+
|
153
|
+
To support this both the window and pane options can take an array as an argument:
|
154
|
+
|
155
|
+
```
|
156
|
+
name: sample
|
157
|
+
root: ~/
|
158
|
+
|
159
|
+
windows:
|
160
|
+
- stats:
|
161
|
+
- ssh stats@example.com
|
162
|
+
- tail -f /var/log/stats.log
|
163
|
+
- logs:
|
164
|
+
layout: main-vertical
|
165
|
+
panes:
|
166
|
+
- logs:
|
167
|
+
- ssh logs@example.com
|
168
|
+
- cd /var/logs
|
169
|
+
- tail -f development.log
|
170
|
+
```
|
147
171
|
|
148
172
|
## Starting a session
|
149
173
|
|
@@ -23,14 +23,20 @@ if [ "$?" -eq 1 ]; then
|
|
23
23
|
# Window "<%= window.name %>"
|
24
24
|
<%- unless window.panes? -%>
|
25
25
|
<%= window.tmux_pre_window_command %>
|
26
|
-
|
26
|
+
<%- window.commands.each do |command| -%>
|
27
27
|
<%= command %>
|
28
|
-
|
28
|
+
<%- end -%>
|
29
29
|
<%- else -%>
|
30
30
|
<%- window.panes.each do |pane| -%>
|
31
31
|
<%= pane.tmux_pre_window_command %>
|
32
32
|
<%= pane.tmux_pre_command %>
|
33
|
-
|
33
|
+
<%- if pane.multiple_commands? %>
|
34
|
+
<%- pane.commands.each do |command| -%>
|
35
|
+
<%= pane.tmux_main_command(command) %>
|
36
|
+
<%- end -%>
|
37
|
+
<%- else -%>
|
38
|
+
<%= pane.tmux_main_command(commands.first) %>
|
39
|
+
<%- end -%>
|
34
40
|
|
35
41
|
<%- unless pane.last? -%>
|
36
42
|
<%= pane.tmux_split_command %>
|
data/lib/tmuxinator/pane.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Tmuxinator
|
2
2
|
class Pane
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :commands, :project, :index, :project, :tab
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(index, project, tab, *commands)
|
6
|
+
@commands = commands
|
7
7
|
@index = index
|
8
8
|
@project = project
|
9
9
|
@tab = tab
|
@@ -21,7 +21,7 @@ module Tmuxinator
|
|
21
21
|
project.pre_window.present? ? "#{project.tmux} send-keys -t #{tmux_window_and_pane_target} #{project.pre_window.shellescape} C-m" : ""
|
22
22
|
end
|
23
23
|
|
24
|
-
def tmux_main_command
|
24
|
+
def tmux_main_command(command)
|
25
25
|
command.present? ? "#{project.tmux} send-keys -t #{project.name}:#{tab.index + project.base_index}.#{index + tab.project.base_index} #{command.shellescape} C-m" : ""
|
26
26
|
end
|
27
27
|
|
@@ -32,5 +32,9 @@ module Tmuxinator
|
|
32
32
|
def last?
|
33
33
|
index == tab.panes.length - 1
|
34
34
|
end
|
35
|
+
|
36
|
+
def multiple_commands?
|
37
|
+
commands.present? && commands.length > 0
|
38
|
+
end
|
35
39
|
end
|
36
40
|
end
|
data/lib/tmuxinator/project.rb
CHANGED
@@ -15,12 +15,7 @@ module Tmuxinator
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def windows
|
18
|
-
windows_yml =
|
19
|
-
if yaml["tabs"].present?
|
20
|
-
yaml["tabs"]
|
21
|
-
else
|
22
|
-
yaml["windows"]
|
23
|
-
end
|
18
|
+
windows_yml = yaml["tabs"].presence || yaml["windows"]
|
24
19
|
|
25
20
|
@windows ||= windows_yml.map.with_index do |window_yml, index|
|
26
21
|
Tmuxinator::Window.new(window_yml, index, self)
|
@@ -28,19 +23,11 @@ module Tmuxinator
|
|
28
23
|
end
|
29
24
|
|
30
25
|
def root
|
31
|
-
|
32
|
-
yaml["project_root"]
|
33
|
-
else
|
34
|
-
yaml["root"]
|
35
|
-
end
|
26
|
+
yaml["project_root"].presence || yaml["root"]
|
36
27
|
end
|
37
28
|
|
38
29
|
def name
|
39
|
-
|
40
|
-
yaml["project_name"].shellescape
|
41
|
-
else
|
42
|
-
yaml["name"].shellescape
|
43
|
-
end
|
30
|
+
yaml["project_name"].presence.try(:shellescape) || yaml["name"].shellescape
|
44
31
|
end
|
45
32
|
|
46
33
|
def pre
|
@@ -69,11 +56,7 @@ module Tmuxinator
|
|
69
56
|
end
|
70
57
|
|
71
58
|
def tmux_command
|
72
|
-
|
73
|
-
yaml["tmux_command"]
|
74
|
-
else
|
75
|
-
"tmux"
|
76
|
-
end
|
59
|
+
yaml["tmux_command"].presence || "tmux"
|
77
60
|
end
|
78
61
|
|
79
62
|
def socket
|
data/lib/tmuxinator/version.rb
CHANGED
data/lib/tmuxinator/window.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "pry"
|
2
|
+
|
1
3
|
module Tmuxinator
|
2
4
|
class Window
|
3
5
|
include Tmuxinator::Util
|
@@ -24,14 +26,16 @@ module Tmuxinator
|
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
|
-
def build_panes(
|
28
|
-
|
29
|
-
pane_yml.
|
30
|
-
|
29
|
+
def build_panes(panes_yml)
|
30
|
+
Array(panes_yml).map.with_index do |pane_yml, index|
|
31
|
+
if pane_yml.is_a?(Hash)
|
32
|
+
pane_yml.map do |name, commands|
|
33
|
+
Tmuxinator::Pane.new(index, project, self, *commands)
|
34
|
+
end
|
35
|
+
else
|
36
|
+
Tmuxinator::Pane.new(index, project, self, pane_yml)
|
31
37
|
end
|
32
|
-
|
33
|
-
Tmuxinator::Pane.new(pane_yml, index, project, self)
|
34
|
-
end
|
38
|
+
end.flatten
|
35
39
|
end
|
36
40
|
|
37
41
|
def build_commands(prefix, command_yml)
|
data/spec/fixtures/sample.yml
CHANGED
@@ -2,12 +2,13 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Tmuxinator::Window do
|
4
4
|
let(:project) { double }
|
5
|
+
let(:panes) { ["vim", nil, "top"] }
|
5
6
|
let(:yaml) do
|
6
7
|
{
|
7
8
|
"editor" => {
|
8
9
|
"pre" => ["echo 'I get run in each pane. Before each pane command!'", nil],
|
9
10
|
"layout" => "main-vertical",
|
10
|
-
"panes" =>
|
11
|
+
"panes" => panes
|
11
12
|
}
|
12
13
|
}
|
13
14
|
end
|
@@ -24,9 +25,50 @@ describe Tmuxinator::Window do
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
|
-
describe "#
|
28
|
-
|
29
|
-
|
28
|
+
describe "#panes" do
|
29
|
+
let(:pane) { double(:pane) }
|
30
|
+
|
31
|
+
before do
|
32
|
+
Tmuxinator::Pane.stub :new => pane
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with a three element Array" do
|
36
|
+
let(:panes) { ["vim", nil, "top"] }
|
37
|
+
|
38
|
+
it "creates three panes" do
|
39
|
+
expect(Tmuxinator::Pane).to receive(:new).exactly(3).times
|
40
|
+
window.panes
|
41
|
+
end
|
42
|
+
|
43
|
+
it "returns three panes" do
|
44
|
+
expect(window.panes).to eql [pane, pane, pane]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "with a String" do
|
49
|
+
let(:panes) { "vim" }
|
50
|
+
|
51
|
+
it "creates one pane" do
|
52
|
+
expect(Tmuxinator::Pane).to receive(:new).once
|
53
|
+
window.panes
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns one pane in an Array" do
|
57
|
+
expect(window.panes).to eql [pane]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "with nil" do
|
62
|
+
let(:panes) { nil }
|
63
|
+
|
64
|
+
it "doesn't create any panes" do
|
65
|
+
expect(Tmuxinator::Pane).to_not receive(:new)
|
66
|
+
window.panes
|
67
|
+
end
|
68
|
+
|
69
|
+
it "returns an empty Array" do
|
70
|
+
expect(window.panes).to be_empty
|
71
|
+
end
|
30
72
|
end
|
31
73
|
end
|
32
74
|
|
@@ -85,18 +127,6 @@ describe Tmuxinator::Window do
|
|
85
127
|
end
|
86
128
|
end
|
87
129
|
|
88
|
-
describe "#build_panes" do
|
89
|
-
context "no panes" do
|
90
|
-
before do
|
91
|
-
yaml["editor"]["panes"] = "vim"
|
92
|
-
end
|
93
|
-
|
94
|
-
it "creates one pane" do
|
95
|
-
expect(window.panes).to be_a(Tmuxinator::Pane)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
130
|
describe "#tmux_new_window_command" do
|
101
131
|
let(:project) { double(:project) }
|
102
132
|
let(:window) { Tmuxinator::Window.new(yaml, 0, project) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tmuxinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.6.pre
|
4
|
+
version: 0.6.6.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Bargi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|