From 2d5a9ac40c627982ade03c093a55bbd6439ed6eb Mon Sep 17 00:00:00 2001 From: nrew225 Date: Mon, 24 Oct 2016 19:06:35 -0700 Subject: [PATCH] Add test.js for travisci Add errors to README.md --- .travis.yml | 7 ++++ README.md | 10 +++--- test.js | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 .travis.yml create mode 100644 test.js diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..32971a06 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js + +node_js: + - "node" + +script: + - node test.js diff --git a/README.md b/README.md index a25f8761..ce30d733 100644 --- a/README.md +++ b/README.md @@ -912,7 +912,7 @@ See https://github.com/n1trux/awesome-sysadmin#monitoring and https://github.com See also [Ticketing](#ticketing), [Task management/To-do lists](#task-managementto-do-lists)* - * [Apache Bloodhound](https://bloodhound.apache.org/) - Manage software products, Keep track of features, tasks and bugs. `Apache` `Python` + * [Apache Bloodhound](https://bloodhound.apache.org/) - Manage software products, Keep track of features, tasks and bugs `Apache` `Python` * [Bonobo Git Server](https://bonobogitserver.com/) - Set up your own self hosted git server on IIS for Windows. Manage users and have full control over your repositories with a nice user friendly graphical interface. ([Source Code](https://github.com/jakubgarfield/Bonobo-Git-Server)) `MIT` `C#` * [CaseBox](https://www.casebox.org) - Manage all your organisation's information in one system. ([Source Code](https://github.com/KETSE/casebox)) `AGPLv3` `PHP/Java` * [Fossil](https://www.fossil-scm.org/index.html/doc/trunk/www/index.wiki) - Distributed version control system featuring wiki and bug tracker. `BSD` `C` @@ -948,7 +948,7 @@ See **[Ticketing](#ticketing)** * [ICEcoder](https://icecoder.net/) - ICEcoder is a web IDE / browser based code editor, which allows you to develop websites directly within the web browser. ([Demo](http://demo.icecoder.net/ICEcoder/), [Source Code](https://github.com/mattpass/ICEcoder)) `MIT` `PHP` * [JS Bin](http://jsbin.com/) - Open source collaborative web development debugging tool. ([Source Code](https://github.com/jsbin/jsbin)) `MIT` `Nodejs` * [Koding](http://www.koding.com/) - The simplest way to manage your entire Dev Infrastructure. ([Source Code](https://github.com/koding/koding)) `Apache` `Nodejs` - * [Microglark](http://micro.glark.io) - A hacky minimalistic remote pair programming editor. ([Demo](http://micro.glark.io), [Source Code](https://github.com/Bluefinch/microglark)) `AGPLv3` `Nodejs` + * [Microglark](http://micro.glark.io) A hacky minimalistic remote pair programming editor. ([Demo](http://micro.glark.io), [Source Code](https://github.com/Bluefinch/microglark)) `AGPLv3` `Nodejs` * [Regexr](http://regexr.com/) - RegExr is a HTML/JS based tool for creating, testing, and learning about Regular Expressions. ([Source Code](https://github.com/gskinner/regexr/)) `MIT` `Nodejs` * [RStudio Server](https://www.rstudio.com/products/rstudio/#Server) - Web browser based IDE for R. ([Source Code](https://github.com/rstudio/rstudio/)) `AGPLv3` `Java/C++` * [Wide](https://github.com/b3log/wide) - A Web-based IDE for Teams using Go programming language/Golang. ([Demo](http://wide.b3log.org/signup)) `Apache` `Go` @@ -960,7 +960,7 @@ See **[Ticketing](#ticketing)** * [Concourse](https://concourse.ci/) - Concourse is a CI tool that treats pipelines as first class objects and containerizes every step along the way. ([Demo](https://ci.concourse.ci/), [Source Code](https://github.com/concourse/concourse)) `Apache` `Go` * [drone](https://drone.io/) - Drone is a Continuous Delivery platform built on Docker, written in Go. ([Source Code](https://github.com/drone/drone)) `Apache` `Go` * [Factor.io](https://factor.io/) - It's like IFTTT (if-this-then-that) for Dev and DevOps. ([Source Code](https://github.com/factor-io/factor)) `MIT` `Ruby` - * [Jenkins](https://jenkins-ci.org/) - Continuous Integration Server. ([Source Code](https://github.com/jenkinsci/jenkins/)) `MIT` `Java` + * [Jenkins](https://jenkins-ci.org/) - Continuous Integration Server. ([Source Code](https://github.com/jenkinsci/jenkins/)) `MIT` `Java` * [PHPCI](https://www.phptesting.org/) - Free and open source continuous integration specifically designed for PHP. ([Source Code](https://github.com/block8/phpci)) `BSD` `PHP` * [Strider](http://stridercd.com/) - Open Source Continuous Deployment / Continuous Integration platform. ([Source Code](https://github.com/Strider-CD/strider)) `BSD` `Nodejs` @@ -1016,7 +1016,7 @@ See https://staticsitegenerators.net and https://www.staticgen.com *See also [Task management/To-do lists](#task-managementto-do-lists) and [Project Management](#project-management)* - * [Brimir](https://getbrimir.com/) - Simple and clean open-source ticket manager written in Ruby on Rails. ([Source Code](https://github.com/ivaldi/brimir)) `AGPLv3` `Ruby` + * [Brimir](https://getbrimir.com/) - Simple and clean open-source ticket manager written in Ruby on Rails. ([So urce Code](https://github.com/ivaldi/brimir)) `AGPLv3` `Ruby` * [Bugzilla](https://www.bugzilla.org/) - General-purpose bugtracker and testing tool originally developed and used by the Mozilla project. `MPLv2` `Perl` * [Bumpy Booby](http://bumpy-booby.derivoile.fr/) - A simple, responsive and highly customizable PHP bug tracking system. ([Source Code](https://github.com/piero-la-lune/Bumpy-Booby)) `MIT` `PHP` * [Cerb](http://www.cerberusweb.com/) - Group-based e-mail management project. ([Source Code](https://github.com/wgm/cerb)) `DPL` `PHP` @@ -1088,7 +1088,7 @@ See also [Documentation Generators](#documentation-generators), [Wikimatrix](htt **[`^ back to top ^`](#)** - * [arkOS](https://arkos.io/) - Install arkOS to a dedicated device and host your own websites, email, files and more. ([Source Code](https://git.coderouge.co/groups/arkOS) [[1]](https://github.com/cznweb)) `MIT/GPL` `Nodejs/Other` + * [arkOS] (https://arkos.io/) - Install arkOS to a dedicated device and host your own websites, email, files and more. ([Source Code](https://git.coderouge.co/groups/arkOS) [[1]](https://github.com/cznweb)) `MIT/GPL` `Nodejs/Other` * [Cloudron](https://cloudron.io) - Effortlessly self-host web apps on your server. ([Source Code](https://git.cloudron.io/groups/cloudron)) `AGPLv3` `Nodejs/Docker` * [DPlatform](https://dfabric.github.io/DPlatform-ShellCore/) - Deploy self-hosted apps easily: simple, bloat-free, independent installation. ([Source Code](https://github.com/j8r/DPlatform)) `MIT` `Shell` * [FreedomBone](https://github.com/bashrc/freedombone) - Home server configuration based on Debian. `GPLv3` `Shell` diff --git a/test.js b/test.js new file mode 100644 index 00000000..b38d4753 --- /dev/null +++ b/test.js @@ -0,0 +1,99 @@ +const fs = require('fs'); +var testStatus; + +var file = fs.readFileSync('README.md', 'utf8') +entryErrorCheck(file); +return testStatus; + +function entryErrorCheck(md) { + var namepatt = /\*\s\[(.*?)\]/; + var entries = split(md); + var totalFail = 0; + var totalPass = 0; + var total = 0; + var entryArray = []; + for (var i = 0, len = entries.length; i < len; i++) { + entryArray[i] = new Object; + entryArray[i].raw = entries[i]; + //console.log(entries[i]); + //console.log(entryArray[i].raw); + //console.log(entryFilter(entries[i])); + if (entryFilter(entries[i]) === true){ + total += 1; + entryArray[i].name = namepatt.exec(entries[i])[1]; + //console.log('name' + entryArray[i].name); + //entryArray[i].error = ""; + entryArray[i].pass = findPattern(entries[i], i); + if (entryArray[i].pass == true) { + totalPass += 1; + //console.log(i + 1 + ". Pass: " + entryArray[i].name); + } else { + console.log("Line #" + i + 1 + ". Fail: " + entryArray[i].name); + //console.log(entries[i]); + totalFail += 1; + } + } + } + if (totalFail > 0) { + console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total); + + testStatus = 1; + } else { + console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total); + testStatus = 0; + } + //console.log(entries[i]) + //console.log(totalPass + "|" + totalFail); + +}; + +function entryFilter(md) { + var linepatt = /^\s{0,4}\*\s\[.*\`/; + return linepatt.test(md); +} + +function split(text){ + //cutOne = text.split(""); + //cutTwo = cutOne[1].split(""); + //cutThree = cutTwo[0].replace(/^\#.*$|^\_.*$|^See.*$|^Some.*$|^\*.*\*$|^\s\*.*\*$|^CMS.*$|^\*\*\[.*$/mg, ""); + return text.split(/\r?\n/); +} + +function parseMD(md) { + return split(md).filter(entryFilter); + //console.log(entries); + //console.log (entries.length); + //console.log(entries[0]); + //console.log(entries[entries.length - 1]); +} + +function findPattern(text, i) { + var nodnospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with no demo and no source code + var slpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\(\[Demo\b\]\((.*?)\)\,\s\[Source Code\b\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with demo and source code + var nodpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\(\[Source Code\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with no demo + var nospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\(\[Demo\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with no source code + var pnodnospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with no demo and no source code + var pslpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\(\[Demo\b\]\((.*?)\)\,\s\[Source Code\b\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with demo and source code + var pnodpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\(\[Source Code\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with no demo + var pnospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\(\[Demo\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with no source code + if (nodnospatt.test(text) == true) { + return true; + } else if (slpatt.test(text) == true) { + return true; + } else if (nodpatt.test(text) == true) { + return true; + } else if (nospatt.test(text) == true) { + return true; + } else if (pnodnospatt.test(text) == true) { + return true; + } else if (pslpatt.test(text) == true) { + return true; + } else if (pnodpatt.test(text) == true) { + return true; + } else if (pnospatt.test(text) == true) { + return true; + } else { + //document.getElementById("alert").innerHTML = "Error(s) Found, check your syntax!"; + return false; + } +}; \ No newline at end of file