tmuxinator 0.6.5 → 0.6.6.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d9d7fb728f65009f6058f0810d48d28bbea8d78
4
- data.tar.gz: 428a7e368197fdad498e10ba1af3fd63d4bdabd3
3
+ metadata.gz: 55331f23c1165f7baf76833639f87d594c1b3d44
4
+ data.tar.gz: 3f8a57eae115f45286223641a72b3147309d10cd
5
5
  SHA512:
6
- metadata.gz: f8ac28cc11f7a1ec80ec1a832d67d7a786e98d13396dbef493b6e5ea003a48822c4a55a23dac74d7a204875232013ec10d279a6872079673ae9170da76e1f328
7
- data.tar.gz: 7889d60c7f2071f6c267bec80c7d13e6bc734bc991e154c530c3b230a742452b1674110ad1cee6e455ec02ac1ca98565fbcef1dad9f70e42be370a7ab9a0f507
6
+ metadata.gz: 3ff12ea856474fee5fe315123c635f317161573f2762a7e22ff5100c7e1563db232c7ed563bad8aa198e7e24dfc708327932db2f736285f1dfe8ee656975b6d8
7
+ data.tar.gz: b0136800e96359dcd2566ca3e57117655b5303d2facca41c378460fa811f8747463223bac0a353c51e3c0066320eb4129cd71289911b1573c9127cacf0a8489a
@@ -1,3 +1,10 @@
1
+ ## 0.6.6
2
+ - Fix a bug caused by not escaping the root path #145
3
+ - Fix bash completion with a single argument #148
4
+ - Fix regression where an array of commands for a window wasn't working #149
5
+ - Add an option to call tmux wrappers or derivatives #154
6
+ - Make multiple commands use tmux's `send-keys` rather than just using `&&` #100
7
+
1
8
  ## 0.6.5
2
9
  - Change deprecation continue message from any key to just the enter key
3
10
  - Dramatically clean up the readme to be clearer for new users
data/README.md CHANGED
@@ -94,6 +94,9 @@ root: ~/
94
94
  # Pass command line options to tmux. Useful for specifying a different tmux.conf.
95
95
  # tmux_options: -f ~/.tmux.mac.conf
96
96
 
97
+ # Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
98
+ # tmux_command: byobu
99
+
97
100
  windows:
98
101
  - editor:
99
102
  layout: main-vertical
