Method: Jets::CLI::Call#load_event_from_file

Defined in:
lib/jets/cli/call.rb

#load_event_from_file(text) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/jets/cli/call.rb', line 106

def load_event_from_file(text)
  path = text.gsub("file://", "")
  path = "#{Jets.root}/#{path}" unless path[0..0] == "/"
  unless File.exist?(path)
    puts "File #{path} does not exist.  Are you sure the file exists?".color(:red)
    exit 1
  end
  text = IO.read(path)
  check_valid_json!(text)
  text
end