sesh 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sesh +20 -20
  3. data/lib/sesh/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fd10e81833893c22f4e8f1e193c87a35c543ccc
4
- data.tar.gz: cb2ec3a8c2b981fbb82827ea26bc62ecc126dad3
3
+ metadata.gz: 2f875d6884e48fd74d94b5874863ec94dfd556b0
4
+ data.tar.gz: d335a739f08b80202674a8f498ebd77df104d0e0
5
5
  SHA512:
6
- metadata.gz: cc2a7c81fee985c1fd214a649bcf1e9dc51820bc2ec44a312d8fe2d0c6ec382620159b8cd0a351ba754092d9d86a117659ebdb40759125e09e3163dd67723536
7
- data.tar.gz: 1ce39728bbb8f33bac01ffb09122f3ef6f8c981a78278cdd7f4d64968d43e5eeb7835d78e059b4f17d228b67b1e02959554435f28d4410447f9ae61a20b8f8f6
6
+ metadata.gz: 43d497088162f613abafb305bf4c2f2b4d84118b3860c67e5c9e314105e6e7a8e239e100e3fd70e4b7d4915ce7bb1a5818ae4e03da288a202973473827cd450a
7
+ data.tar.gz: 91cba2d50854c5bed3ac149ff3af1cf7e7b45c982157fe55ac0193e28f7c3637ef28e1272ff1a7fa1b47a452a4a4fad94613a0af11f147e1e9f526c8181c8005
data/bin/sesh CHANGED
@@ -9,12 +9,12 @@ Usage: #{File.basename $0} command [project]
9
9
 
10
10
  Commands:
11
11
 
12
- sesh new Create a new tmuxinator configuration.
13
- sesh start [project] Start a Sesh session for a project.
14
- sesh stop [project] Stop a Sesh session for a project.
15
- sesh list List running Sesh sessions on this machine.
16
- sesh connect [project] user@host Connect as a slave to a remote Sesh session.
17
- sesh enslave [project] user@host Connect a slave to a local Sesh session.
12
+ sesh new Create a new tmuxinator configuration.
13
+ sesh start [project] Start a Sesh session for a project.
14
+ sesh stop [project] Stop a Sesh session for a project.
15
+ sesh list List running Sesh sessions on this machine.
16
+ sesh enslave [project] user@host Connect a slave to a local Sesh session.
17
+ sesh connect [project] [user@host] Connect as a slave to a Sesh session.
18
18
 
19
19
  Leave project blank to use the name of your current directory.
20
20
 
@@ -29,31 +29,29 @@ def debug(msg) $stderr.puts "> #{msg}" end
29
29
  @options = ARGV[1..-1] || []
30
30
  # debug("Options received: #{@options}") if @options.any?
31
31
 
32
- def is_tmuxinator_project?(name)
33
- path = File.expand_path("~/.tmuxinator/#{name}.yml")
34
- File.exist? path
32
+ def get_local_username
33
+ `echo $USER`.strip
35
34
  end
35
+ def get_local_hostname
36
+ `scutil --get LocalHostName`.strip.downcase + '.local'
37
+ end
38
+ @local_ssh_addr = "#{get_local_username}@#{get_local_hostname}"
36
39
 
37
40
  def get_project_name
38
41
  return if @command == 'list'
39
42
  new_project = @command == 'new'
43
+ remote_project = @command == 'connect' && @options.select{|o| o.include? '@' }.any?
40
44
  if @options.any? && !@options[0].include?('@')
41
- return @options.shift if new_project || is_tmuxinator_project?(@options[0])
45
+ return @options.shift if new_project || remote_project ||
46
+ Tmuxinator::Config.exists?(@options[0])
42
47
  end
43
48
  output = `printf '%q\n' "${PWD##*/}"`.strip
44
- return output if new_project || is_tmuxinator_project?(output)
49
+ return output if new_project || Tmuxinator::Config.exists?(output)
45
50
  puts "Sesh project '#{output}' could not be found."
46
51
  fatal "Hint: run sesh new or specify an existing project after your commmand."
47
52
  end
48
53
  @project_name = get_project_name
49
54
 
50
- def get_local_username
51
- `echo $USER`.strip
52
- end
53
- def get_local_hostname
54
- `scutil --get LocalHostName`.strip.downcase + '.local'
55
- end
56
- @local_ssh_addr = "#{get_local_username}@#{get_local_hostname}"
57
55
 
58
56
  @socket = "/tmp/#{@project_name}.sock"
59
57
 
@@ -204,10 +202,12 @@ if @command
204
202
  fatal("Sesh project '#{@project_name}' is not running!") unless already_running?
205
203
  fatal("You must specify a machine to enslave! Eg: user@ip") if @remote_address.nil?
206
204
  debug "Attempting to connect #{@remote_address} to Sesh project '#{@project_name}'..."
207
- # ssh #{@remote_address} "#{enter_slave_mode_command.gsub(/([^\\])"/, '\1\\"')}"
205
+ # ssh #{@remote_address} "#{enter_slave_mode_command.gsub(/([^\\])"/, '\1\\"')}"
206
+ # puts <<-BASH
208
207
  output = format_and_run_command <<-BASH
209
- #{enter_slave_mode_command} | ssh -T #{@remote_address} 1>/dev/null 2>&1 &
208
+ ssh #{@remote_address} "sesh connect #{@project_name} #{@local_ssh_addr}"
210
209
  BASH
210
+ # 1>/dev/null 2>&1 &
211
211
  puts output
212
212
  if $?
213
213
  debug "Sesh client connected successfully."
data/lib/sesh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sesh
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.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.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith