tmuxinator 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/tmuxinator +1 -1
- data/lib/tmuxinator/cli.rb +24 -15
- data/lib/tmuxinator/config.rb +39 -11
- data/lib/tmuxinator/project.rb +7 -7
- data/lib/tmuxinator/version.rb +1 -1
- data/spec/factories/projects.rb +1 -1
- data/spec/lib/tmuxinator/cli_spec.rb +92 -18
- data/spec/lib/tmuxinator/config_spec.rb +44 -1
- data/spec/lib/tmuxinator/hooks/project_spec.rb +2 -2
- data/spec/lib/tmuxinator/hooks_spec.rb +1 -1
- data/spec/lib/tmuxinator/project_spec.rb +13 -13
- data/spec/spec_helper.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ed00e08279ec6ad20fa800451544a370ae71a15d98d3ac5f6a6709f99b6691c5
|
4
|
+
data.tar.gz: 46f02014bbac042c63e7cf64da8492c4f0c5bee5c9fe10379954e15e44534345
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c8f6c446b733c151b6059b572b2b4e04b0d12ec809d3ed8a10f7138c6e585a4554239f67af89d90fe8588149c7c9eb2f0efa3391aa17284a74c7155fb3737dd
|
7
|
+
data.tar.gz: 01d18bbac42f964e1e587f319eac8fc4636235a109d6ebaac41594d8e9180fbb80104155ed83c594d4e351ac53203cc872e754784f9c3d3e29df4c45c54074c9
|
data/bin/tmuxinator
CHANGED
@@ -9,7 +9,7 @@ name = ARGV[0] || nil
|
|
9
9
|
if ARGV.empty? && Tmuxinator::Config.local?
|
10
10
|
Tmuxinator::Cli.new.local
|
11
11
|
elsif name && !Tmuxinator::Cli::COMMANDS.keys.include?(name.to_sym) &&
|
12
|
-
Tmuxinator::Config.exists?(name)
|
12
|
+
Tmuxinator::Config.exists?(name: name)
|
13
13
|
Tmuxinator::Cli.new.start(name, *ARGV.drop(1))
|
14
14
|
else
|
15
15
|
Tmuxinator::Cli.start
|
data/lib/tmuxinator/cli.rb
CHANGED
@@ -17,8 +17,8 @@ module Tmuxinator
|
|
17
17
|
edit: "Alias of new",
|
18
18
|
open: "Alias of new",
|
19
19
|
start: %w{
|
20
|
-
Start a tmux session using a project's
|
21
|
-
|
20
|
+
Start a tmux session using a project's name (with an optional [ALIAS]
|
21
|
+
for project reuse) or a path to a project config file (via the -p flag)
|
22
22
|
}.join(" "),
|
23
23
|
stop: "Stop a tmux session using a project's tmuxinator config",
|
24
24
|
local: "Start a tmux session using ./.tmuxinator.yml",
|
@@ -164,16 +164,21 @@ module Tmuxinator
|
|
164
164
|
end
|
165
165
|
|
166
166
|
def create_project(project_options = {})
|
167
|
-
|
168
|
-
|
169
|
-
|
167
|
+
# Strings provided to --attach are coerced into booleans by Thor.
|
168
|
+
# "f" and "false" will result in `:attach` being `false` and any other
|
169
|
+
# string or the empty flag will result in `:attach` being `true`.
|
170
|
+
# If the flag is not present, `:attach` will be `nil`.
|
171
|
+
attach = detach = false
|
172
|
+
attach = true if project_options[:attach] == true
|
173
|
+
detach = true if project_options[:attach] == false
|
170
174
|
|
171
175
|
options = {
|
176
|
+
args: project_options[:args],
|
177
|
+
custom_name: project_options[:custom_name],
|
172
178
|
force_attach: attach,
|
173
179
|
force_detach: detach,
|
174
180
|
name: project_options[:name],
|
175
|
-
|
176
|
-
args: project_options[:args]
|
181
|
+
project_config: project_options[:project_config]
|
177
182
|
}
|
178
183
|
|
179
184
|
begin
|
@@ -206,14 +211,18 @@ module Tmuxinator
|
|
206
211
|
desc: "Attach to tmux session after creation."
|
207
212
|
method_option :name, aliases: "-n",
|
208
213
|
desc: "Give the session a different name"
|
214
|
+
method_option "project-config", aliases: "-p",
|
215
|
+
desc: "Path to project config file"
|
209
216
|
|
210
|
-
def start(name, *args)
|
217
|
+
def start(name = nil, *args)
|
211
218
|
params = {
|
212
|
-
|
213
|
-
custom_name: options[:name],
|
219
|
+
args: args,
|
214
220
|
attach: options[:attach],
|
215
|
-
|
221
|
+
custom_name: options[:name],
|
222
|
+
name: name,
|
223
|
+
project_config: options["project-config"]
|
216
224
|
}
|
225
|
+
|
217
226
|
project = create_project(params)
|
218
227
|
render_project(project)
|
219
228
|
end
|
@@ -263,12 +272,12 @@ module Tmuxinator
|
|
263
272
|
new_config_path = Tmuxinator::Config.project(new)
|
264
273
|
|
265
274
|
exit!("Project #{existing} doesn't exist!") \
|
266
|
-
unless Tmuxinator::Config.exists?(existing)
|
275
|
+
unless Tmuxinator::Config.exists?(name: existing)
|
267
276
|
|
268
|
-
new_exists = Tmuxinator::Config.exists?(new)
|
277
|
+
new_exists = Tmuxinator::Config.exists?(name: new)
|
269
278
|
question = "#{new} already exists, would you like to overwrite it?"
|
270
279
|
if !new_exists || yes?(question, :red)
|
271
|
-
say "Overwriting #{new}" if Tmuxinator::Config.exists?(new)
|
280
|
+
say "Overwriting #{new}" if Tmuxinator::Config.exists?(name: new)
|
272
281
|
FileUtils.copy_file(existing_config_path, new_config_path)
|
273
282
|
end
|
274
283
|
|
@@ -281,7 +290,7 @@ module Tmuxinator
|
|
281
290
|
|
282
291
|
def delete(*projects)
|
283
292
|
projects.each do |project|
|
284
|
-
if Tmuxinator::Config.exists?(project)
|
293
|
+
if Tmuxinator::Config.exists?(name: project)
|
285
294
|
config = Tmuxinator::Config.project(project)
|
286
295
|
|
287
296
|
if yes?("Are you sure you want to delete #{project}?(y/n)", :red)
|
data/lib/tmuxinator/config.rb
CHANGED
@@ -3,6 +3,7 @@ module Tmuxinator
|
|
3
3
|
LOCAL_DEFAULT = "./.tmuxinator.yml".freeze
|
4
4
|
NO_LOCAL_FILE_MSG =
|
5
5
|
"Project file at ./.tmuxinator.yml doesn't exist.".freeze
|
6
|
+
NO_PROJECT_FOUND_MSG = "Project could not be found.".freeze
|
6
7
|
TMUX_MASTER_VERSION = Float::INFINITY
|
7
8
|
|
8
9
|
class << self
|
@@ -20,7 +21,9 @@ module Tmuxinator
|
|
20
21
|
ENV["HOME"] + "/.tmuxinator"
|
21
22
|
end
|
22
23
|
|
23
|
-
#
|
24
|
+
# ~/.config/tmuxinator unless $XDG_CONFIG_HOME has been configured to use
|
25
|
+
# a custom value. (e.g. if $XDG_CONFIG_HOME is set to ~/my-config, the
|
26
|
+
# return value will be ~/my-config/tmuxinator)
|
24
27
|
def xdg
|
25
28
|
XDG["CONFIG"].to_s + "/tmuxinator"
|
26
29
|
end
|
@@ -42,7 +45,7 @@ module Tmuxinator
|
|
42
45
|
end
|
43
46
|
|
44
47
|
def default?
|
45
|
-
exists?("default")
|
48
|
+
exists?(name: "default")
|
46
49
|
end
|
47
50
|
|
48
51
|
def version
|
@@ -61,8 +64,10 @@ module Tmuxinator
|
|
61
64
|
version && version < 1.8 ? "default-path" : "-c"
|
62
65
|
end
|
63
66
|
|
64
|
-
def exists?(name)
|
65
|
-
File.exist?(
|
67
|
+
def exists?(name: nil, path: nil)
|
68
|
+
return File.exist?(path) if path
|
69
|
+
return File.exist?(project(name)) if name
|
70
|
+
false
|
66
71
|
end
|
67
72
|
|
68
73
|
def local?
|
@@ -121,20 +126,43 @@ module Tmuxinator
|
|
121
126
|
end
|
122
127
|
end
|
123
128
|
|
129
|
+
def valid_project_config?(project_config)
|
130
|
+
return false unless project_config
|
131
|
+
unless exists?(path: project_config)
|
132
|
+
raise "Project config (#{project_config}) doesn't exist."
|
133
|
+
end
|
134
|
+
true
|
135
|
+
end
|
136
|
+
|
137
|
+
def valid_local_project?(name)
|
138
|
+
return false if name
|
139
|
+
raise NO_LOCAL_FILE_MSG unless local?
|
140
|
+
true
|
141
|
+
end
|
142
|
+
|
143
|
+
def valid_standard_project?(name)
|
144
|
+
return false unless name
|
145
|
+
raise "Project #{name} doesn't exist." unless exists?(name: name)
|
146
|
+
true
|
147
|
+
end
|
148
|
+
|
124
149
|
def validate(options = {})
|
125
150
|
name = options[:name]
|
126
151
|
options[:force_attach] ||= false
|
127
152
|
options[:force_detach] ||= false
|
128
|
-
|
129
|
-
project_file = if
|
130
|
-
|
131
|
-
|
153
|
+
project_config = options.fetch(:project_config) { false }
|
154
|
+
project_file = if valid_project_config?(project_config)
|
155
|
+
project_config
|
156
|
+
elsif valid_local_project?(name)
|
132
157
|
local_project
|
158
|
+
elsif valid_standard_project?(name)
|
159
|
+
project(name)
|
133
160
|
else
|
134
|
-
|
135
|
-
|
136
|
-
|
161
|
+
# This branch should never be reached,
|
162
|
+
# but just in case ...
|
163
|
+
raise NO_PROJECT_FOUND_MSG
|
137
164
|
end
|
165
|
+
|
138
166
|
Tmuxinator::Project.load(project_file, options).validate!
|
139
167
|
end
|
140
168
|
|
data/lib/tmuxinator/project.rb
CHANGED
@@ -7,31 +7,31 @@ module Tmuxinator
|
|
7
7
|
|
8
8
|
RBENVRVM_DEP_MSG = <<-M
|
9
9
|
DEPRECATION: rbenv/rvm-specific options have been replaced by the
|
10
|
-
pre_tab option and will not be supported in 0.8.0.
|
10
|
+
`pre_tab` option and will not be supported in 0.8.0.
|
11
11
|
M
|
12
12
|
TABS_DEP_MSG = <<-M
|
13
|
-
DEPRECATION: The tabs option has been replaced by the windows option
|
13
|
+
DEPRECATION: The tabs option has been replaced by the `windows` option
|
14
14
|
and will not be supported in 0.8.0.
|
15
15
|
M
|
16
16
|
CLIARGS_DEP_MSG = <<-M
|
17
|
-
DEPRECATION: The cli_args option has been replaced by the tmux_options
|
17
|
+
DEPRECATION: The `cli_args` option has been replaced by the `tmux_options`
|
18
18
|
option and will not be supported in 0.8.0.
|
19
19
|
M
|
20
20
|
SYNC_DEP_MSG = <<-M
|
21
|
-
DEPRECATION: The synchronize option's current default behaviour is to
|
21
|
+
DEPRECATION: The `synchronize` option's current default behaviour is to
|
22
22
|
enable pane synchronization before running commands. In a future release,
|
23
23
|
the default synchronization option will be `after`, i.e. synchronization of
|
24
24
|
panes will occur after the commands described in each of the panes
|
25
25
|
have run. At that time, the current behavior will need to be explicitly
|
26
|
-
enabled, using the `synchronize: before` option.
|
26
|
+
enabled, using the `synchronize: before` option. To use this behaviour
|
27
27
|
now, use the 'synchronize: after' option.
|
28
28
|
M
|
29
29
|
PRE_DEP_MSG = <<-M
|
30
|
-
DEPRECATION:
|
30
|
+
DEPRECATION: The `pre` option has been replaced by project hooks and will
|
31
31
|
not be supported anymore.
|
32
32
|
M
|
33
33
|
POST_DEP_MSG = <<-M
|
34
|
-
DEPRECATION:
|
34
|
+
DEPRECATION: The `post` option has been replaced by project hooks and will
|
35
35
|
not be supported anymore.
|
36
36
|
M
|
37
37
|
TMUX_MASTER_DEP_MSG = <<-M
|
data/lib/tmuxinator/version.rb
CHANGED
data/spec/factories/projects.rb
CHANGED
@@ -66,7 +66,7 @@ describe Tmuxinator::Cli do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
context "no deprecations" do
|
69
|
-
let(:project) {
|
69
|
+
let(:project) { FactoryBot.build(:project) }
|
70
70
|
|
71
71
|
it "starts the project" do
|
72
72
|
expect(Kernel).to receive(:exec)
|
@@ -80,6 +80,13 @@ describe Tmuxinator::Cli do
|
|
80
80
|
capture_io { cli.start }
|
81
81
|
end
|
82
82
|
|
83
|
+
it "accepts a project config file flag" do
|
84
|
+
ARGV.replace(["start", "foo", "--project-config=sample.yml"])
|
85
|
+
|
86
|
+
expect(Kernel).to receive(:exec)
|
87
|
+
capture_io { cli.start }
|
88
|
+
end
|
89
|
+
|
83
90
|
it "accepts additional arguments" do
|
84
91
|
ARGV.replace(["start", "foo", "bar", "three=four"])
|
85
92
|
|
@@ -93,7 +100,7 @@ describe Tmuxinator::Cli do
|
|
93
100
|
allow($stdin).to receive_messages(getc: "y")
|
94
101
|
end
|
95
102
|
|
96
|
-
let(:project) {
|
103
|
+
let(:project) { FactoryBot.build(:project_with_deprecations) }
|
97
104
|
|
98
105
|
it "prints the deprecations" do
|
99
106
|
out, _err = capture_io { cli.start }
|
@@ -111,7 +118,7 @@ describe Tmuxinator::Cli do
|
|
111
118
|
end
|
112
119
|
|
113
120
|
context "with project name" do
|
114
|
-
let(:project) {
|
121
|
+
let(:project) { FactoryBot.build(:project) }
|
115
122
|
|
116
123
|
it "stop the project" do
|
117
124
|
expect(Kernel).to receive(:exec)
|
@@ -130,7 +137,7 @@ describe Tmuxinator::Cli do
|
|
130
137
|
allow(Kernel).to receive(:exec)
|
131
138
|
end
|
132
139
|
|
133
|
-
let(:project) {
|
140
|
+
let(:project) { FactoryBot.build(:project) }
|
134
141
|
|
135
142
|
it "starts the project" do
|
136
143
|
expect(Kernel).to receive(:exec)
|
@@ -164,7 +171,7 @@ describe Tmuxinator::Cli do
|
|
164
171
|
end
|
165
172
|
|
166
173
|
context "no deprecations" do
|
167
|
-
let(:project) {
|
174
|
+
let(:project) { FactoryBot.build(:project) }
|
168
175
|
|
169
176
|
it "starts the project" do
|
170
177
|
expect(Kernel).to receive(:exec)
|
@@ -173,6 +180,29 @@ describe Tmuxinator::Cli do
|
|
173
180
|
end
|
174
181
|
end
|
175
182
|
|
183
|
+
describe "#start(with project config flag)" do
|
184
|
+
before do
|
185
|
+
allow(Tmuxinator::Config).to receive_messages(version: 1.9)
|
186
|
+
end
|
187
|
+
|
188
|
+
let(:fixtures_dir) { File.expand_path("../../../fixtures/", __FILE__) }
|
189
|
+
let(:project_config) { File.join(fixtures_dir, "sample.yml") }
|
190
|
+
|
191
|
+
context "no deprecations" do
|
192
|
+
it "doesn't start the project if given a bogus project config" do
|
193
|
+
ARGV.replace(["start", "--project-config=bogus.yml"])
|
194
|
+
expect(Kernel).not_to receive(:exec)
|
195
|
+
expect { capture_io { cli.start } }.to raise_error(SystemExit)
|
196
|
+
end
|
197
|
+
|
198
|
+
it "starts the project if given a project config" do
|
199
|
+
ARGV.replace(["start", "--project-config=#{project_config}"])
|
200
|
+
expect(Kernel).to receive(:exec)
|
201
|
+
capture_io { cli.start }
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
176
206
|
describe "#edit" do
|
177
207
|
let(:file) { StringIO.new }
|
178
208
|
let(:name) { "test" }
|
@@ -364,12 +394,12 @@ describe Tmuxinator::Cli do
|
|
364
394
|
end
|
365
395
|
|
366
396
|
describe "#debug" do
|
367
|
-
let(:project) {
|
397
|
+
let(:project) { FactoryBot.build(:project) }
|
368
398
|
let(:project_with_force_attach) do
|
369
|
-
|
399
|
+
FactoryBot.build(:project_with_force_attach)
|
370
400
|
end
|
371
401
|
let(:project_with_force_detach) do
|
372
|
-
|
402
|
+
FactoryBot.build(:project_with_force_detach)
|
373
403
|
end
|
374
404
|
|
375
405
|
before do
|
@@ -463,8 +493,12 @@ describe Tmuxinator::Cli do
|
|
463
493
|
|
464
494
|
context "only one project exists" do
|
465
495
|
before do
|
466
|
-
allow(Tmuxinator::Config).to receive(:exists?).with("foo") {
|
467
|
-
|
496
|
+
allow(Tmuxinator::Config).to receive(:exists?).with(name: "foo") {
|
497
|
+
true
|
498
|
+
}
|
499
|
+
allow(Tmuxinator::Config).to receive(:exists?).with(name: "bar") {
|
500
|
+
false
|
501
|
+
}
|
468
502
|
end
|
469
503
|
|
470
504
|
it "deletes one project" do
|
@@ -623,11 +657,8 @@ describe Tmuxinator::Cli do
|
|
623
657
|
end
|
624
658
|
|
625
659
|
describe "#create_project" do
|
626
|
-
|
627
|
-
|
628
|
-
expect(subject).to be_a Tmuxinator::Project
|
629
|
-
expect(subject.name).to eq name
|
630
|
-
end
|
660
|
+
before do
|
661
|
+
allow(Tmuxinator::Config).to receive_messages(directory: path)
|
631
662
|
end
|
632
663
|
|
633
664
|
let(:name) { "sample" }
|
@@ -635,6 +666,13 @@ describe Tmuxinator::Cli do
|
|
635
666
|
let(:cli_options) { {} }
|
636
667
|
let(:path) { File.expand_path("../../../fixtures", __FILE__) }
|
637
668
|
|
669
|
+
shared_examples_for :a_proper_project do
|
670
|
+
it "should create a valid project" do
|
671
|
+
expect(subject).to be_a Tmuxinator::Project
|
672
|
+
expect(subject.name).to eq name
|
673
|
+
end
|
674
|
+
end
|
675
|
+
|
638
676
|
context "when creating a traditional named project" do
|
639
677
|
let(:params) do
|
640
678
|
{
|
@@ -644,11 +682,47 @@ describe Tmuxinator::Cli do
|
|
644
682
|
end
|
645
683
|
subject { described_class.new.create_project(params) }
|
646
684
|
|
647
|
-
|
648
|
-
|
685
|
+
it_should_behave_like :a_proper_project
|
686
|
+
end
|
687
|
+
|
688
|
+
context "attach option" do
|
689
|
+
describe "detach" do
|
690
|
+
it "sets force_detach to false when no attach argument is provided" do
|
691
|
+
project = Tmuxinator::Cli.new.create_project(name: name)
|
692
|
+
expect(project.force_detach).to eq(false)
|
693
|
+
end
|
694
|
+
|
695
|
+
it "sets force_detach to true when 'attach: false' is provided" do
|
696
|
+
project = Tmuxinator::Cli.new.create_project(attach: false,
|
697
|
+
name: name)
|
698
|
+
expect(project.force_detach).to eq(true)
|
699
|
+
end
|
700
|
+
|
701
|
+
it "sets force_detach to false when 'attach: true' is provided" do
|
702
|
+
project = Tmuxinator::Cli.new.create_project(attach: true,
|
703
|
+
name: name)
|
704
|
+
expect(project.force_detach).to eq(false)
|
705
|
+
end
|
649
706
|
end
|
650
707
|
|
651
|
-
|
708
|
+
describe "attach" do
|
709
|
+
it "sets force_attach to false when no attach argument is provided" do
|
710
|
+
project = Tmuxinator::Cli.new.create_project(name: name)
|
711
|
+
expect(project.force_attach).to eq(false)
|
712
|
+
end
|
713
|
+
|
714
|
+
it "sets force_attach to true when 'attach: true' is provided" do
|
715
|
+
project = Tmuxinator::Cli.new.create_project(attach: true,
|
716
|
+
name: name)
|
717
|
+
expect(project.force_attach).to eq(true)
|
718
|
+
end
|
719
|
+
|
720
|
+
it "sets force_attach to false when 'attach: false' is provided" do
|
721
|
+
project = Tmuxinator::Cli.new.create_project(attach: false,
|
722
|
+
name: name)
|
723
|
+
expect(project.force_attach).to eq(false)
|
724
|
+
end
|
725
|
+
end
|
652
726
|
end
|
653
727
|
end
|
654
728
|
|
@@ -238,7 +238,7 @@ describe Tmuxinator::Config do
|
|
238
238
|
end
|
239
239
|
|
240
240
|
it "checks if the given project exists" do
|
241
|
-
expect(Tmuxinator::Config.exists?("test")).to be_truthy
|
241
|
+
expect(Tmuxinator::Config.exists?(name: "test")).to be_truthy
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
@@ -329,6 +329,37 @@ describe Tmuxinator::Config do
|
|
329
329
|
describe "#validate" do
|
330
330
|
let(:default) { Tmuxinator::Config::LOCAL_DEFAULT }
|
331
331
|
|
332
|
+
context "when a project config file is provided" do
|
333
|
+
it "should raise if the project config file can't be found" do
|
334
|
+
project_config = "dont-exist.yml"
|
335
|
+
regex = /Project config \(#{project_config}\) doesn't exist\./
|
336
|
+
expect do
|
337
|
+
Tmuxinator::Config.validate(project_config: project_config)
|
338
|
+
end.to raise_error RuntimeError, regex
|
339
|
+
end
|
340
|
+
|
341
|
+
it "should load and validate the project" do
|
342
|
+
project_config = File.join(fixtures_dir, "sample.yml")
|
343
|
+
expect(Tmuxinator::Config.validate(project_config: project_config)).to \
|
344
|
+
be_a Tmuxinator::Project
|
345
|
+
end
|
346
|
+
|
347
|
+
it "should take precedence over a named project" do
|
348
|
+
allow(Tmuxinator::Config).to receive_messages(directory: fixtures_dir)
|
349
|
+
project_config = File.join(fixtures_dir, "sample_number_as_name.yml")
|
350
|
+
project = Tmuxinator::Config.validate(name: "sample",
|
351
|
+
project_config: project_config)
|
352
|
+
expect(project.name).to eq("222")
|
353
|
+
end
|
354
|
+
|
355
|
+
it "should take precedence over a local project" do
|
356
|
+
expect(Tmuxinator::Config).not_to receive(:local?)
|
357
|
+
project_config = File.join(fixtures_dir, "sample_number_as_name.yml")
|
358
|
+
project = Tmuxinator::Config.validate(project_config: project_config)
|
359
|
+
expect(project.name).to eq("222")
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
332
363
|
context "when a project name is provided" do
|
333
364
|
it "should raise if the project file can't be found" do
|
334
365
|
expect do
|
@@ -360,5 +391,17 @@ describe Tmuxinator::Config do
|
|
360
391
|
expect(Tmuxinator::Config.validate).to be_a Tmuxinator::Project
|
361
392
|
end
|
362
393
|
end
|
394
|
+
|
395
|
+
context "when no project can be found" do
|
396
|
+
it "should raise with NO_PROJECT_FOUND_MSG" do
|
397
|
+
config = Tmuxinator::Config
|
398
|
+
expect(config).to receive(:valid_project_config?).and_return(false)
|
399
|
+
expect(config).to receive(:valid_local_project?).and_return(false)
|
400
|
+
expect(config).to receive(:valid_standard_project?).and_return(false)
|
401
|
+
expect do
|
402
|
+
Tmuxinator::Config.validate
|
403
|
+
end.to raise_error RuntimeError, %r{Project could not be found\.}
|
404
|
+
end
|
405
|
+
end
|
363
406
|
end
|
364
407
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
shared_examples_for "a project hook" do
|
4
|
-
let(:project) {
|
4
|
+
let(:project) { FactoryBot.build(:project) }
|
5
5
|
|
6
6
|
it "calls Hooks.commands_from" do
|
7
7
|
expect(Tmuxinator::Hooks).to receive(:commands_from).
|
@@ -33,7 +33,7 @@ shared_examples_for "a project hook" do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe Tmuxinator::Hooks::Project do
|
36
|
-
let(:project) {
|
36
|
+
let(:project) { FactoryBot.build(:project) }
|
37
37
|
|
38
38
|
describe "#hook_on_project_start" do
|
39
39
|
it_should_behave_like "a project hook" do
|
@@ -1,34 +1,34 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Tmuxinator::Project do
|
4
|
-
let(:project) {
|
4
|
+
let(:project) { FactoryBot.build(:project) }
|
5
5
|
let(:project_with_custom_name) do
|
6
|
-
|
6
|
+
FactoryBot.build(:project_with_custom_name)
|
7
7
|
end
|
8
8
|
let(:project_with_number_as_name) do
|
9
|
-
|
9
|
+
FactoryBot.build(:project_with_number_as_name)
|
10
10
|
end
|
11
11
|
let(:project_with_emoji_as_name) do
|
12
|
-
|
12
|
+
FactoryBot.build(:project_with_emoji_as_name)
|
13
13
|
end
|
14
14
|
let(:project_with_literals_as_window_name) do
|
15
|
-
|
15
|
+
FactoryBot.build(:project_with_literals_as_window_name)
|
16
16
|
end
|
17
17
|
let(:project_with_deprecations) do
|
18
|
-
|
18
|
+
FactoryBot.build(:project_with_deprecations)
|
19
19
|
end
|
20
20
|
let(:project_with_force_attach) do
|
21
|
-
|
21
|
+
FactoryBot.build(:project_with_force_attach)
|
22
22
|
end
|
23
23
|
let(:project_with_force_detach) do
|
24
|
-
|
24
|
+
FactoryBot.build(:project_with_force_detach)
|
25
25
|
end
|
26
26
|
|
27
|
-
let(:wemux_project) {
|
28
|
-
let(:noname_project) {
|
29
|
-
let(:noroot_project) {
|
27
|
+
let(:wemux_project) { FactoryBot.build(:wemux_project) }
|
28
|
+
let(:noname_project) { FactoryBot.build(:noname_project) }
|
29
|
+
let(:noroot_project) { FactoryBot.build(:noroot_project) }
|
30
30
|
let(:nameless_window_project) do
|
31
|
-
|
31
|
+
FactoryBot.build(:nameless_window_project)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should include Hooks" do
|
@@ -610,7 +610,7 @@ describe Tmuxinator::Project do
|
|
610
610
|
|
611
611
|
describe "#validate!" do
|
612
612
|
it "should raise if there are no windows defined" do
|
613
|
-
nowindows_project =
|
613
|
+
nowindows_project = FactoryBot.build(:nowindows_project)
|
614
614
|
expect do
|
615
615
|
nowindows_project.validate!
|
616
616
|
end.to raise_error RuntimeError, %r{should.include.some.windows}
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tmuxinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Bargi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubis
|
@@ -122,19 +122,19 @@ dependencies:
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0.7'
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
|
-
name:
|
125
|
+
name: factory_bot
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '4.
|
130
|
+
version: '4.8'
|
131
131
|
type: :development
|
132
132
|
prerelease: false
|
133
133
|
version_requirements: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '4.
|
137
|
+
version: '4.8'
|
138
138
|
- !ruby/object:Gem::Dependency
|
139
139
|
name: pry
|
140
140
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
292
|
version: 1.8.23
|
293
293
|
requirements: []
|
294
294
|
rubyforge_project:
|
295
|
-
rubygems_version: 2.
|
295
|
+
rubygems_version: 2.7.3
|
296
296
|
signing_key:
|
297
297
|
specification_version: 4
|
298
298
|
summary: Create and manage complex tmux sessions easily.
|