class Randrizer::Cli

Public Class Methods

help() click to toggle source
# File lib/randrizer/cli.rb, line 23
def self.help
  STDOUT.write("Randrizer #{Randrizer::VERSION}\n")
end
run() click to toggle source
# File lib/randrizer/cli.rb, line 9
def self.run
  return help if ARGV.empty?

  fname = ARGV[0]
  unless File.exist?(fname)
    raise ArgumentError, "#{fname} does not exist or cannot be accessed"
  end

  input_json = File.read(fname)
  type_tree = Drivers::JSONSchema::Driver.for(content: input_json).type_tree
  output = type_tree.eval
  puts JSON.pretty_generate(output)
end