Class: Daftos
- Inherits:
-
Object
- Object
- Daftos
- Defined in:
- lib/daftos.rb
Class Method Summary collapse
Class Method Details
.start ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/daftos.rb', line 10 def self.start() fork do Dir.chdir(Dir.home) Dir.mkdir('.daftos') unless Dir.exist?('.daftos') File.open('.daftos/server.pid', 'w') {|f| f.write Process.pid } builder = Rack::Builder.new do map('/api/file_system'){ run FileSystemAPI } map('/api/apps'){ run AppsAPI } map('/'){ run Server } end Rack::Handler::Thin.run builder, :Port => 9999, :Host => "0.0.0.0" end end |
.stop ⇒ Object
26 27 28 29 |
# File 'lib/daftos.rb', line 26 def self.stop Dir.chdir(Dir.home) Process.kill 'TERM', File.read('.daftos/server.pid').to_i end |