tmuxinator 0.6.10.pre → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mux +1 -1
- data/bin/tmuxinator +1 -1
- data/lib/tmuxinator/assets/sample.yml +3 -0
- data/lib/tmuxinator/assets/template.erb +5 -1
- data/lib/tmuxinator/assets/wemux_template.erb +1 -1
- data/lib/tmuxinator/cli.rb +29 -33
- data/lib/tmuxinator/config.rb +2 -2
- data/lib/tmuxinator/pane.rb +2 -1
- data/lib/tmuxinator/project.rb +4 -0
- data/lib/tmuxinator/version.rb +1 -1
- data/lib/tmuxinator/window.rb +8 -2
- data/spec/factories/projects.rb +3 -3
- data/spec/lib/tmuxinator/cli_spec.rb +1 -1
- data/spec/lib/tmuxinator/project_spec.rb +18 -0
- data/spec/lib/tmuxinator/window_spec.rb +33 -1
- 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: ab460ec84cf4b9f4c3d6cbb6e80e21533657708b
|
4
|
+
data.tar.gz: 3afe10dbb7aef84ffca0703f6b5a91f6ba42af95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ae774646eaa73bd3c08439a0ca6c9df1cbcac3e845e9d276a77a76759f2e6496c4eaa5f9bed078a9c3fb46d80f7c261d8327eb58652592d5663350c20204bc2
|
7
|
+
data.tar.gz: aadf6b72458ea3808703b46fa95fbda6958c8e8cf9d683ddcfe4dff8558bf63bfea7dec282685c2b32e6da49840b400173187fff5b91888d75f424ed13c409a9
|
data/bin/mux
CHANGED
@@ -7,7 +7,7 @@ require "tmuxinator"
|
|
7
7
|
if ARGV.length == 1
|
8
8
|
name = ARGV[0]
|
9
9
|
|
10
|
-
if Tmuxinator::Cli.
|
10
|
+
if Tmuxinator::Cli::COMMANDS.keys.include?(name.to_sym)
|
11
11
|
Tmuxinator::Cli.start
|
12
12
|
elsif Tmuxinator::Config.exists?(name)
|
13
13
|
Tmuxinator::Cli.new.start(name)
|
data/bin/tmuxinator
CHANGED
@@ -7,7 +7,7 @@ require "tmuxinator"
|
|
7
7
|
if ARGV.length == 1
|
8
8
|
name = ARGV[0]
|
9
9
|
|
10
|
-
if Tmuxinator::Cli.
|
10
|
+
if Tmuxinator::Cli::COMMANDS.keys.include?(name.to_sym)
|
11
11
|
Tmuxinator::Cli.start
|
12
12
|
elsif Tmuxinator::Config.exists?(name)
|
13
13
|
Tmuxinator::Cli.new.start(name)
|
@@ -18,6 +18,9 @@ root: ~/
|
|
18
18
|
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
|
19
19
|
# tmux_command: byobu
|
20
20
|
|
21
|
+
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
|
22
|
+
# startup_window: logs
|
23
|
+
|
21
24
|
windows:
|
22
25
|
- editor:
|
23
26
|
layout: main-vertical
|
@@ -13,7 +13,11 @@ if [ "$?" -eq 1 ]; then
|
|
13
13
|
<%= pre %>
|
14
14
|
|
15
15
|
# Create the session and the first window.
|
16
|
+
<%- if windows.first.root? -%>
|
17
|
+
TMUX= <%= tmux %> new-session -d -s <%= name %> -n <%= windows.first.name %> <%= Tmuxinator::Config.default_path_option %> <%= windows.first.root %>
|
18
|
+
<%- else -%>
|
16
19
|
TMUX= <%= tmux %> new-session -d -s <%= name %> -n <%= windows.first.name %>
|
20
|
+
<%- end -%>
|
17
21
|
|
18
22
|
<%- if Tmuxinator::Config.version < 1.7 -%>
|
19
23
|
# Set the default path for versions prior to 1.7
|
@@ -57,7 +61,7 @@ if [ "$?" -eq 1 ]; then
|
|
57
61
|
<%- end -%>
|
58
62
|
<%- end -%>
|
59
63
|
|
60
|
-
<%= tmux %> select-window -t <%=
|
64
|
+
<%= tmux %> select-window -t <%= startup_window %>
|
61
65
|
fi
|
62
66
|
|
63
67
|
if [ -z "$TMUX" ]; then
|
data/lib/tmuxinator/cli.rb
CHANGED
@@ -2,44 +2,38 @@ module Tmuxinator
|
|
2
2
|
class Cli < Thor
|
3
3
|
include Tmuxinator::Util
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
implode: "Deletes all tmuxinator projects",
|
20
|
-
version: "Display installed tmuxinator version",
|
21
|
-
doctor: "Look for problems in your configuration"
|
22
|
-
}
|
23
|
-
|
24
|
-
end
|
5
|
+
COMMANDS = {
|
6
|
+
commands: "Lists commands available in tmuxinator",
|
7
|
+
completions: "Used for shell completion",
|
8
|
+
new: "Create a new project file and open it in your editor",
|
9
|
+
open: "Alias of new",
|
10
|
+
start: "Start a tmux session using a project's tmuxinator config",
|
11
|
+
debug: "Output the shell commands that are generated by tmuxinator",
|
12
|
+
copy: "Copy an existing project to a new project and open it in your editor",
|
13
|
+
delete: "Deletes given project",
|
14
|
+
implode: "Deletes all tmuxinator projects",
|
15
|
+
version: "Display installed tmuxinator version",
|
16
|
+
doctor: "Look for problems in your configuration",
|
17
|
+
list: "Lists all tmuxinator projects"
|
18
|
+
}
|
25
19
|
|
26
20
|
package_name "tmuxinator" unless Gem::Version.create(Thor::VERSION) < Gem::Version.create("0.18")
|
27
21
|
|
28
|
-
desc "commands",
|
22
|
+
desc "commands", COMMANDS[:commands]
|
29
23
|
|
30
24
|
def commands(shell = nil)
|
31
25
|
out = if shell == "zsh"
|
32
|
-
|
26
|
+
COMMANDS.map do |command, desc|
|
33
27
|
"#{command}:#{desc}"
|
34
28
|
end.join("\n")
|
35
29
|
else
|
36
|
-
|
30
|
+
COMMANDS.keys.join("\n")
|
37
31
|
end
|
38
32
|
|
39
33
|
puts out
|
40
34
|
end
|
41
35
|
|
42
|
-
desc "completions [arg1 arg2]",
|
36
|
+
desc "completions [arg1 arg2]", COMMANDS[:completions]
|
43
37
|
|
44
38
|
def completions(arg)
|
45
39
|
if %w(start open copy delete).include?(arg)
|
@@ -48,9 +42,11 @@ module Tmuxinator
|
|
48
42
|
end
|
49
43
|
end
|
50
44
|
|
51
|
-
desc "new [PROJECT]",
|
45
|
+
desc "new [PROJECT]", COMMANDS[:new]
|
52
46
|
map "open" => :new
|
47
|
+
map "edit" => :new
|
53
48
|
map "o" => :new
|
49
|
+
map "e" => :new
|
54
50
|
map "n" => :new
|
55
51
|
|
56
52
|
def new(name)
|
@@ -65,7 +61,7 @@ module Tmuxinator
|
|
65
61
|
Kernel.system("$EDITOR #{config}") || doctor
|
66
62
|
end
|
67
63
|
|
68
|
-
desc "start [PROJECT]",
|
64
|
+
desc "start [PROJECT]", COMMANDS[:start]
|
69
65
|
map "s" => :start
|
70
66
|
|
71
67
|
def start(name)
|
@@ -81,14 +77,14 @@ module Tmuxinator
|
|
81
77
|
Kernel.exec(project.render)
|
82
78
|
end
|
83
79
|
|
84
|
-
desc "debug [PROJECT]",
|
80
|
+
desc "debug [PROJECT]", COMMANDS[:debug]
|
85
81
|
|
86
82
|
def debug(name)
|
87
83
|
project = Tmuxinator::Config.validate(name)
|
88
84
|
puts project.render
|
89
85
|
end
|
90
86
|
|
91
|
-
desc "copy [EXISTING] [NEW]",
|
87
|
+
desc "copy [EXISTING] [NEW]", COMMANDS[:copy]
|
92
88
|
map "c" => :copy
|
93
89
|
map "cp" => :copy
|
94
90
|
|
@@ -106,7 +102,7 @@ module Tmuxinator
|
|
106
102
|
Kernel.system("$EDITOR #{new_config_path}")
|
107
103
|
end
|
108
104
|
|
109
|
-
desc "delete [PROJECT]",
|
105
|
+
desc "delete [PROJECT]", COMMANDS[:delete]
|
110
106
|
map "d" => :delete
|
111
107
|
map "rm" => :delete
|
112
108
|
|
@@ -123,7 +119,7 @@ module Tmuxinator
|
|
123
119
|
end
|
124
120
|
end
|
125
121
|
|
126
|
-
desc "implode",
|
122
|
+
desc "implode", COMMANDS[:implode]
|
127
123
|
map "i" => :implode
|
128
124
|
|
129
125
|
def implode
|
@@ -133,7 +129,7 @@ module Tmuxinator
|
|
133
129
|
end
|
134
130
|
end
|
135
131
|
|
136
|
-
desc "list",
|
132
|
+
desc "list", COMMANDS[:list]
|
137
133
|
map "l" => :list
|
138
134
|
map "ls" => :list
|
139
135
|
|
@@ -143,14 +139,14 @@ module Tmuxinator
|
|
143
139
|
print_in_columns Tmuxinator::Config.configs
|
144
140
|
end
|
145
141
|
|
146
|
-
desc "version",
|
142
|
+
desc "version", COMMANDS[:version]
|
147
143
|
map "-v" => :version
|
148
144
|
|
149
145
|
def version
|
150
146
|
say "tmuxinator #{Tmuxinator::VERSION}"
|
151
147
|
end
|
152
148
|
|
153
|
-
desc "doctor",
|
149
|
+
desc "doctor", COMMANDS[:doctor]
|
154
150
|
|
155
151
|
def doctor
|
156
152
|
say "Checking if tmux is installed ==> "
|
data/lib/tmuxinator/config.rb
CHANGED
@@ -44,7 +44,7 @@ module Tmuxinator
|
|
44
44
|
|
45
45
|
def project(name)
|
46
46
|
projects = Dir.glob("#{root}/**/*.yml")
|
47
|
-
project_file = projects.detect { |project| project
|
47
|
+
project_file = projects.detect { |project| File.basename(project, ".yml") == name }
|
48
48
|
project_file || "#{root}/#{name}.yml"
|
49
49
|
end
|
50
50
|
|
@@ -71,7 +71,7 @@ module Tmuxinator
|
|
71
71
|
config_path = Tmuxinator::Config.project(name)
|
72
72
|
|
73
73
|
yaml = begin
|
74
|
-
YAML.load(File.read(config_path))
|
74
|
+
YAML.load(Erubis::Eruby.new(File.read(config_path)).result(binding))
|
75
75
|
rescue SyntaxError, StandardError
|
76
76
|
puts "Failed to parse config file. Please check your formatting."
|
77
77
|
exit!
|
data/lib/tmuxinator/pane.rb
CHANGED
@@ -26,7 +26,8 @@ module Tmuxinator
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def tmux_split_command
|
29
|
-
"#{
|
29
|
+
path = tab.root? ? "#{Tmuxinator::Config.default_path_option} #{tab.root}" : nil
|
30
|
+
"#{project.tmux} splitw #{path} -t #{tab.tmux_window_target}"
|
30
31
|
end
|
31
32
|
|
32
33
|
def last?
|
data/lib/tmuxinator/project.rb
CHANGED
data/lib/tmuxinator/version.rb
CHANGED
data/lib/tmuxinator/window.rb
CHANGED
@@ -2,10 +2,11 @@ module Tmuxinator
|
|
2
2
|
class Window
|
3
3
|
include Tmuxinator::Util
|
4
4
|
|
5
|
-
attr_reader :name, :panes, :layout, :commands, :index, :project
|
5
|
+
attr_reader :name, :root, :panes, :layout, :commands, :index, :project
|
6
6
|
|
7
7
|
def initialize(window_yaml, index, project)
|
8
8
|
@name = !window_yaml.keys.first.nil? ? window_yaml.keys.first.shellescape : nil
|
9
|
+
@root = nil
|
9
10
|
@panes = []
|
10
11
|
@layout = nil
|
11
12
|
@pre = nil
|
@@ -17,6 +18,7 @@ module Tmuxinator
|
|
17
18
|
if value.is_a?(Hash)
|
18
19
|
@layout = value["layout"] ? value["layout"].shellescape : nil
|
19
20
|
@pre = value["pre"] if value["pre"]
|
21
|
+
@root = value["root"] ? File.expand_path(value["root"]).shellescape : project.root? ? project.root : nil
|
20
22
|
|
21
23
|
@panes = build_panes(value["panes"])
|
22
24
|
else
|
@@ -58,6 +60,10 @@ module Tmuxinator
|
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
63
|
+
def root?
|
64
|
+
!root.nil?
|
65
|
+
end
|
66
|
+
|
61
67
|
def panes?
|
62
68
|
panes.any?
|
63
69
|
end
|
@@ -75,7 +81,7 @@ module Tmuxinator
|
|
75
81
|
end
|
76
82
|
|
77
83
|
def tmux_new_window_command
|
78
|
-
path =
|
84
|
+
path = root? ? "#{Tmuxinator::Config.default_path_option} #{root}" : nil
|
79
85
|
"#{project.tmux} new-window #{path} -t #{tmux_window_target} -n #{name}"
|
80
86
|
end
|
81
87
|
|
data/spec/factories/projects.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :project, :class => Tmuxinator::Project do
|
3
|
-
|
3
|
+
transient do
|
4
4
|
file { YAML.load(File.read("#{File.expand_path("spec/fixtures/sample.yml")}")) }
|
5
5
|
end
|
6
6
|
|
@@ -8,7 +8,7 @@ FactoryGirl.define do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
factory :project_with_deprecations, :class => Tmuxinator::Project do
|
11
|
-
|
11
|
+
transient do
|
12
12
|
file { YAML.load(File.read("#{File.expand_path("spec/fixtures/sample.deprecations.yml")}")) }
|
13
13
|
end
|
14
14
|
|
@@ -16,7 +16,7 @@ FactoryGirl.define do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
factory :wemux_project, :class => Tmuxinator::Project do
|
19
|
-
|
19
|
+
transient do
|
20
20
|
file { YAML.load(File.read("#{File.expand_path("spec/fixtures/sample_wemux.yml")}")) }
|
21
21
|
end
|
22
22
|
|
@@ -36,7 +36,7 @@ describe Tmuxinator::Cli do
|
|
36
36
|
|
37
37
|
it "lists the commands" do
|
38
38
|
out, _ = capture_io { cli.start }
|
39
|
-
expect(out).to eq "#{%w(commands completions new open start debug copy delete implode version doctor).join("\n")}\n"
|
39
|
+
expect(out).to eq "#{%w(commands completions new open start debug copy delete implode version doctor list).join("\n")}\n"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -206,6 +206,24 @@ describe Tmuxinator::Project do
|
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
|
+
describe "#startup_window" do
|
210
|
+
context "startup window specified" do
|
211
|
+
it "gets the startup window from project config" do
|
212
|
+
project.yaml["startup_window"] = "logs"
|
213
|
+
|
214
|
+
expect(project.startup_window).to eq("logs")
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
context "startup window not specified" do
|
219
|
+
it "returns base index instead" do
|
220
|
+
allow(project).to receive_messages(:base_index => 8)
|
221
|
+
|
222
|
+
expect(project.startup_window).to eq 8
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
209
227
|
describe "#window" do
|
210
228
|
it "gets the window and index for tmux" do
|
211
229
|
expect(project.window(1)).to eq "sample:1"
|
@@ -12,11 +12,29 @@ describe Tmuxinator::Window do
|
|
12
12
|
}
|
13
13
|
}
|
14
14
|
end
|
15
|
+
let(:yaml_root) do
|
16
|
+
{
|
17
|
+
"editor" => {
|
18
|
+
"root" => "/project/override",
|
19
|
+
"root?" => true,
|
20
|
+
"pre" => ["echo 'I get run in each pane. Before each pane command!'", nil],
|
21
|
+
"layout" => "main-vertical",
|
22
|
+
"panes" => panes
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
15
26
|
|
16
27
|
let(:window) { Tmuxinator::Window.new(yaml, 0, project) }
|
28
|
+
let(:window_root) { Tmuxinator::Window.new(yaml_root, 0, project) }
|
17
29
|
|
18
30
|
before do
|
19
|
-
allow(project).to receive_messages(
|
31
|
+
allow(project).to receive_messages(
|
32
|
+
:tmux => "tmux",
|
33
|
+
:name => "test",
|
34
|
+
:base_index => 1,
|
35
|
+
:root => "/project/tmuxinator",
|
36
|
+
:root? => true
|
37
|
+
)
|
20
38
|
end
|
21
39
|
|
22
40
|
describe "#initialize" do
|
@@ -25,6 +43,20 @@ describe Tmuxinator::Window do
|
|
25
43
|
end
|
26
44
|
end
|
27
45
|
|
46
|
+
describe "#root" do
|
47
|
+
context "without window root" do
|
48
|
+
it "gets the project root" do
|
49
|
+
expect(window.root).to include("/project/tmuxinator")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "with window root" do
|
54
|
+
it "gets the window root" do
|
55
|
+
expect(window_root.root).to include("/project/override")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
28
60
|
describe "#panes" do
|
29
61
|
let(:pane) { double(:pane) }
|
30
62
|
|
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.10
|
4
|
+
version: 0.6.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Bargi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|