tmuxinator 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tmuxinator.rb +2 -1
- data/lib/tmuxinator/cli.rb +23 -5
- data/lib/tmuxinator/version.rb +1 -1
- data/spec/fixtures/sample_with_project_config.yml +4 -0
- data/spec/lib/tmuxinator/cli_spec.rb +76 -45
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdb588afecf5c7476cef68fdd5c22348d83a64b027d3371d2b74d18edab1a66b
|
4
|
+
data.tar.gz: 7babd7dcaa43db5efde616c9b8b4fa3c2cc4325270b7565bea652bd7c4cd63cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01011f43c1aa4380d6cd2489518b49e6d46cfbfa57838dfb2f0ff2f93c74250ea51e864130f60a5b7696823d126f9f519dc0f1f268cac17e97418269e81ba077
|
7
|
+
data.tar.gz: 689b130644b46a2e49204acb15f4785e313a5bd606c7dc47ad0f7605ba5cf3b35625485eed884f6e6720c713ef46a936cee68c627718e9ad412b53cf156e40ab
|
data/lib/tmuxinator.rb
CHANGED
data/lib/tmuxinator/cli.rb
CHANGED
@@ -226,6 +226,13 @@ module Tmuxinator
|
|
226
226
|
desc: "Path to project config file"
|
227
227
|
|
228
228
|
def start(name = nil, *args)
|
229
|
+
# project-config takes precedence over a named project in the case that
|
230
|
+
# both are provided.
|
231
|
+
if options["project-config"]
|
232
|
+
args.unshift name if name
|
233
|
+
name = nil
|
234
|
+
end
|
235
|
+
|
229
236
|
params = {
|
230
237
|
args: args,
|
231
238
|
attach: options[:attach],
|
@@ -256,20 +263,31 @@ module Tmuxinator
|
|
256
263
|
render_project(create_project(attach: options[:attach]))
|
257
264
|
end
|
258
265
|
|
266
|
+
desc "debug [PROJECT] [ARGS]", COMMANDS[:debug]
|
259
267
|
method_option :attach, type: :boolean,
|
260
268
|
aliases: "-a",
|
261
269
|
desc: "Attach to tmux session after creation."
|
262
270
|
method_option :name, aliases: "-n",
|
263
271
|
desc: "Give the session a different name"
|
264
|
-
|
272
|
+
method_option "project-config", aliases: "-p",
|
273
|
+
desc: "Path to project config file"
|
274
|
+
|
275
|
+
def debug(name = nil, *args)
|
276
|
+
# project-config takes precedence over a named project in the case that
|
277
|
+
# both are provided.
|
278
|
+
if options["project-config"]
|
279
|
+
args.unshift name if name
|
280
|
+
name = nil
|
281
|
+
end
|
265
282
|
|
266
|
-
def debug(name, *args)
|
267
283
|
params = {
|
268
|
-
|
269
|
-
custom_name: options[:name],
|
284
|
+
args: args,
|
270
285
|
attach: options[:attach],
|
271
|
-
|
286
|
+
custom_name: options[:name],
|
287
|
+
name: name,
|
288
|
+
project_config: options["project-config"]
|
272
289
|
}
|
290
|
+
|
273
291
|
project = create_project(params)
|
274
292
|
say project.render
|
275
293
|
end
|
data/lib/tmuxinator/version.rb
CHANGED
@@ -23,7 +23,13 @@ describe Tmuxinator::Cli do
|
|
23
23
|
File.delete(local_project_path)
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
26
27
|
let(:cli) { Tmuxinator::Cli }
|
28
|
+
let(:fixtures_dir) { File.expand_path("../../../fixtures/", __FILE__) }
|
29
|
+
let(:project) { FactoryBot.build(:project) }
|
30
|
+
let(:project_config) do
|
31
|
+
File.join(fixtures_dir, "sample_with_project_config.yml")
|
32
|
+
end
|
27
33
|
|
28
34
|
before do
|
29
35
|
ARGV.clear
|
@@ -210,8 +216,6 @@ describe Tmuxinator::Cli do
|
|
210
216
|
end
|
211
217
|
|
212
218
|
context "no deprecations" do
|
213
|
-
let(:project) { FactoryBot.build(:project) }
|
214
|
-
|
215
219
|
it "starts the project" do
|
216
220
|
expect(Kernel).to receive(:exec)
|
217
221
|
capture_io { cli.start }
|
@@ -262,8 +266,6 @@ describe Tmuxinator::Cli do
|
|
262
266
|
end
|
263
267
|
|
264
268
|
context "with project name" do
|
265
|
-
let(:project) { FactoryBot.build(:project) }
|
266
|
-
|
267
269
|
it "stop the project" do
|
268
270
|
expect(Kernel).to receive(:exec)
|
269
271
|
out, err = capture_io { cli.start }
|
@@ -281,8 +283,6 @@ describe Tmuxinator::Cli do
|
|
281
283
|
allow(Kernel).to receive(:exec)
|
282
284
|
end
|
283
285
|
|
284
|
-
let(:project) { FactoryBot.build(:project) }
|
285
|
-
|
286
286
|
it "starts the project" do
|
287
287
|
expect(Kernel).to receive(:exec)
|
288
288
|
out, err = capture_io { cli.start }
|
@@ -315,8 +315,6 @@ describe Tmuxinator::Cli do
|
|
315
315
|
end
|
316
316
|
|
317
317
|
context "no deprecations" do
|
318
|
-
let(:project) { FactoryBot.build(:project) }
|
319
|
-
|
320
318
|
it "starts the project" do
|
321
319
|
expect(Kernel).to receive(:exec)
|
322
320
|
capture_io { cli.start }
|
@@ -324,24 +322,39 @@ describe Tmuxinator::Cli do
|
|
324
322
|
end
|
325
323
|
end
|
326
324
|
|
327
|
-
describe "#start(with project config
|
325
|
+
describe "#start(with project config file)" do
|
328
326
|
before do
|
327
|
+
allow(Tmuxinator::Config).to receive(:validate).and_call_original
|
329
328
|
allow(Tmuxinator::Config).to receive_messages(version: 1.9)
|
329
|
+
allow(Kernel).to receive(:exec)
|
330
330
|
end
|
331
331
|
|
332
|
-
let(:fixtures_dir) { File.expand_path("../../../fixtures/", __FILE__) }
|
333
|
-
let(:project_config) { File.join(fixtures_dir, "sample.yml") }
|
334
|
-
|
335
332
|
context "no deprecations" do
|
336
|
-
it "
|
333
|
+
it "starts the project if given a valid project config file" do
|
334
|
+
ARGV.replace(["start", "--project-config=#{project_config}"])
|
335
|
+
expect(Kernel).to receive(:exec)
|
336
|
+
capture_io { cli.start }
|
337
|
+
end
|
338
|
+
|
339
|
+
it "does not start the project if given a bogus project config file" do
|
337
340
|
ARGV.replace(["start", "--project-config=bogus.yml"])
|
338
341
|
expect(Kernel).not_to receive(:exec)
|
339
342
|
expect { capture_io { cli.start } }.to raise_error(SystemExit)
|
340
343
|
end
|
341
344
|
|
342
|
-
it "
|
345
|
+
it "passes additional arguments through" do
|
346
|
+
ARGV.replace(["start", "--project-config=#{project_config}", "extra"])
|
347
|
+
expect(Tmuxinator::Config).
|
348
|
+
to(receive(:validate).
|
349
|
+
with(hash_including(args: array_including("extra"))))
|
350
|
+
capture_io { cli.start }
|
351
|
+
end
|
352
|
+
|
353
|
+
it "does not set the project name" do
|
343
354
|
ARGV.replace(["start", "--project-config=#{project_config}"])
|
344
|
-
expect(
|
355
|
+
expect(Tmuxinator::Config).
|
356
|
+
to(receive(:validate).
|
357
|
+
with(hash_including(name: nil)))
|
345
358
|
capture_io { cli.start }
|
346
359
|
end
|
347
360
|
end
|
@@ -538,42 +551,60 @@ describe Tmuxinator::Cli do
|
|
538
551
|
end
|
539
552
|
|
540
553
|
describe "#debug" do
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
554
|
+
context "named project" do
|
555
|
+
let(:project_with_force_attach) do
|
556
|
+
FactoryBot.build(:project_with_force_attach)
|
557
|
+
end
|
558
|
+
let(:project_with_force_detach) do
|
559
|
+
FactoryBot.build(:project_with_force_detach)
|
560
|
+
end
|
548
561
|
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
562
|
+
before do
|
563
|
+
allow(Tmuxinator::Config).to receive_messages(validate: project)
|
564
|
+
expect(project).to receive(:render)
|
565
|
+
end
|
553
566
|
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
567
|
+
it "renders the project" do
|
568
|
+
ARGV.replace(["debug", "foo"])
|
569
|
+
capture_io { cli.start }
|
570
|
+
end
|
558
571
|
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
572
|
+
it "force attach renders the project with attach code" do
|
573
|
+
ARGV.replace(["debug", "--attach=true", "sample"])
|
574
|
+
capture_io { cli.start }
|
575
|
+
# Currently no project is rendered at all,
|
576
|
+
# because the project file is not found
|
577
|
+
# expect(out).to include "attach-session"
|
578
|
+
end
|
566
579
|
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
580
|
+
it "force detach renders the project without attach code" do
|
581
|
+
ARGV.replace(["debug", "--attach=false", "sample"])
|
582
|
+
capture_io { cli.start }
|
583
|
+
# Currently no project is rendered at all
|
584
|
+
# expect(out).to_not include "attach-session"
|
585
|
+
end
|
586
|
+
|
587
|
+
it "renders the project with custom session" do
|
588
|
+
ARGV.replace(["debug", "sample", "bar"])
|
589
|
+
capture_io { cli.start }
|
590
|
+
end
|
572
591
|
end
|
573
592
|
|
574
|
-
|
575
|
-
|
576
|
-
|
593
|
+
context "project config file" do
|
594
|
+
before do
|
595
|
+
allow(Tmuxinator::Config).to receive_messages(version: 1.9)
|
596
|
+
expect(Tmuxinator::Config).to receive(:validate).and_call_original
|
597
|
+
end
|
598
|
+
|
599
|
+
it "renders the project if given a valid project config file" do
|
600
|
+
ARGV.replace(["debug", "--project-config=#{project_config}"])
|
601
|
+
expect { cli.start }.to output(/sample_with_project_config/).to_stdout
|
602
|
+
end
|
603
|
+
|
604
|
+
it "does not render the project if given a bogus project config file" do
|
605
|
+
ARGV.replace(["start", "--project-config=bogus.yml"])
|
606
|
+
expect { capture_io { cli.start } }.to raise_error(SystemExit)
|
607
|
+
end
|
577
608
|
end
|
578
609
|
end
|
579
610
|
|
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.13.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: 2018-
|
12
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubis
|
@@ -254,6 +254,7 @@ files:
|
|
254
254
|
- spec/fixtures/sample_literals_as_window_name.yml
|
255
255
|
- spec/fixtures/sample_number_as_name.yml
|
256
256
|
- spec/fixtures/sample_wemux.yml
|
257
|
+
- spec/fixtures/sample_with_project_config.yml
|
257
258
|
- spec/fixtures/xdg-tmuxinator/both.yml
|
258
259
|
- spec/fixtures/xdg-tmuxinator/xdg.yml
|
259
260
|
- spec/lib/tmuxinator/cli_spec.rb
|
@@ -316,6 +317,7 @@ test_files:
|
|
316
317
|
- spec/fixtures/sample_literals_as_window_name.yml
|
317
318
|
- spec/fixtures/sample_number_as_name.yml
|
318
319
|
- spec/fixtures/sample_wemux.yml
|
320
|
+
- spec/fixtures/sample_with_project_config.yml
|
319
321
|
- spec/fixtures/xdg-tmuxinator/both.yml
|
320
322
|
- spec/fixtures/xdg-tmuxinator/xdg.yml
|
321
323
|
- spec/lib/tmuxinator/cli_spec.rb
|