sesh 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b5f1db52bde7aeb52c772263c225b37bc313853
4
- data.tar.gz: fc33dfa2ff73a5222da0adebabf3b853a1831769
3
+ metadata.gz: 74b3f87282f5252856e6cd89895a40144e9f0ea3
4
+ data.tar.gz: 14c8da3d3a2e8ca8ae0719818ea839ff2393f6cb
5
5
  SHA512:
6
- metadata.gz: 23390a6b2979915e6c802cfd4a2e6b3f98047e57ab08bbbc5d62b9f9d576a3651d421937d9d3051d3feb7978f6101a352440bd1c1397f4bd2380762d0a59d56c
7
- data.tar.gz: eff0a26db44e6ed23c023a8d3f8c428c932f8ef9ae6b9f9442aeda95e6704cdcadab2ee32bfd5ba41c4471e1c0eac49182389a754b8c786d8eeecb3c5f779401
6
+ metadata.gz: 358f35e691af07194d7759c90791fff24810f0ebae616b0450f01191bd9421efd4d34517ed79a2c69d8b95d8b8fd85dc04dada85ccde28cc5493fa48f8d5dea4
7
+ data.tar.gz: c730cb2453dc3225f834507b9c2e13bb2c740833af18f393965738175b909948c16e3170c7029480bbf1bf44b88c26d63fe10a843f86758c0a75d11e7fb4d29a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sesh (0.1.8)
4
+ sesh (0.2.0)
5
5
  awesome_print
6
6
  colorize
7
7
  deep_merge
data/lib/sesh/cli.rb CHANGED
@@ -14,7 +14,6 @@ module Sesh
14
14
  puts HELP_BANNER.blue; exit end
15
15
  parse_options!
16
16
  @tmux_control = TmuxControl.new @options[:project], @options[:tmux]
17
-
18
17
  @ssh_control = SshControl.new @tmux_control, @options[:ssh]
19
18
  handle_command!
20
19
  end
@@ -34,12 +34,21 @@ module Sesh
34
34
  end
35
35
 
36
36
  def issue_stop_command!;
37
- `pkill -f "[t]mux .*#{Regexp.escape(@project)}"` end
37
+ `ps -ef | grep "[t]mux -u attach-session -t #{Regexp.escape(@project)}\\$" | grep -v grep | awk '{print $2}' | xargs kill -9`
38
+ end
38
39
 
39
40
  def connection_command; "tmux -S #{@options[:socket_file]} a" end
40
41
 
41
42
  def obtain_pids_from_session
42
- `tmux -S "#{@options[:socket_file]}" list-panes -s -F "\#{pane_pid} \#{pane_current_command}" | grep -v tmux | awk '{print $1}'`.strip.lines
43
+ tmux_processes =
44
+ `tmux list-panes -s -F "\#{pane_pid} \#{pane_current_command}" -t "#{@project}" 2> /dev/null | grep -v tmux | awk '{print $1}'`.strip.lines +
45
+ `tmux -S "#{@options[:socket_file]}" list-panes -s -F "\#{pane_pid} \#{pane_current_command}" 2> /dev/null | grep -v tmux | awk '{print $1}'`.strip.lines
46
+ return [] unless tmux_processes.any?
47
+ spring_processes = []
48
+ spring_app_pid = `ps -ef | grep "[s]pring app .*| #{@project} |" | grep -v grep | awk '{print $2}'`.strip
49
+ spring_processes += `ps -ef | grep #{spring_app_pid} | grep -v grep | grep -v "[s]pring app" | awk '{print $2}'`.strip.lines if spring_app_pid.length > 0
50
+ spring_processes += `ps -ef | grep "[s]pring.*| #{@project} |" | grep -v grep | awk '{print $2}'`.strip.lines
51
+ spring_processes + tmux_processes
43
52
  end
44
53
  def store_pids_from_session!
45
54
  File.open(@options[:pids_file], 'w') {|f|
@@ -47,12 +56,15 @@ module Sesh
47
56
  end
48
57
 
49
58
  def kill_running_processes
50
- if File.exists? @options[:pids_file]
51
- File.readlines(@options[:pids_file]).each{|pid| kill_process! pid }
52
- File.delete @options[:pids_file]
53
- end
59
+ obtain_pids_from_session.each{|pid| kill_process! pid }
60
+ # if File.exists? @options[:pids_file]
61
+ # File.readlines(@options[:pids_file]).each{|pid|
62
+ # puts "Killing #{pid}"
63
+ # kill_process! pid }
64
+ # File.delete @options[:pids_file]
65
+ # end
54
66
  end
55
- def kill_process!(pid); `kill -9 #{pid}` end
67
+ def kill_process!(pid); `kill -9 #{pid} 2>&1` end
56
68
 
57
69
  def begin_tmuxinator_session!
58
70
  %x[env TMUX='' mux start #{@project}] end
data/lib/sesh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sesh
2
- VERSION = '0.1.8'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sesh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith