Class: Graphiti::CLI

Inherits:
Thor show all
Defined in:
lib/graphiti/cli.rb

Instance Method Summary collapse

Instance Method Details

#schema_check(old, new) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/graphiti/cli.rb', line 10

def schema_check(old, new)
  old = schema_for(old)
  new = schema_for(new)

  errors = Graphiti::SchemaDiff.new(old, new).compare
  if errors.any?
    say(set_color("Backwards incompatibilties found!\n", :red, :bold))
    errors.each { |e| say(set_color(e, :yellow)) }
    exit(1)
  else
    say(set_color("No incompatibilities found!", :green))
    exit(0)
  end
end