Class: GroongaDelta::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-delta/command.rb

Direct Known Subclasses

ApplyCommand, ImportCommand

Instance Method Summary collapse

Constructor Details

#initializeCommand

Returns a new instance of Command.



20
21
22
23
24
# File 'lib/groonga-delta/command.rb', line 20

def initialize
  @dir = "."
  @server = false
  @config = nil
end

Instance Method Details

#run(args) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/groonga-delta/command.rb', line 26

def run(args)
  catch do |tag|
    parse_args(args, tag)
    begin
      prepare
      loop do
        process
        break unless @server
        sleep(@config.polling_interval)
      end
      true
    rescue Interrupt
      true
    rescue SignalException => error
      case error.signm
      when "SIGTERM"
        true
      else
        @config.logger.error(error) if @config
        raise
      end
    rescue => error
      @config.logger.error(error) if @config
      raise
    end
  end
end