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
# File 'lib/pssh/client.rb', line 4

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

Class Method Details

.startObject



25
26
27
# File 'lib/pssh/client.rb', line 25

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