@@ -5,7 +5,10 @@ _tmuxinator() {
5
5
  local word="${COMP_WORDS[COMP_CWORD]}"
6
6
 
7
7
  if [ "$COMP_CWORD" -eq 1 ]; then
8
- COMPREPLY=( $(compgen -W "$(tmuxinator commands)" -- "$word") )
8
+ local commands="$(compgen -W "$(tmuxinator commands)" -- "$word")"
9
+ local projects="$(compgen -W "$(tmuxinator completions start)" -- "$word")"
10
+
11
+ COMPREPLY=( $commands $projects )
9
12
  else
10
13
  local words=("${COMP_WORDS[@]}")
11
14
  unset words[0]
@@ -15,6 +15,9 @@ root: ~/
15
15
  # Pass command line options to tmux. Useful for specifying a different tmux.conf.
16
16
  # tmux_options: -f ~/.tmux.mac.conf
17
17
 
18
+ # Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
19
+ # tmux_command: byobu
20
+
18
21
  windows:
19
22
  - editor:
20
23
  layout: main-vertical
@@ -11,7 +11,7 @@ if [ "$?" -eq 1 ]; then
11
11
  TMUX= <%= tmux %> new-session -d -s <%= name %> -n <%= windows.first.name %>
12
12
 
13
13
  # Set the default path.
14
- <%= tmux %> set-option -t <%= name %> default-path <%= root -%> 1>/dev/null
14
+ <%= tmux %> set-option -t <%= name %> default-path <%= root.shellescape -%> 1>/dev/null
15
15
 
16
16
  # Create other windows.
17
17
  <%- windows.drop(1).each do |window| -%>
@@ -23,7 +23,9 @@ if [ "$?" -eq 1 ]; then
23
23
  # Window "<%= window.name %>"
24
24
  <%- unless window.panes? -%>
25
25
  <%= window.tmux_pre_window_command %>
26
- <%= window.tmux_main_command %>
26
+ <%- window.commands.each do |command| -%>
27
+ <%= command %>
28
+ <%- end -%>
27
29
  <%- else -%>
28
30
  <%- window.panes.each do |pane| -%>
29
31
  <%= pane.tmux_pre_window_command %>
@@ -36,7 +38,6 @@ if [ "$?" -eq 1 ]; then
36
38
  <%= window.tmux_layout_command %>
37
39
  <%- end -%>
38
40
 
39
-
40
41
  <%= window.tmux_select_first_pane %>
41
42
  <%- end -%>
42
43
  <%- end -%>
@@ -65,7 +65,15 @@ module Tmuxinator
65
65
  end
66
66
 
67
67
  def tmux
68
- "tmux#{tmux_options}#{socket}"
68
+ "#{tmux_command}#{tmux_options}#{socket}"
69
+ end
70
+
71
+ def tmux_command
72
+ if yaml["tmux_command"].present?
73
+ yaml["tmux_command"]
74
+ else
75
+ "tmux"
76
+ end
69
77
  end
70
78
 
71
79
  def socket
@@ -1,3 +1,3 @@
1
1
  module Tmuxinator
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.6.pre"
3
3
  end
@@ -1,13 +1,14 @@
1
1
  module Tmuxinator
2
2
  class Window
3
- attr_reader :name, :panes, :layout, :command, :index, :project
3
+ include Tmuxinator::Util
4
+
5
+ attr_reader :name, :panes, :layout, :commands, :index, :project
4
6
 
5
7
  def initialize(window_yaml, index, project)
6
8
  @name = window_yaml.keys.first.present? ? window_yaml.keys.first.shellescape : nil
7
9
  @panes = []
8
10
  @layout = nil
9
11
  @pre = nil
10
- @command = nil
11
12
  @project = project
12
13
  @index = index
13
14
 
@@ -19,7 +20,7 @@ module Tmuxinator
19
20
 
20
21
  @panes = build_panes(value["panes"])
21
22
  else
22
- @command = value
23
+ @commands = build_commands(tmux_window_command_prefix, value)
23
24
  end
24
25
  end
25
26
 
@@ -33,6 +34,18 @@ module Tmuxinator
33
34
  end
34
35
  end
35
36
 
37
+ def build_commands(prefix, command_yml)
38
+ if command_yml.is_a?(Array)
39
+ command_yml.map do |command|
40
+ "#{tmux_window_command_prefix} #{command.shellescape} C-m" if command.present?
41
+ end.compact
42
+ elsif command_yml.present?
43
+ ["#{tmux_window_command_prefix} #{command_yml.shellescape} C-m"]
44
+ else
45
+ []
46
+ end
47
+ end
48
+
36
49
  def pre
37
50
  if @pre.present?
38
51
  if @pre.is_a?(Array)
@@ -57,8 +70,8 @@ module Tmuxinator
57
70
  project.pre_window.present? ? "#{project.tmux} send-keys -t #{tmux_window_target} #{project.pre_window.shellescape} C-m" : ""
58
71
  end
59
72
 
60
- def tmux_main_command
61
- command.present? ? "#{project.tmux} send-keys -t #{project.name}:#{index + project.base_index} #{command.shellescape} C-m" : ""
73
+ def tmux_window_command_prefix
74
+ "#{project.tmux} send-keys -t #{project.name}:#{index + project.base_index}"
62
75
  end
63
76
 
64
77
  def tmux_new_window_command
@@ -17,7 +17,9 @@ windows:
17
17
  - vim
18
18
  - #empty, will just run plain bash
19
19
  - top
20
- - shell: git pull
20
+ - shell:
21
+ - git pull
22
+ - git merge
21
23
  - guard:
22
24
  layout: tiled
23
25
  pre:
@@ -151,11 +151,11 @@ describe Tmuxinator::Cli do
151
151
  describe "#delete" do
152
152
  before do
153
153
  ARGV.replace(["delete", "foo"])
154
+ $stdin.stub(:gets => "y")
154
155
  end
155
156
 
156
157
  context "project exists" do
157
158
  before do
158
- $stdin.stub(:gets => "y")
159
159
  Tmuxinator::Config.stub(:exists?) { true }
160
160
  end
161
161
 
@@ -170,6 +170,10 @@ describe Tmuxinator::Cli do
170
170
  end
171
171
 
172
172
  context "project doesn't exist" do
173
+ before do
174
+ $stdin.stub(:gets => "y")
175
+ end
176
+
173
177
  it "exits with error message" do
174
178
  expect { capture_io { cli.start } }.to raise_error SystemExit
175
179
  end
@@ -113,6 +113,24 @@ describe Tmuxinator::Project do
113
113
  end
114
114
  end
115
115
 
116
+ describe "#tmux_command" do
117
+ context "tmux_command specified" do
118
+ before do
119
+ project.yaml["tmux_command"] = "byobu"
120
+ end
121
+
122
+ it "gets the custom tmux command" do
123
+ expect(project.tmux_command).to eq "byobu"
124
+ end
125
+ end
126
+
127
+ context "tmux_command is not specified" do
128
+ it "returns the default" do
129
+ expect(project.tmux_command).to eq "tmux"
130
+ end
131
+ end
132
+ end
133
+
116
134
  describe "#tmux_options" do
117
135
  context "no tmux options" do
118
136
  before do
@@ -231,6 +249,14 @@ describe Tmuxinator::Project do
231
249
  end
232
250
  end
233
251
 
252
+ describe "#commands" do
253
+ let(:window) { project.windows.keep_if { |w| w.name == "shell" }.first }
254
+
255
+ it "splits commands into an array" do
256
+ expect(window.commands).to eq(["tmux -f ~/.tmux.mac.conf -L foo send-keys -t sample:1 git\\ pull C-m", "tmux -f ~/.tmux.mac.conf -L foo send-keys -t sample:1 git\\ merge C-m"])
257
+ end
258
+ end
259
+
234
260
  describe "#pre" do
235
261
  subject(:pre) { project.pre }
236
262
 
@@ -1,4 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Tmuxinator::Util do
4
+ let(:util) { Object.new.extend(Tmuxinator::Util) }
5
+
4
6
  end
@@ -1,6 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Tmuxinator::Window do
4
+ let(:project) { double }
4
5
  let(:yaml) do
5
6
  {
6
7
  "editor" => {
@@ -11,7 +12,11 @@ describe Tmuxinator::Window do
11
12
  }
12
13
  end
13
14
 
14
- let(:window) { Tmuxinator::Window.new(yaml, 0, nil) }
15
+ let(:window) { Tmuxinator::Window.new(yaml, 0, project) }
16
+
17
+ before do
18
+ project.stub(:tmux => "tmux", :name => "test", :base_index => 1)
19
+ end
15
20
 
16
21
  describe "#initialize" do
17
22
  it "creates an instance" do
@@ -48,6 +53,38 @@ describe Tmuxinator::Window do
48
53
  end
49
54
  end
50
55
 
56
+ describe "#build_commands" do
57
+ context "command is an array" do
58
+ before do
59
+ yaml["editor"] = ["git fetch", "git status"]
60
+ end
61
+
62
+ it "returns the flattened command" do
63
+ expect(window.commands).to eq ["tmux send-keys -t test:1 git\\ fetch C-m", "tmux send-keys -t test:1 git\\ status C-m"]
64
+ end
65
+ end
66
+
67
+ context "command is a string" do
68
+ before do
69
+ yaml["editor"] = "vim"
70
+ end
71
+
72
+ it "returns the command" do
73
+ expect(window.commands).to eq ["tmux send-keys -t test:1 vim C-m"]
74
+ end
75
+ end
76
+
77
+ context "command is empty" do
78
+ before do
79
+ yaml["editor"] = ""
80
+ end
81
+
82
+ it "returns an empty array" do
83
+ expect(window.commands).to be_empty
84
+ end
85
+ end
86
+ end
87
+
51
88
  describe "#build_panes" do
52
89
  context "no panes" do
53
90
  before do
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.5
4
+ version: 0.6.6.pre
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-08-12 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  version: 1.8.23
234
234
  requirements: []
235
235
  rubyforge_project:
236
- rubygems_version: 2.0.6
236
+ rubygems_version: 2.0.7
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: Create and manage complex tmux sessions easily.