Class: GroongaQueryLog::Command::CheckCommandVersionCompatibility

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/command/check-command-version-compatibility.rb

Instance Method Summary collapse

Constructor Details

#initializeCheckCommandVersionCompatibility

Returns a new instance of CheckCommandVersionCompatibility.



24
25
26
# File 'lib/groonga-query-log/command/check-command-version-compatibility.rb', line 24

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

Instance Method Details

#run(command_line) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/groonga-query-log/command/check-command-version-compatibility.rb', line 28

def run(command_line)
  input_paths = create_parser.parse(command_line)
  checker = CommandVersionCompatibilityChecker.new(@options)
  checker.start do
    compatible = true
    if input_paths.empty?
      compatible = false unless checker.check($stdin)
    else
      input_paths.each do |input_path|
        File.open(input_path) do |input|
          compatible = false unless checker.check(input)
        end
      end
    end
    compatible
  end
end