Class: Pssh::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pssh/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pssh/client.rb', line 4

def initialize
  @pty = Pssh.pty = Pssh::Pty.new
  @socket = Pssh.socket = Pssh::Socket.new
  @web = Pssh.web = Pssh::Web.new
  @app = Rack::Builder.new do
    map "/assets/" do
      run Rack::File.new "#{Pssh.base_path}/assets/"
    end
    map "/socket" do
      run Pssh.socket
    end
    map "/" do
      run Pssh.web
    end
  end
  Thin::Logging.silent = true
  if Pssh.pty.existing?
    Thread.new do
      @console = Console.new
    end
  end
  Rack::Handler::Thin.run @app, Port: Pssh.port
end

Class Method Details

.startObject



28
29
30
# File 'lib/pssh/client.rb', line 28

def self.start
  Pssh.client = @client = Client.new
end