-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 48f2169
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" : "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
} | ||
|
||
|