lib/cucumba/drb.rb in cucumba-0.0.5 vs lib/cucumba/drb.rb in cucumba-0.0.6
- old
+ new
@@ -2,21 +2,21 @@
require 'drb'
module Cucumba
class Drb
class Server
- def has_model?(model)
- Object.const_defined?(model.to_s.classify)
+ def has_constant?(const)
+ Object.const_defined?(const.to_s.classify)
end
- def model_has_method?(model,method)
- Object.const_get(model).respond_to?(method)
+ def constant_has_method?(const,method)
+ Object.const_get(const).respond_to?(method)
end
- def invoke_method_on_model(model,method,*args)
- logger.info "Processing #{model}.#{method.to_s} (for TODO_IP at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}) [DRb]"
- Object.const_get(model).method(method).call(*args.first)
+ def invoke_method_on_constant(const,method,*args)
+ logger.info "Processing #{const}.#{method.to_s} (for TODO_IP at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}) [DRb]"
+ Object.const_get(const).method(method).call(*args.first)
rescue Exception => e
handle_exception(e)
raise RuntimeError, "#{e.class.to_s} #{e.message}"
end
@@ -45,8 +45,9 @@
end
end
end
begin
- DRb.start_service(Cucumba[:_self_].drb_url, Cucumba::Drb::Server.new) if Cucumba[:_self_].run?
+ DRb.start_service("druby://127.0.0.1:#{Cucumba[:_self_].drb_port}", Cucumba::Drb::Server.new) if Cucumba[:_self_].run?
rescue Errno::EADDRINUSE
+ puts "=> Cucumba DRb server not starting, port #{Cucumba[:_self_].drb_port} already in use"
end