sesh 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sesh +20 -20
- 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: 2f875d6884e48fd74d94b5874863ec94dfd556b0
|
4
|
+
data.tar.gz: d335a739f08b80202674a8f498ebd77df104d0e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
13
|
-
sesh start [project]
|
14
|
-
sesh stop [project]
|
15
|
-
sesh list
|
16
|
-
sesh
|
17
|
-
sesh
|
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
|
33
|
-
|
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 ||
|
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 ||
|
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
|
-
|
205
|
+
# ssh #{@remote_address} "#{enter_slave_mode_command.gsub(/([^\\])"/, '\1\\"')}"
|
206
|
+
# puts <<-BASH
|
208
207
|
output = format_and_run_command <<-BASH
|
209
|
-
#{
|
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