Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hadesbox committed Nov 3, 2014
0 parents commit 48f2169
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
12 changes: 12 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo installing node libraries ... raml-parser
npm install

echo creating link on /usr/bin... raml-parser
ln -s $(pwd)/raml-parser.js /usr/bin/ramlparser

echo setting permissions...
chmod +x $(pwd)/raml-parser.js

echo all done...
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "simple-ramlparser",
"version": "0.0.1",
"author": "Luix <[email protected]>",
"description": "a simple CLI parser for raml files",
"scripts": {},
"dependencies" : {
"colors" : "*",
"raml-parser" : "*"
}
}
28 changes: 28 additions & 0 deletions raml-parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node

var raml = require('raml-parser');
var fs = require("fs");
var colors = require("colors");

if(process.argv.length < 3){
console.error("Error".red, "Not enough parameters".cyan);
console.error("usage:", "ramlparser".blue, "input.raml".green);
process.exit(-1);
}

var input_file = process.argv[2];

if(input_file=="" || !fs.existsSync(input_file)){
console.error("Error".red, "Invalid or empty input file".cyan, input_file);
process.exit(-1);
}
else{
console.log("Parsing".cyan, input_file, "...".cyan);
raml.loadFile(input_file).then(function(data) {
console.log("your RAML file is correct!".green)
}, function(error) {
console.error("Error while parsing your file".red, error.message.cyan);
});
}


0 comments on commit 48f2169

Please sign in to comment.