Class: GroongaSchema::CommandLine::GroongaSchemaDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-schema/command-line/groonga-schema-diff.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ GroongaSchemaDiff

Returns a new instance of GroongaSchemaDiff.



34
35
36
37
# File 'lib/groonga-schema/command-line/groonga-schema-diff.rb', line 34

def initialize(args)
  @args = args
  @format = :command
end

Class Method Details

.run(args = ARGV) ⇒ Object



29
30
31
# File 'lib/groonga-schema/command-line/groonga-schema-diff.rb', line 29

def run(args=ARGV)
  new(args).run
end

Instance Method Details

#runObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/groonga-schema/command-line/groonga-schema-diff.rb', line 39

def run
  parse_arguments

  from_schema = parse_schema(@from)
  to_schema = parse_schema(@to)
  differ = GroongaSchema::Differ.new(from_schema, to_schema)
  diff = differ.diff
  $stdout.print(diff.to_groonga_command_list(:format => @format))

  if diff.same?
    0
  else
    1
  end
end