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.
35 lines
973 B
CoffeeScript
Executable File
35 lines
973 B
CoffeeScript
Executable File
#!/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
|