class LSync::Shell

A shell provides access to a server, typically to run an instance of `ruby`.

Public Class Methods

new(command, options = {}) click to toggle source
# File lib/lsync/shell.rb, line 33
def initialize(command, options = {})
        case command
        when Array
                @command = command
        else
                @command = [command]
        end
        
        @options = options
end

Public Instance Methods

connect(server) click to toggle source
# File lib/lsync/shell.rb, line 53
def connect(server)
        options = {:passthrough => []}
        if server.local?
                return RExec::start_server(CLIENT_CODE, ruby_command, options)
        else
                return RExec::start_server(CLIENT_CODE, connection_command(server) + ruby_command, options)
        end
end
connection_command(server, arguments = []) click to toggle source

The command required to connect to the remote machine.

# File lib/lsync/shell.rb, line 49
def connection_command(server, arguments = [])
        @command + (@options[:arguments] || []) + arguments + [server.host]
end
ruby_command() click to toggle source
# File lib/lsync/shell.rb, line 44
def ruby_command
        @options[:ruby] || ["ruby"]
end