hiiro 0.1.152 → 0.1.153

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: ca8a2bc3e8f629e23986cd1f75bdcca6fc2cd0aaabf85fbde2ae00e721077178
4
- data.tar.gz: 1bfc80f8f3f0844bbc943c23f48258577f7d3b7cea66dd48319893e7f3289aa7
3
+ metadata.gz: b270bade909acb9e7805983022b54951c14048c9964f758a011448400cc8e492
4
+ data.tar.gz: 5045f0d977f5113886e6c35d8288a5eb9ca697a24f529a097ff9f61ceda70e62
5
5
  SHA512:
6
- metadata.gz: 05dfbdf2fdef32ec3471b8f26efefc26f07b171b0886c6f9beb55ea7008218165cc126f762cd1ef5e391511815b42eb479aa0dcdff9cc5831b885a8c4ea15b52
7
- data.tar.gz: b9645c6341b3cf753d209b7fcac576264788156a646042a5601d4e4f1269478fd87ab8d93024448ad2ce8eb410d01cd7cd410c26d20f0ebd71007967f6f6a028
6
+ metadata.gz: 9ea8d52d648ab2cf4d79d7a35a1877a53e7bff26fab0ece31d0d4b3b46172b04aeadef115395bd154f60bfc418acdfd8b0b7bdca20cb6affc499751ba8bb8687
7
+ data.tar.gz: 2ff7f43419014b05dab1e12c15200eb612c81966bc9611b47b88f6127aad8ceafd423514a70f1f876600d590be41646ca675fc15e8d78a8c70a43e2c92498112
@@ -248,7 +248,7 @@ class Hiiro
248
248
  session = tmux_info[:session] || current_tmux_session
249
249
 
250
250
  # Write start commands to an executable tempfile
251
- script = write_start_script(svc_name, start_cmds, base_dir)
251
+ script = write_start_script(svc_name, start_cmds)
252
252
 
253
253
  if session && !skip_window_creation
254
254
  # Create a new tmux window for this service
@@ -265,6 +265,8 @@ class Hiiro
265
265
 
266
266
  if pane_id
267
267
  system('tmux', 'send-keys', '-t', pane_id, script, 'Enter')
268
+ elsif base_dir
269
+ system("cd #{base_dir} && #{script} &")
268
270
  else
269
271
  system("#{script} &")
270
272
  end
@@ -469,8 +471,13 @@ class Hiiro
469
471
 
470
472
  h.add_subcmd(:start) do |svc_name=nil, *extra_args|
471
473
  unless svc_name
472
- puts "Usage: service start <name> [--use VAR=variation ...]"
473
- next
474
+ all = sm.services.keys
475
+ if all.empty?
476
+ puts "No services configured"
477
+ next
478
+ end
479
+ svc_name = h.fuzzyfind(all)
480
+ next unless svc_name
474
481
  end
475
482
 
476
483
  # Parse --use flags from extra_args
@@ -513,8 +520,13 @@ class Hiiro
513
520
 
514
521
  h.add_subcmd(:stop) do |svc_name=nil|
515
522
  unless svc_name
516
- puts "Usage: service stop <name>"
517
- next
523
+ running = sm.running_services.keys
524
+ if running.empty?
525
+ puts "No running services"
526
+ next
527
+ end
528
+ svc_name = h.fuzzyfind(running)
529
+ next unless svc_name
518
530
  end
519
531
 
520
532
  sm.stop(svc_name)
@@ -522,8 +534,13 @@ class Hiiro
522
534
 
523
535
  h.add_subcmd(:reset) do |svc_name=nil|
524
536
  unless svc_name
525
- puts "Usage: service reset <name>"
526
- next
537
+ running = sm.running_services.keys
538
+ if running.empty?
539
+ puts "No running services"
540
+ next
541
+ end
542
+ svc_name = h.fuzzyfind(running)
543
+ next unless svc_name
527
544
  end
528
545
 
529
546
  sm.reset(svc_name)
@@ -535,8 +552,13 @@ class Hiiro
535
552
 
536
553
  h.add_subcmd(:attach) do |svc_name=nil|
537
554
  unless svc_name
538
- puts "Usage: service attach <name>"
539
- next
555
+ running = sm.running_services.keys
556
+ if running.empty?
557
+ puts "No running services"
558
+ next
559
+ end
560
+ svc_name = h.fuzzyfind(running)
561
+ next unless svc_name
540
562
  end
541
563
 
542
564
  sm.attach(svc_name)
@@ -586,8 +608,13 @@ class Hiiro
586
608
 
587
609
  h.add_subcmd(:status) do |svc_name=nil|
588
610
  unless svc_name
589
- puts "Usage: service status <name>"
590
- next
611
+ running = sm.running_services.keys
612
+ if running.empty?
613
+ puts "No running services"
614
+ next
615
+ end
616
+ svc_name = h.fuzzyfind(running)
617
+ next unless svc_name
591
618
  end
592
619
 
593
620
  sm.status(svc_name)
@@ -710,13 +737,12 @@ class Hiiro
710
737
  !system('tmux', 'has-session', '-t', pane_id, [:out, :err] => '/dev/null')
711
738
  end
712
739
 
713
- def write_start_script(svc_name, cmds, base_dir)
740
+ def write_start_script(svc_name, cmds)
714
741
  dir = File.join(STATE_DIR, 'scripts')
715
742
  FileUtils.mkdir_p(dir)
716
743
  path = File.join(dir, "#{svc_name}.sh")
717
744
 
718
745
  lines = ["#!/usr/bin/env bash", "set -e"]
719
- lines << "cd #{base_dir}" if base_dir
720
746
  lines.concat(cmds)
721
747
 
722
748
  File.write(path, lines.join("\n") + "\n")
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.152"
2
+ VERSION = "0.1.153"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.152
4
+ version: 0.1.153
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota