Module: Hoof

Defined in:
lib/hoof.rb,
lib/hoof/cli.rb,
lib/hoof/application.rb,
lib/hoof/http_server.rb,
lib/hoof/https_server.rb,
lib/hoof/control_server.rb,
lib/hoof/application_pool.rb

Defined Under Namespace

Classes: Application, ApplicationPool, Cli, ControlServer, HttpServer, HttpsServer

Class Method Summary collapse

Class Method Details

.find(name) ⇒ Object



21
22
23
# File 'lib/hoof.rb', line 21

def self.find name
  pool[name]
end

.http_portObject



46
47
48
# File 'lib/hoof.rb', line 46

def self.http_port
  26080
end

.https_portObject



50
51
52
# File 'lib/hoof.rb', line 50

def self.https_port
  26443
end

.poolObject



13
14
15
16
17
18
19
# File 'lib/hoof.rb', line 13

def self.pool
  @pool ||= begin
    app_pool = Hoof::ApplicationPool.new
    app_pool.reload
    app_pool
  end
end

.sockObject



42
43
44
# File 'lib/hoof.rb', line 42

def self.sock
  File.expand_path(File.join('~/.hoof', 'hoof.sock'))
end

.startObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/hoof.rb', line 25

def self.start
 EventMachine.epoll
 EventMachine::run do
   trap("TERM") { stop }
   trap("INT")  { stop }

   EventMachine::start_server "127.0.0.1", http_port, Hoof::HttpServer
   EventMachine::start_server "127.0.0.1", https_port, Hoof::HttpsServer
   EventMachine::start_server sock, Hoof::ControlServer
 end
end

.stopObject



37
38
39
40
# File 'lib/hoof.rb', line 37

def self.stop
  pool.stop
  EventMachine.stop
end