Class: RemoteRuby::SSHStdinAdapter

Inherits:
StdinProcessAdapter show all
Defined in:
lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb

Overview

An adapter to execute Ruby code on the remote server via SSH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StdinProcessAdapter

#open

Methods inherited from ConnectionAdapter

#open

Constructor Details

#initialize(server:, working_dir: '~', user: nil, key_file: nil) ⇒ SSHStdinAdapter

Returns a new instance of SSHStdinAdapter.



6
7
8
9
10
11
# File 'lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb', line 6

def initialize(server:, working_dir: '~', user: nil, key_file: nil)
  @working_dir = working_dir
  @server = user.nil? ? server : "#{user}@#{server}"
  @user = user
  @key_file = key_file
end

Instance Attribute Details

#key_fileObject (readonly)

Returns the value of attribute key_file.



4
5
6
# File 'lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb', line 4

def key_file
  @key_file
end

#serverObject (readonly)

Returns the value of attribute server.



4
5
6
# File 'lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb', line 4

def server
  @server
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb', line 4

def user
  @user
end

#working_dirObject (readonly)

Returns the value of attribute working_dir.



4
5
6
# File 'lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb', line 4

def working_dir
  @working_dir
end

Instance Method Details

#connection_nameObject



13
14
15
# File 'lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb', line 13

def connection_name
  "#{server}:#{working_dir}"
end