Sha256: 3302369d0f2c1b820270aaf73d8cd0ad9df7c9241df778a49308309b4c75699a

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require "active_support/all"
require "drb"
require "ro_commands"
require "ro_commands/core_ext/thor"
require "ro_commands/core_ext/string"
require "ro_commands/helpers/all"
require "ro_commands/helpers/out"
require "drb"

Out.out "starting service"
DRb::DRbServer.make_config(verbose: true)
#Out.out "RoCommands.file_map:#{RoCommands.file_map}   file:#{File.basename __FILE__} line:#{__LINE__}"
RoCommands.file_map.each do |file, port|
  basename = File.basename(file.to_s).gsub(%r{\.rb}, "")
  klass_name = basename.to_s.camelize

  Out.out "#{RoCommands.const_get(klass_name.to_sym)} defining methods"
  RoCommands.const_get(klass_name.to_sym).class_eval do
    RoCommands.const_get(klass_name.to_sym).meths.each do |m|
      desc usage("drb_#{m}"), ""
      define_method("drb_#{m}".to_sym) do |*args|
        Out.reset
        send(m.to_sym, *args)
        #Out.out "Out.msgs:#{Out.msgs}   file:#{File.basename __FILE__} line:#{__LINE__}"
        handle_drb_out
      end
    end
  end

  url = "druby://localhost:#{port}"
  puts "#{RoCommands.const_get(klass_name.to_sym)} at #{url}"
  DRb.start_service(url, RoCommands.const_get(klass_name.to_sym))
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ro_commands-0.0.3 lib/drb/server.rb
ro_commands-0.0.2 lib/drb/server.rb