sesh 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sesh/cli.rb +1 -5
- data/lib/sesh/tmux_control.rb +14 -6
- data/lib/sesh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58f85d808ef26b90decd533d3ee960e9a6b2b155
|
4
|
+
data.tar.gz: de8a3d1ccb614156e8c6938a72750e7ffd3e28db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71624d8a3a5911255a1d93bfdcf433edce65acea0b146193955ac99eaa57bcc49ab46e5816923a7d076e83f8c175353e4b10baf74402c06f812ab7ee9e482675
|
7
|
+
data.tar.gz: a9450662b2e2fd435bccc20d4635eb5cb9e301b56169e1b7140f7371116e9198986e12c3d3d46a60106ed104829b719a9e8ae6244c88f88afa1f3f46938e020b
|
data/Gemfile.lock
CHANGED
data/lib/sesh/cli.rb
CHANGED
@@ -179,11 +179,7 @@ module Sesh
|
|
179
179
|
Logger.fatal "Sesh project '#{@options[:project]}' does not exist yet!"
|
180
180
|
end
|
181
181
|
when 'list'
|
182
|
-
|
183
|
-
ps aux | grep tmux | grep "sesh begin" | grep -v "[g]rep" \
|
184
|
-
| sed -e "s/.*\\/tmp\\/\\(.*\\)\\.sock.*/\\1/"
|
185
|
-
BASH
|
186
|
-
running_projects = output.split("\n")
|
182
|
+
running_projects = TmuxControl.get_running_projects
|
187
183
|
pcount = running_projects.count
|
188
184
|
if pcount > 0
|
189
185
|
Logger.success "#{pcount} project#{pcount>1 ? 's':''} currently running:"
|
data/lib/sesh/tmux_control.rb
CHANGED
@@ -7,12 +7,21 @@ module Sesh
|
|
7
7
|
@options = DEFAULT_OPTIONS[:tmux].merge(options)
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def self.get_running_projects
|
11
|
+
output = Sesh.format_and_run_command <<-BASH
|
12
|
+
ps aux | grep tmux | grep "sesh begin" | grep -v "[g]rep" \
|
13
|
+
| sed -e "s/.*\\/tmp\\/\\(.*\\)\\.sock.*/\\1/"
|
14
|
+
BASH
|
15
|
+
output.split("\n")
|
16
|
+
end
|
17
|
+
def already_running?; self.class.get_running_projects.include? @project end
|
18
|
+
# `ps aux | grep "#{project_name_matcher}"`.strip.length > 0 end
|
12
19
|
|
13
20
|
def project_name_matcher
|
14
|
-
|
15
|
-
|
21
|
+
"[t]mux.*[t]mp\\/#{Regexp.escape(@options[:socket_file].split('/')[2..-1].join('/'))}.*"
|
22
|
+
end
|
23
|
+
# pn = @project.gsub '-', '\-'
|
24
|
+
# "[t]mux.*[#{pn[0]}]#{pn[1..-1]}" end
|
16
25
|
|
17
26
|
def issue_start_command!
|
18
27
|
# Add bundle exec to the sesh begin command for dev purposes.
|
@@ -66,8 +75,7 @@ module Sesh
|
|
66
75
|
Logger.fatal "Sesh project '#{@project}' is not running!" end
|
67
76
|
Logger.info "Stopping Sesh project '#{@project}'..."
|
68
77
|
kill_running_processes
|
69
|
-
issue_stop_command!
|
70
|
-
if $? && Logger.show_progress_until(-> { !already_running? })
|
78
|
+
if issue_stop_command! && Logger.show_progress_until(-> { !already_running? })
|
71
79
|
Logger.success 'Sesh stopped successfully.'
|
72
80
|
puts
|
73
81
|
else Logger.fatal 'Sesh failed to stop after ten seconds!' end
|
data/lib/sesh/version.rb
CHANGED