Class: Wemux::Pair::PairConnection
- Inherits:
-
Object
- Object
- Wemux::Pair::PairConnection
- Defined in:
- lib/wemux/pair/pair_connection.rb
Instance Attribute Summary collapse
-
#tunnel ⇒ Object
readonly
Returns the value of attribute tunnel.
Instance Method Summary collapse
- #client_port ⇒ Object
- #connect ⇒ Object
-
#initialize(tunnel) ⇒ PairConnection
constructor
A new instance of PairConnection.
- #port_offset ⇒ Object
- #rails_server_port ⇒ Object
- #ssh_options ⇒ Object
Constructor Details
#initialize(tunnel) ⇒ PairConnection
Returns a new instance of PairConnection.
5 6 7 |
# File 'lib/wemux/pair/pair_connection.rb', line 5 def initialize(tunnel) @tunnel = tunnel end |
Instance Attribute Details
#tunnel ⇒ Object (readonly)
Returns the value of attribute tunnel.
4 5 6 |
# File 'lib/wemux/pair/pair_connection.rb', line 4 def tunnel @tunnel end |
Instance Method Details
#client_port ⇒ Object
13 14 15 |
# File 'lib/wemux/pair/pair_connection.rb', line 13 def client_port tunnel.client_port end |
#connect ⇒ Object
28 29 30 |
# File 'lib/wemux/pair/pair_connection.rb', line 28 def connect system "ssh #{} -L #{rails_server_port}:localhost:3000 -p #{client_port} #{Wemux::Pair.config.pair_user}@localhost" end |
#port_offset ⇒ Object
9 10 11 |
# File 'lib/wemux/pair/pair_connection.rb', line 9 def port_offset tunnel.port_offset end |
#rails_server_port ⇒ Object
17 18 19 |
# File 'lib/wemux/pair/pair_connection.rb', line 17 def rails_server_port 3000 + port_offset end |
#ssh_options ⇒ Object
21 22 23 24 25 26 |
# File 'lib/wemux/pair/pair_connection.rb', line 21 def [ "StrictHostKeyChecking no", "UserKnownHostsFile /dev/null", ].map { |o| "-o \"#{o}\""}.join(" ") end |