Skip to content

Commit

Permalink
Rewrite, add many more validations
Browse files Browse the repository at this point in the history
Fixes #21
Fixes #24
Fixes #25
  • Loading branch information
jfirebaugh committed Oct 26, 2014
1 parent 03b85d8 commit 300e9a5
Show file tree
Hide file tree
Showing 43 changed files with 982 additions and 22,887 deletions.
18 changes: 1 addition & 17 deletions bin/gl-style-validate
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var argv = require('minimist')(process.argv.slice(2), {
}),
concat = require('concat-stream'),
fs = require('fs'),
jsonlint = require('jsonlint-lines-primitives'),
validate = require('../lib/validate');

if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
Expand All @@ -17,22 +16,7 @@ if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
((argv._[0] && fs.createReadStream(argv._[0])) || process.stdin).pipe(concat(openData));

function openData(data) {
var v;
try {
var style = jsonlint.parse(data.toString());
v = 'v' + style.version;
} catch(e) {
var match = e.message.match(/line (\d+)/),
lineNumber = 0;
if (match) lineNumber = parseInt(match[1], 10);
return console.log('line %s, %s', (''+lineNumber-1), e.message);
}

if (typeof validate[v] === 'undefined') {
return console.log('version ' + v + ' not supported');
}

var errors = validate[v](data);
var errors = validate(data);
if (errors.length) {
if (argv.json) {
process.stdout.write(JSON.stringify(errors, null, 2));
Expand Down
39 changes: 0 additions & 39 deletions lib/reference.js

This file was deleted.

Loading

0 comments on commit 300e9a5

Please sign in to comment.