Add the "verify" script
In addition to the new script, this changes the V2 parser to be able to continue past the first error found so that as many errors as possible may be displayed.
This commit is contained in:
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env coffee
|
||||
|
||||
global._ = require 'underscore'
|
||||
global.Backbone = require 'backbone'
|
||||
|
||||
fs = require 'fs'
|
||||
Logger = require '../src/scripts/logger'
|
||||
ModVersionParser = require '../src/scripts/models/mod_version_parser'
|
||||
|
||||
require '../src/scripts/underscore_mixins'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
if process.argv.length is 3
|
||||
sourceFileName = process.argv[2]
|
||||
else
|
||||
console.error """
|
||||
|
||||
USAGE: verify <source>
|
||||
|
||||
Verifies that a recipe book is in the proper format. If there is a problem,
|
||||
then a message will be displayed. Otherwise, the command has no output.
|
||||
|
||||
"""
|
||||
process.exit -1
|
||||
|
||||
global.logger = new Logger level:Logger.WARNING
|
||||
|
||||
try
|
||||
text = fs.readFileSync sourceFileName, 'UTF-8'
|
||||
parser = new ModVersionParser showAllErrors:true
|
||||
modVersion = parser.parse text
|
||||
catch e
|
||||
console.error e.message
|
||||
Reference in New Issue
Block a user