Class: GroongaQueryLog::Command::VerifyServer

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/command/verify-server.rb

Instance Method Summary collapse

Constructor Details

#initializeVerifyServer

Returns a new instance of VerifyServer.



25
26
27
# File 'lib/groonga-query-log/command/verify-server.rb', line 25

def initialize
  @options = ServerVerifier::Options.new
end

Instance Method Details

#run(command_line, &callback) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/groonga-query-log/command/verify-server.rb', line 29

def run(command_line, &callback)
  input_paths = create_parser.parse(command_line)
  same = true
  verifier = ServerVerifier.new(@options)
  if input_paths.empty?
    same = verifier.verify($stdin, &callback)
  else
    input_paths.each do |input_path|
      case input_path
      when /\.tar\.gz\z/
        unless verify_tar_gz(verifier, input_path)
          same = false
          return false if @options.stop_on_failure?
        end
      else
        File.open(input_path) do |input|
          unless verifier.verify(input, &callback)
            same = false
            return false if @options.stop_on_failure?
          end
        end
      end
    end
  end
  same
end