Class: LSync::Shell
- Inherits:
-
Object
- Object
- LSync::Shell
- Defined in:
- lib/lsync/shell.rb
Overview
A shell provides access to a server, typically to run an instance of ruby.
Direct Known Subclasses
Instance Method Summary collapse
- #connect(server) ⇒ Object
-
#connection_command(server, arguments = []) ⇒ Object
The command required to connect to the remote machine.
-
#initialize(command, options = {}) ⇒ Shell
constructor
A new instance of Shell.
- #ruby_command ⇒ Object
Constructor Details
#initialize(command, options = {}) ⇒ Shell
Returns a new instance of Shell.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/lsync/shell.rb', line 34 def initialize(command, = {}) case command when Array @command = command else @command = [command] end = end |
Instance Method Details
#connect(server) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/lsync/shell.rb', line 54 def connect(server) = {:passthrough => []} if server.local? return RExec::start_server(CLIENT_CODE, ruby_command, ) else return RExec::start_server(CLIENT_CODE, connection_command(server) + ruby_command, ) end end |
#connection_command(server, arguments = []) ⇒ Object
The command required to connect to the remote machine.
50 51 52 |
# File 'lib/lsync/shell.rb', line 50 def connection_command(server, arguments = []) @command + ([:arguments] || []) + arguments + [server.host] end |
#ruby_command ⇒ Object
45 46 47 |
# File 'lib/lsync/shell.rb', line 45 def ruby_command [:ruby] || ["ruby"] end |