Skip to content
Browse files

Using require_relatives instead of require

  • Loading branch information...
1 parent 106b212 commit 5f46430336542ca8b4b1f6bfdf400298aab95494 @krakatoa krakatoa committed Jan 26, 2013
Showing with 43 additions and 45 deletions.
  1. +1 −1 examples/boot.rb
  2. +3 −3 lib/cucub-server.rb
  3. +38 −40 lib/dispatcher.rb
  4. +1 −1 lib/server.rb
View
2 examples/boot.rb
@@ -1,6 +1,6 @@
# Run it on root with this command: ruby bin/cucub-server start examples/boot.rb
-require './examples/reply_channel_test'
+require_relative './reply_channel_test'
core = Core.new
#core.oid = 1
View
6 lib/cucub-server.rb
@@ -1,5 +1,5 @@
require 'cucub-protocol'
-require './lib/channel'
-require './lib/dispatcher'
-require './lib/server'
+require_relative './channel'
+require_relative './dispatcher'
+require_relative './server'
View
78 lib/dispatcher.rb
@@ -11,65 +11,63 @@ def initialize
def start(block=nil)
block ||= Proc.new {}
- #EM.epoll
- #EM.run do
- self.init_inner_channels
-
- #### @proxy_worker = Cucub::ProxyWorker::connection
+ self.init_inner_channels
+
+ #### @proxy_worker = Cucub::ProxyWorker::connection
- ## TODO if list.size == 1 => oid unico
+ ## TODO if list.size == 1 => oid unico
####
=begin
- Cucub::LiveObject.list.each do |obj|
- case obj.class.channel
- when :reply
- @reply = Cucub::Channel.reply
- when :pull
- @pull = Cucub::Channel.pull
- when :subscribe
- puts '?'
- end
+ Cucub::LiveObject.list.each do |obj|
+ case obj.class.channel
+ when :reply
+ @reply = Cucub::Channel.reply
+ when :pull
+ @pull = Cucub::Channel.pull
+ when :subscribe
+ puts '?'
end
- @ipc_get = Cucub::Channel.ipc_get
+ end
+ @ipc_get = Cucub::Channel.ipc_get
=end
- if Cucub::Server::Configuration.instance.uses.include? ("box")
- @box = Cucub::Channel.reply
- end
+ if Cucub::Server::Configuration.instance.uses.include? ("box")
+ @box = Cucub::Channel.reply
+ end
####
=begin
- Cucub::LiveProxy.list.each do |proxy|
- proxy.engage
- end
+ Cucub::LiveProxy.list.each do |proxy|
+ proxy.engage
+ end
=end
####
=begin
- @proxy_worker.each_job { |job|
- if Cucub::LiveProxy.list.size > 0
- msg = job.body
- oid, channel = Cucub::ProxyWorker.read_oid(msg)
- if channel == nil
- proxy = Cucub::LiveProxy.select(oid)
- else
- proxy = Cucub::Channel.local_push
- end
+ @proxy_worker.each_job { |job|
+ if Cucub::LiveProxy.list.size > 0
+ msg = job.body
+ oid, channel = Cucub::ProxyWorker.read_oid(msg)
+ if channel == nil
+ proxy = Cucub::LiveProxy.select(oid)
+ else
+ proxy = Cucub::Channel.local_push
+ end
- if proxy
- if proxy.do(msg)
- job.delete
- else
- job.release
- end
+ if proxy
+ if proxy.do(msg)
+ job.delete
+ else
+ job.release
end
end
- }
+ end
+ }
=end
- block.call
- #end
+ block.call
+
PanZMQ::Poller.instance.poll
end
View
2 lib/server.rb
@@ -1,5 +1,5 @@
require 'singleton'
-require './lib/server/configuration'
+require_relative './server/configuration'
module Cucub
class Server

0 comments on commit 5f46430

Please sign in to comment.
Something went wrong with that request. Please try again.