Class: Webbynode::Server
Instance Attribute Summary collapse
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#port ⇒ Object
Returns the value of attribute port.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #add_ssh_key(key_file, passphrase = "") ⇒ Object
- #add_ssh_root_key(key_file, passphrase = "") ⇒ Object
- #application_pushed? ⇒ Boolean
-
#initialize(ip, user, port) ⇒ Server
constructor
A new instance of Server.
- #io ⇒ Object
- #pushand ⇒ Object
- #remote_executor ⇒ Object
- #ssh ⇒ Object
Constructor Details
Instance Attribute Details
#ip ⇒ Object
Returns the value of attribute ip.
7 8 9 |
# File 'lib/webbynode/server.rb', line 7 def ip @ip end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/webbynode/server.rb', line 7 def port @port end |
#user ⇒ Object
Returns the value of attribute user.
7 8 9 |
# File 'lib/webbynode/server.rb', line 7 def user @user end |
Instance Method Details
#add_ssh_key(key_file, passphrase = "") ⇒ Object
32 33 34 |
# File 'lib/webbynode/server.rb', line 32 def add_ssh_key(key_file, passphrase="") add_ssh_key_in "~", key_file, passphrase end |
#add_ssh_root_key(key_file, passphrase = "") ⇒ Object
36 37 38 39 |
# File 'lib/webbynode/server.rb', line 36 def add_ssh_root_key(key_file, passphrase="") create_ssh_settings "/root", true add_ssh_key_in "/root", key_file, passphrase, true end |
#application_pushed? ⇒ Boolean
41 42 43 44 |
# File 'lib/webbynode/server.rb', line 41 def application_pushed? return false if remote_executor.exec("cd #{pushand.parse_remote_app_name}") =~ /No such file or directory/ true end |
#io ⇒ Object
16 17 18 |
# File 'lib/webbynode/server.rb', line 16 def io @io ||= Webbynode::Io.new end |
#pushand ⇒ Object
28 29 30 |
# File 'lib/webbynode/server.rb', line 28 def pushand @pushand ||= Webbynode::PushAnd.new end |
#remote_executor ⇒ Object
24 25 26 |
# File 'lib/webbynode/server.rb', line 24 def remote_executor @remote_executor ||= Webbynode::RemoteExecutor.new(ip, user, port) end |
#ssh ⇒ Object
20 21 22 |
# File 'lib/webbynode/server.rb', line 20 def ssh Kernel.exec "ssh -p #{port} #{user}@#{ip}" end |