4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/check.rb', line 4
def self.go(options)
app = KRL_COMMON::get_app
krl_file = File.join(Dir.pwd, app.application_id + ".krl")
raise "Cannot find .krl file." unless File.exists?(krl_file)
if options["parser"]
apiurl = options["parser"]
else
apiurl = "http://krl.kobj.net/manage/parse/ruleset"
end
apiargs = { "krl" => File.open(krl_file, 'r') { |f| f.read } }
validateresponse = KRL_COMMON::long_post_form(URI.parse(apiurl), apiargs).body.to_s
jdata = JSON.parse(validateresponse, { :max_nesting => false })
if jdata["error"]
puts "Errors:"
puts jdata["error"]
else
puts "OK"
end
end
|