From 994322e4e6770691db0f532185f2971f4776b686 Mon Sep 17 00:00:00 2001 From: Cian Butler Date: Mon, 3 Oct 2016 08:03:47 -0700 Subject: [PATCH] add testing of all json file, linting of main js and gulp as test (#30) * add 2017 * add testing of all json file, linting of main js and gulp as test * add globbing to check json --- .eslintrc.json | 3 +- .travis.yml | 6 ++ 2015/events.json | 148 +++++++++++++++++++-------------------- 2016/events.json | 64 ++++++++--------- README.md | 1 + bin/check-event-json | 31 +++++--- events.json | 163 +++++++++++++++++++++++++++++++++++++++++-- gulpfile.js | 10 ++- js/main.js | 22 +++--- package.json | 4 +- schema.json | 72 +++++++++++++++++++ 11 files changed, 390 insertions(+), 134 deletions(-) create mode 100644 .travis.yml create mode 100644 schema.json diff --git a/.eslintrc.json b/.eslintrc.json index 132eab9..bfccf67 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,8 @@ "json" ], "env": { - "browser": true + "browser": true, + "jquery": true }, "extends": "eslint:recommended", "rules": { diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..76db03f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "node" + - "6" + - "5" + - "4" diff --git a/2015/events.json b/2015/events.json index 5a23f88..2cd08b4 100644 --- a/2015/events.json +++ b/2015/events.json @@ -3,7 +3,7 @@ "description": "Amazon", "events": [{ "name": "Opening Event", - "by": "", + "by": "Redbrick", "time": "10am", "place": { "id": "L101", @@ -15,53 +15,53 @@ "by": "Amazon", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Amazon CloudWatch" }, { "name": "Internet of Things", - "by": "", + "by": "Amazon", "time": "1pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Internet of Things" }, { "name": "Lunch", - "by": "", + "by": "Food", "time": "2pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Time for a break" }, { "name": "Project Workshops with Amazon SDEs", - "by": "", + "by": "Amazon", "time": "3pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Amazon" }, { "name": "Colin Whittaker", - "by": "", + "by": "Colin Whittaker", "time": "4pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Colin Whittaker" }, { "name": "Networking", - "by": "", + "by": "nuBar", "time": "3pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Networking" }] @@ -70,20 +70,20 @@ "description": "RB & Intercom", "events": [{ "name": "Associate Talks", - "by": "", + "by": "Redbrick", "time": "10am", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Talks given by old RedBrick members" }, { "name": "Intercom", - "by": "", + "by": "Intercom", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Intercom talks" }] @@ -92,47 +92,47 @@ "description": "Openet", "events": [{ "name": "Admin Tales of Fail", - "by": "", + "by": "koffee, zergless, kylar", "time": "2:30pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "How Redbrick was broken, but then fixed by our amazing admins" }, { "name": "Openet", - "by": "", + "by": "Opennet", "time": "3:30pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Openet" }, { "name": "Coding Competition", - "by": "", + "by": "Opennet", "time": "4pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Prove your skills" }, { "name": "nuBar", - "by": "", + "by": "nuBar", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Lets go!" }, { "name": "Prizegiving", - "by": "", + "by": "opennet", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Rewards for the competition" }] @@ -141,56 +141,56 @@ "description": "Google", "events": [{ "name": "Linear Algebra", - "by": "", + "by": "Google", "time": "1pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "What?" }, { "name": "Lunch", - "by": "", + "by": "Food", "time": "2:30pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Eat" }, { "name": "Internet of Things", - "by": "", + "by": "Google", "time": "2:30pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Again" }, { "name": "Building Reliable Large-Scale Distributed Systems", - "by": "", + "by": "Google", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "How-to" }, { "name": "Expecting the Unexpected", - "by": "", + "by": "Google", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Google DIRT training" }, { "name": "Close Networking Session", - "by": "", + "by": "Google", "time": "17pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "End of Networking" }] @@ -199,56 +199,56 @@ "description": "AOL", "events": [{ "name": "Associate Talks", - "by": "", + "by": "Redbrick", "time": "1pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Old members" }, { "name": "The Architecture of Online Ad Delivery", - "by": "", + "by": "AOL", "time": "2:30pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Ads" }, { "name": "Introduction to Erlang in the context of a Real Time Advertising Auction", - "by": "", + "by": "AOL", "time": "2:30pm", "place": { "id": "QG22", - "map": "" + "map": "Somewhere in DCU" }, "description": "Real time" }, { "name": "Overview of Aol’s open source SimpleReact library for Java 8", - "by": "", + "by": "AOL", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Erlang" }, { "name": "Clean Code - Join the Revolution!", - "by": "", + "by": "AOL", "time": "12pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "Clean Code" }, { "name": "Continuous Integration/Continuous Deployment (CI/CD)", - "by": "", + "by": "AOL", "time": "17pm", "place": { - "id": "", - "map": "" + "id": "The Mezz", + "map": "Somewhere in DCU" }, "description": "CI|CD" }] diff --git a/2016/events.json b/2016/events.json index 30451d0..b9a69ef 100644 --- a/2016/events.json +++ b/2016/events.json @@ -9,14 +9,14 @@ "id": "The Mezz", "map": "Somewhere in DCU" }, - "description": "Opening of TechWeek 2015" + "description": "Opening of TechWeek 2016" }, { "name": "Lunch", - "by": "", + "by": "Somewhere in DCU", "time": "14:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Lunch Time!" }, { @@ -25,7 +25,7 @@ "time": "15:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Where do you picture yourself in 5 years? How’s your relationship with your parents? Do you feel a longing for meaning and direction in your life? In this talk Cian Ruane and Noah Donnelly will introduce you to the world of competitive programming." }, { @@ -34,7 +34,7 @@ "time": "16:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "A session on what's involved in a tech startup raising an initial round of funding given by Fergus O'Dea from NDRC (National Digital Research Centre), a leading investor in early-stage digital startups." }, { @@ -43,7 +43,7 @@ "time": "17:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "An over of what OpenStack is, and how you can use it, I will cover the main projects available in OpenStack, what they do, and how they link together. I will also cover how you can get involved. https://graham.hayes.ie" }] @@ -56,7 +56,7 @@ "time": "12:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Citrix Workspace Cloud (CWC) is a serviced-based product to deliver workspaces. Citrix describes this as “a cloud-based control plane that enables partners and customers to unify, secure and deliver workspace services" }, { @@ -65,16 +65,16 @@ "time": "13:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Prometheus is a scalable, reliabile, easy to use and powerful monitoring system. This talk will look at the ideas behind it and how you can take advantage of them. Since publicly launching the open source project, over a year ago, over 100 companies have now rely on it and to date there are over 250 contributers to the codebase." }, { "name": "Lunch", - "by": "", + "by": "Somewhere in DCU", "time": "14:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Lunch Time!" }, { @@ -83,7 +83,7 @@ "time": "17:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Damian's talk will look at the portrayal of computer hackers in the movies, how they are represented in terms of the age, gender, profession, etc. and how this portrayal has evolved over the decades, and it will also will look at the depiction of the types of things hackers can do in the movies as opposed to real life" }] @@ -96,7 +96,7 @@ "time": "12:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Progress has been made to Redbrick 2.0 but how will it work. Terry and Cian have a live demo to show you how." }, { @@ -105,16 +105,16 @@ "time": "13:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "WhiteHack: Smart Meter Security in 56 million homes" }, { "name": "Lunch", - "by": "", + "by": "Somewhere in DCU", "time": "14:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Lunch" }, { @@ -123,7 +123,7 @@ "time": "15:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Any problem can have multiple causes and a vital part of troubleshooting is to gather as much data as possible. However not all problems (or solutions) are evident from deployed monitoring tools. Substantial data can be gleaned from social networking sites such as Twitter and Facebook and crowdsourcing your info can really help when local contacts can't be reached. This talk is liberally dosed with caveats and searching Instagram for pictures of dug up fibre should never be used in preference to well configured network monitoring tools! " }, { @@ -132,7 +132,7 @@ "time": "16:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "GO" }, { @@ -141,7 +141,7 @@ "time": "17:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Computer criminals regularly construct large distributed attack networks known as botnets.These networks are comprised of hijacked computers that an attacker can use to send spam, commit financial fraud or launch cyber - attacks.This talk aims to describe the approaches of botnet takedowns from the perspective of law enforcement agencies and the AV industry using examples from recent take - downs and discusses success stories when private and public sect Anev will go through case study of take down effort for zeroaccess botnet which was done by symantec and give an example of the gameoverzeus botnet takedown we conducted in conjunction with the FBI and the UK cyber crime unit and show the difference it made working with LE." }] @@ -154,7 +154,7 @@ "time": "12:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Aoife wants to predict how likely you are to click on an ad, to help Google decide whether to show it. With the machine learning mathematics all done, shouldn't it be easy: just train the model and make predictions? Not so fast. We'll see how Aoife overcomes the obstacles that stand between her machine learning model and the world. For starters: she has to train it on petabytes of data, continually arriving, and have it serve millions of predictions a second. Graham Poulter is a Site Reliability Engineer on Google's machine learning pipelines for ads, having moved here from South Africa three years ago. He's done some machine learning before, but was amazed to see that scaling up machine learning is a whole lot harder than one might imagine." }, { @@ -163,7 +163,7 @@ "time": "12:40", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "This talk will cover some very high-level principles for distributed system design." }, { @@ -172,16 +172,16 @@ "time": "13:20", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": " In software engineering, it is rare for the final version of a solution to be decided before implementation starts.Everything changes;engineers, experience, problems faced, and lessons learned from failure.This talk will explore why it 's important to try many different avenues, to fully understand the problem space, before being sure that a solution is optimal." }, { "name": "Lunch", - "by": "", + "by": "Somewhere in DCU", "time": "14:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Eat" }, { @@ -190,7 +190,7 @@ "time": "15:00", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Things break - all the time. At Google scale we're statistically certain that at any given time, somewhere, something is broken. We still have deliver a great service to users. By deliberately breaking things in a controlled fashion, Google's Disaster Readiness Testing is one of the methods we use to objectively test our ability to handle failure." }, { @@ -199,7 +199,7 @@ "time": "15:40", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Learn tips from members of Google's recruiting team about how to put together a memorable CV. Two of our Site Reliability Engineers will also do a demo coding interview and will provide tips on how to approach the process." }, { @@ -208,7 +208,7 @@ "time": "16:20", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Hear from past and future Google interns currently studying at DCU about their experiences in this panel discussion." }] @@ -221,7 +221,7 @@ "time": "12:00pm", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "The trials and tribulations of building and deploying software on a cloud platform(AWS).A discussion of the silly, simple mistakes that cause you to have to work the weekend...and how to avoid them." }, { @@ -230,7 +230,7 @@ "time": "1:00pm", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "Distributed Computing on a Massive Scale: \n Living with Decentralization, P2P and the new Web. In this talk we discuss the forces pulling towards a new web, moving from overly centralised infrastructures to scalable decentralisation and distribution." }, { @@ -239,17 +239,17 @@ "time": "2:00pm", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, "description": "You’ll get an intro to what React is, how to get started with it, and also learn about React Router and Redux" }, { "name": "Lunch & Networking", - "by": "", + "by": "Somewhere in DCU", "time": "3:00pm", "place": { "id": "The Mezz", - "map": "" + "map": "Somewhere in DCU" }, - "description": "" + "description": "Somewhere in DCU" }] }] diff --git a/README.md b/README.md index 36d2db2..f65edf2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # TechWeek Website +[![Build Status](https://travis-ci.org/redbrick/techweek.dcu.ie.svg?branch=master)](https://travis-ci.org/redbrick/techweek.dcu.ie) This repository contains the Techweek website The website was written to have the Google Material Design look and feel. MaterializeCSS was used to speed up the process. diff --git a/bin/check-event-json b/bin/check-event-json index bc98b77..8e77606 100755 --- a/bin/check-event-json +++ b/bin/check-event-json @@ -1,15 +1,30 @@ #!/usr/bin/env node -var fs = require("fs"); -var filename = process.argv[2]; +var fs = require('fs'); +var file = process.argv[2]; +var glob = require("glob") -if (filename) { +if(file !== undefined && file !== null) { + checkJson(file); +} else { + glob('**/*.json', {'ignore': 'node_modules'}, function (er, files) { + if(er) { + console.error(er); + process.exit(1); + } + for(const i of files) { + checkJson(i); + } + process.exit(0); + }); +} + +function checkJson (filename) { try { - JSON.parse(fs.readFileSync(filename, "utf8")); - console.log("Look good"); + JSON.parse(fs.readFileSync(filename, 'utf8')); + console.log(filename + ' looks good'); } catch (err) { - console.error(err); + console.error(filename, err); + process.exit(1); } -} else { - console.log("Usage: check-event-json events.json"); } diff --git a/events.json b/events.json index 35038b8..65c08ea 100644 --- a/events.json +++ b/events.json @@ -1,21 +1,174 @@ [{ "day": "Monday", "description": "Data", - "events": [] + "events": [{ + "name": "Opening Event", + "by": "Redbrick DCU's Computer Networking Society", + "time": "11:45", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "Opening of TechWeek 2016, October edition" + },{ + "name": "TBA", + "by": "TBA", + "time": "12:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }, { + "name": "Lunch", + "by": "Food", + "time": "14:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "Lunch Time!" + },{ + "name": "TBA", + "by": "TBA", + "time": "15:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }] }, { "day": "Tuesday", "description": "Mobile Development", - "events": [] + "events": [{ + "name": "TBA", + "by": "TBA", + "time": "12:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }, { + "name": "Lunch", + "by": "Food", + "time": "14:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "Lunch Time!" + },{ + "name": "TBA", + "by": "TBA", + "time": "15:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }] }, { "day": "Wednesday", "description": "Networks and IoT", - "events": [] + "events": [{ + "name": "TBA", + "by": "TBA", + "time": "12:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }, { + "name": "Lunch", + "by": "Food", + "time": "14:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "Lunch Time!" + },{ + "name": "TBA", + "by": "TBA", + "time": "15:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }] }, { "day": "Thursday", "description": "STEM", - "events": [] + "events": [{ + "name": "TBA", + "by": "TBA", + "time": "12:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }, { + "name": "Lunch", + "by": "Food", + "time": "14:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "Lunch Time!" + },{ + "name": "TBA", + "by": "TBA", + "time": "15:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }] }, { "day": "Friday", "description": "Lightning Talks", - "events": [] + "events": [{ + "name": "TBA", + "by": "TBA", + "time": "12:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }, { + "name": "Lunch", + "by": "Food", + "time": "14:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "Lunch Time!" + }, { + "name": "Self Hosted IFTTT", + "by": "creadak - Craig Gavagan Mac Entee", + "time": "15:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "IFTTT. If This Then That. Five simple little words that help you automate your web applications. NodeRED is basically IFTTT. But on steroids. Craig'll show you how to wire some boxes together to do cool things" + },{ + "name": "TBA", + "by": "TBA", + "time": "16:00", + "place": { + "id": "The Mezz", + "map": "Somewhere in DCU" + }, + "description": "TBA" + }] }] diff --git a/gulpfile.js b/gulpfile.js index 08d04bb..bb1ba00 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,8 +4,9 @@ var cleanCSS = require('gulp-clean-css'); var minify = require('gulp-minify'); var rename = require('gulp-rename'); var connect = require('gulp-connect'); +var jsonSchema = require('gulp-json-schema'); -gulp.task('dev', ['compress', 'minify-css', 'less', 'webserver'], function () { +gulp.task('dev', ['compress', 'minify-css', 'less', 'webserver', 'validate'], function () { gulp.watch(['./css/*.less', './js/*.js', './**/*.html'], ['less', 'compress', 'html']); }); @@ -49,4 +50,9 @@ gulp.task('html', function () { .pipe(connect.reload()); }); -gulp.task('default', ['compress', 'minify-css', 'less']); +gulp.task('validate', () => { + return gulp.src(['./events.json', './2016/*.json', './2015/*.json']) + .pipe(jsonSchema('schema.json')); +}); + +gulp.task('default', ['compress', 'minify-css', 'less', 'validate']); diff --git a/js/main.js b/js/main.js index abed777..bd99cd4 100644 --- a/js/main.js +++ b/js/main.js @@ -42,10 +42,10 @@ var _hour = _minute * 60; var _day = _hour * 24; // setInterval allows you to do certain action every period of time (like cronjob) -setInterval(function(){ +setInterval(function() { // Check is current time + 10 minutes smaller than the starting time - if(now+1000*60*10 < start){ + if(now+1000*60*10 < start) { // If it is, show the box and start counting down $('.countdown').show(400); } else { @@ -53,7 +53,7 @@ setInterval(function(){ // Otherwise, show the livestream and abjust the height of it to be in // 19:6 aspect ratio // When done hiding the countdown show the livestream, make it take 400ms so there is a smooth transition - if(liveActive){ + if(liveActive) { showLive(); } } @@ -74,10 +74,10 @@ setInterval(function(){ }, 1000); // Set the time of the interval, in ms, so 1000 (1s) // Show the livefeed -function showLive(){ +function showLive() { if(!liveShown){ - $('.countdown').hide(400, function(){ - $('.livestream').show(0, function(){ + $('.countdown').hide(400, function() { + $('.livestream').show(0, function() { $('video').height(0); $('video').animate({height: $('video').width() * (9 / 16), display: 'block'}, 1000); }); @@ -87,13 +87,13 @@ function showLive(){ } // Load the events from the file and add them to the page -function loadEvents(days){ +function loadEvents(days) { var ce = $('.card-container__events'); for(var i = 0; i < days.length; i++) { var day = days[i]; - var ds = day.day+'-event'; - var ul = day.day+'-events'; - var de = $('
  • ' + day.day + ' - ' + day.description + '
      ').appendTo(ce); + var ul = day.day + '-events'; + var de = $('
    • ' + day.day + ' - ' + day.description + '
        '); + de.appendTo(ce); for(var j = 0; j < day.events.length; j++) { var event = day.events[j]; @@ -114,7 +114,7 @@ function loadEvents(days){ } } - $('h5').each( function( c ){ + $('h5').each( function( c ) { $(this).css({color: colors[(v+c) % 5]}); }); diff --git a/package.json b/package.json index cda0b3c..94e9867 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "This repository contains the Techweek website", "main": "gulpfile.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "eslint js/main,js && bin/check-event-json && gulp", "postinstall": "gulp" }, "repository": { @@ -21,9 +21,11 @@ "devDependencies": { "eslint": "^3.6.1", "eslint-plugin-json": "^1.2.0", + "glob": "^7.1.0", "gulp": "^3.9.1", "gulp-clean-css": "^2.0.12", "gulp-connect": "^5.0.0", + "gulp-json-schema": "^1.0.0", "gulp-less": "^3.1.0", "gulp-minify": "0.0.14", "gulp-rename": "^1.2.2" diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..b272b9f --- /dev/null +++ b/schema.json @@ -0,0 +1,72 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "array", + "uniqueItems": false, + "items": { + "type": "object", + "properties": { + "day": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string", + "minLength": 1 + }, + "events": { + "type": "array", + "uniqueItems": false, + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "by": { + "type": "string", + "minLength": 1 + }, + "time": { + "type": "string", + "minLength": 1 + }, + "place": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "map": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "id", + "map" + ] + }, + "description": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "name", + "by", + "time", + "place", + "description" + ] + } + } + }, + "required": [ + "day", + "description", + "events" + ] + } +}