Sha256: 3efcf3829367bcdf18b7a4e0857ffaacc02693f0bdf40db678fd277674d1c2ae

Contents?: true

Size: 882 Bytes

Versions: 1

Compression:

Stored size: 882 Bytes

Contents

module Wukong
  module Load
    class Runner

      include Logging

      def self.run settings
        begin
          new(settings).run
        rescue Error => e
          log.error(e.message)
          exit(127)
        end
      end

      attr_accessor :settings
      def initialize settings
        self.settings = settings
      end

      def args
        settings.rest
      end

      def data_store_name
        args.first
      end

      def processor_name
        case data_store_name
        when 'elasticsearch' then :elasticsearch_loader
        when nil
          settings.dump_help
          exit(1)
        else
          raise Error.new("No loader defined for data store: #{data_store_name}")
        end
      end
      
      def run
        EM.run do
          StupidServer.new(processor_name, settings).run!
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wukong-load-0.0.2 lib/wukong-load/runner.rb