Class: ClassRoom::ClassServer

Inherits:
BlankSlate show all
Defined in:
lib/classroom.rb

Overview

Provides methods to get the server up and running easily

Class Method Summary collapse

Class Method Details

.prepare(drb_url = 'classroom://:2001') ⇒ Object

Prepare DRb to act as a server using the correct URL Do some messy hacks to get our own URL scheme



118
119
120
121
122
123
# File 'lib/classroom.rb', line 118

def self.prepare(drb_url = 'classroom://:2001')
  $SAFE = 1
  drb_url.gsub!('classroom:', 'druby:')
  DRb.start_service(drb_url, ClassServerContainer)
  return DRb.uri.gsub('druby:', 'classroom:')
end

.startObject

Do the thread.join with DRb to actually get the server processing requests TODO: Get this daemonizing!



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/classroom.rb', line 127

def self.start
  #fork do
  #  Process.setsid
  #  exit if fork
   #  trap("TERM") {daemon.stop; exit}
    Kernel.send :remove_method, :system
     class << Kernel; self; end.send :remove_method, :system
    $SAFE = 3
    DRb.thread.join
  #end
end