sesh 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: 519e114e15fb6c5fea66d92a8a696ce80308ff4c
4
- data.tar.gz: fe5045bde290d181b8d8d395b721914a7fd87b17
3
+ metadata.gz: 58f85d808ef26b90decd533d3ee960e9a6b2b155
4
+ data.tar.gz: de8a3d1ccb614156e8c6938a72750e7ffd3e28db
5
5
  SHA512:
6
- metadata.gz: c8ea6c0cf3cf02d4b642bd7cfcd950f990cadafd973f30a02e530c419f038eb12566edd79b69c254608a26d3bf1345ae7c2f17ebf3a6397c5c4fd7e33cca0fa1
7
- data.tar.gz: 205abe6b579f35abc141abd18b377698914125d3a6ce6758aab73c9e47c5d3da5697ef83cfc834848171369abd5c27854d69e9772926f00c908d4104c3df6514
6
+ metadata.gz: 71624d8a3a5911255a1d93bfdcf433edce65acea0b146193955ac99eaa57bcc49ab46e5816923a7d076e83f8c175353e4b10baf74402c06f812ab7ee9e482675
7
+ data.tar.gz: a9450662b2e2fd435bccc20d4635eb5cb9e301b56169e1b7140f7371116e9198986e12c3d3d46a60106ed104829b719a9e8ae6244c88f88afa1f3f46938e020b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sesh (0.1.5)
4
+ sesh (0.1.6)
5
5
  awesome_print
6
6
  colorize
7
7
  deep_merge
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
- output = Sesh.format_and_run_command <<-BASH
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:"
@@ -7,12 +7,21 @@ module Sesh
7
7
  @options = DEFAULT_OPTIONS[:tmux].merge(options)
8
8
  end
9
9
 
10
- def already_running?
11
- `ps aux | grep "#{project_name_matcher}"`.strip.length > 0 end
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
- pn = @project.gsub '-', '\-'
15
- "[t]mux.*[#{pn[0]}]#{pn[1..-1]}" end
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
@@ -1,3 +1,3 @@
1
1
  module Sesh
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith