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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6587a026202194be3546a45c7e3c5a32c98afc51351634073172c2cb9790a8a6
4
- data.tar.gz: ad1ab050b9659fbd3200aa9dee1b4387861e85179133d6dec7569a1f62d51695
3
+ metadata.gz: fdb588afecf5c7476cef68fdd5c22348d83a64b027d3371d2b74d18edab1a66b
4
+ data.tar.gz: 7babd7dcaa43db5efde616c9b8b4fa3c2cc4325270b7565bea652bd7c4cd63cf
5
5
  SHA512:
6
- metadata.gz: e8f9b85f6be3b04a44fa4f84c54ca6edc4cd6e75fa593c4aeee9af4de1a163fd391288e11694898aae25a88e022700e3d6dba42330c13636f6a2d2db2a65d390
7
- data.tar.gz: 516cbf3516f27cdf4e6e4474d1fd0a6048ad18338db68fabd9a85fb62f5bc66fdb1f4e6d2e1c74d39d8496e31f3408a6185b8f8244a1b092e79b7b22bbb778bb
6
+ metadata.gz: 01011f43c1aa4380d6cd2489518b49e6d46cfbfa57838dfb2f0ff2f93c74250ea51e864130f60a5b7696823d126f9f519dc0f1f268cac17e97418269e81ba077
7
+ data.tar.gz: 689b130644b46a2e49204acb15f4785e313a5bd606c7dc47ad0f7605ba5cf3b35625485eed884f6e6720c713ef46a936cee68c627718e9ad412b53cf156e40ab
data/lib/tmuxinator.rb CHANGED
@@ -20,7 +20,8 @@ module Tmuxinator
20
20
  2.4,
21
21
  2.5,
22
22
  2.6,
23
- 2.7
23
+ 2.7,
24
+ 2.8
24
25
  ].freeze
25
26
  end
26
27
 
@@ -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
- desc "debug [PROJECT] [ARGS]", COMMANDS[:debug]
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
- name: name,
269
- custom_name: options[:name],
284
+ args: args,
270
285
  attach: options[:attach],
271
- args: args
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
@@ -1,3 +1,3 @@
1
1
  module Tmuxinator
2
- VERSION = "0.12.0".freeze
2
+ VERSION = "0.13.0".freeze
3
3
  end
@@ -0,0 +1,4 @@
1
+ # ~/.tmuxinator/sample-with-project-config.yml
2
+ name: sample_with_project_config
3
+ windows:
4
+ - editor: echo sample-with-project-config
@@ -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 flag)" do
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 "doesn't start the project if given a bogus project config" do
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 "starts the project if given a project config" do
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(Kernel).to receive(:exec)
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
- let(:project) { FactoryBot.build(:project) }
542
- let(:project_with_force_attach) do
543
- FactoryBot.build(:project_with_force_attach)
544
- end
545
- let(:project_with_force_detach) do
546
- FactoryBot.build(:project_with_force_detach)
547
- end
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
- before do
550
- allow(Tmuxinator::Config).to receive_messages(validate: project)
551
- expect(project).to receive(:render)
552
- end
562
+ before do
563
+ allow(Tmuxinator::Config).to receive_messages(validate: project)
564
+ expect(project).to receive(:render)
565
+ end
553
566
 
554
- it "renders the project" do
555
- ARGV.replace(["debug", "foo"])
556
- capture_io { cli.start }
557
- end
567
+ it "renders the project" do
568
+ ARGV.replace(["debug", "foo"])
569
+ capture_io { cli.start }
570
+ end
558
571
 
559
- it "force attach renders the project with attach code" do
560
- ARGV.replace(["debug", "--attach=true", "sample"])
561
- capture_io { cli.start }
562
- # Currently no project is rendered at all,
563
- # because the project file is not found
564
- # expect(out).to include "attach-session"
565
- end
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
- it "force detach renders the project without attach code" do
568
- ARGV.replace(["debug", "--attach=false", "sample"])
569
- capture_io { cli.start }
570
- # Currently no project is rendered at all
571
- # expect(out).to_not include "attach-session"
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
- it "renders the project with custom session" do
575
- ARGV.replace(["debug", "sample", "bar"])
576
- capture_io { cli.start }
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.12.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-07-03 00:00:00.000000000 Z
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