Class: Pair::Session::HostedSession
- Inherits:
-
Pair::Session
- Object
- Pair::Session
- Pair::Session::HostedSession
- Defined in:
- lib/pair/session/hosted_session.rb
Instance Attribute Summary collapse
-
#authorized_keys_file ⇒ Object
readonly
Returns the value of attribute authorized_keys_file.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#tmux ⇒ Object
readonly
Returns the value of attribute tmux.
-
#tunnel ⇒ Object
readonly
Returns the value of attribute tunnel.
Attributes inherited from Pair::Session
#host, #name, #options, #participants, #viewers
Instance Method Summary collapse
- #bastion ⇒ Object
- #cleanup_authorized_keys ⇒ Object
-
#connect_command ⇒ Object
TODO: this should get host/user from response.
- #display_startup_message ⇒ Object
- #host_login ⇒ Object
-
#initialize(options = {}) ⇒ HostedSession
constructor
A new instance of HostedSession.
- #start! ⇒ Object
Methods inherited from Pair::Session
Constructor Details
#initialize(options = {}) ⇒ HostedSession
Returns a new instance of HostedSession.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pair/session/hosted_session.rb', line 7 def initialize( = {}) puts "Hosting session #{"called #{[:name].inspect} " if [:name]}..." self.name = .delete(:name) self.viewers = .delete(:viewers) || [] self.participants = .delete(:participants) || [] self.tmux = Tmux.new(self) super() end |
Instance Attribute Details
#authorized_keys_file ⇒ Object
Returns the value of attribute authorized_keys_file.
4 5 6 |
# File 'lib/pair/session/hosted_session.rb', line 4 def @authorized_keys_file end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/pair/session/hosted_session.rb', line 4 def response @response end |
#tmux ⇒ Object
Returns the value of attribute tmux.
4 5 6 |
# File 'lib/pair/session/hosted_session.rb', line 4 def tmux @tmux end |
#tunnel ⇒ Object
Returns the value of attribute tunnel.
4 5 6 |
# File 'lib/pair/session/hosted_session.rb', line 4 def tunnel @tunnel end |
Instance Method Details
#bastion ⇒ Object
50 51 52 |
# File 'lib/pair/session/hosted_session.rb', line 50 def bastion response["tunnel"]["bastion"] end |
#cleanup_authorized_keys ⇒ Object
58 59 60 |
# File 'lib/pair/session/hosted_session.rb', line 58 def .cleanup end |
#connect_command ⇒ Object
TODO: this should get host/user from response
46 47 48 |
# File 'lib/pair/session/hosted_session.rb', line 46 def connect_command "ssh-add; ssh -tqA -l#{bastion["join_user"]} #{bastion["host"]} #{name}" end |
#display_startup_message ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/pair/session/hosted_session.rb', line 35 def puts "Your pairs can connect to this session using the following command:" puts "" puts " #{connect_command}" puts "" print "Press any key to continue..." gets end |
#host_login ⇒ Object
54 55 56 |
# File 'lib/pair/session/hosted_session.rb', line 54 def host_login `whoami`.chomp end |
#start! ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pair/session/hosted_session.rb', line 18 def start! if setup tunnel.open do tmux.start tmux.attach end else puts "There was a problem starting the host session %s" % (name && name.inspect) puts "response: #{response.inspect}" if response && $-d puts "" end exit end |