From 3961d5056beaa7284cde3f1aef01d6173a04fa69 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sun, 6 Dec 2015 21:44:34 -0800 Subject: [PATCH] Add superblock ordering --- .../gear-up-for-success.json | 0 .../basic-bonfires.json | 0 .../basic-javascript.json | 0 .../basic-ziplines.json | 0 .../bootstrap.json | 0 .../front-end-development-certificate.json | 0 .../html5-and-css.json | 0 .../intermediate-bonfires.json | 0 .../intermediate-ziplines.json | 0 .../jquery.json | 0 .../json-apis-and-ajax.json | 0 ...t-oriented-and-functional-programming.json | 0 .../data-visualization-certificate.json | 0 .../data-visualization-projects.json | 0 .../react-projects.json | 0 .../advanced-bonfires.json | 0 .../api-projects.json | 0 .../automated-testing-and-debugging.json | 0 .../back-end-development-certificate.json | 0 .../backend-heavy-web-apps.json | 0 .../git.json | 0 .../mongodb.json | 0 .../nodejs-and-expressjs.json | 0 .../upper-intermediate-bonfires.json | 0 getChallenges.js | 24 +++++++++++++++++-- index.js | 2 ++ 26 files changed, 24 insertions(+), 2 deletions(-) rename challenges/{getting-started => 00-getting-started}/gear-up-for-success.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/basic-bonfires.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/basic-javascript.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/basic-ziplines.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/bootstrap.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/front-end-development-certificate.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/html5-and-css.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/intermediate-bonfires.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/intermediate-ziplines.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/jquery.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/json-apis-and-ajax.json (100%) rename challenges/{front-end-development-certification => 01-front-end-development-certification}/object-oriented-and-functional-programming.json (100%) rename challenges/{data-visualization-certification => 02-data-visualization-certification}/data-visualization-certificate.json (100%) rename challenges/{data-visualization-certification => 02-data-visualization-certification}/data-visualization-projects.json (100%) rename challenges/{data-visualization-certification => 02-data-visualization-certification}/react-projects.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/advanced-bonfires.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/api-projects.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/automated-testing-and-debugging.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/back-end-development-certificate.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/backend-heavy-web-apps.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/git.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/mongodb.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/nodejs-and-expressjs.json (100%) rename challenges/{back-end-development-certification => 03-back-end-development-certification}/upper-intermediate-bonfires.json (100%) diff --git a/challenges/getting-started/gear-up-for-success.json b/challenges/00-getting-started/gear-up-for-success.json similarity index 100% rename from challenges/getting-started/gear-up-for-success.json rename to challenges/00-getting-started/gear-up-for-success.json diff --git a/challenges/front-end-development-certification/basic-bonfires.json b/challenges/01-front-end-development-certification/basic-bonfires.json similarity index 100% rename from challenges/front-end-development-certification/basic-bonfires.json rename to challenges/01-front-end-development-certification/basic-bonfires.json diff --git a/challenges/front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json similarity index 100% rename from challenges/front-end-development-certification/basic-javascript.json rename to challenges/01-front-end-development-certification/basic-javascript.json diff --git a/challenges/front-end-development-certification/basic-ziplines.json b/challenges/01-front-end-development-certification/basic-ziplines.json similarity index 100% rename from challenges/front-end-development-certification/basic-ziplines.json rename to challenges/01-front-end-development-certification/basic-ziplines.json diff --git a/challenges/front-end-development-certification/bootstrap.json b/challenges/01-front-end-development-certification/bootstrap.json similarity index 100% rename from challenges/front-end-development-certification/bootstrap.json rename to challenges/01-front-end-development-certification/bootstrap.json diff --git a/challenges/front-end-development-certification/front-end-development-certificate.json b/challenges/01-front-end-development-certification/front-end-development-certificate.json similarity index 100% rename from challenges/front-end-development-certification/front-end-development-certificate.json rename to challenges/01-front-end-development-certification/front-end-development-certificate.json diff --git a/challenges/front-end-development-certification/html5-and-css.json b/challenges/01-front-end-development-certification/html5-and-css.json similarity index 100% rename from challenges/front-end-development-certification/html5-and-css.json rename to challenges/01-front-end-development-certification/html5-and-css.json diff --git a/challenges/front-end-development-certification/intermediate-bonfires.json b/challenges/01-front-end-development-certification/intermediate-bonfires.json similarity index 100% rename from challenges/front-end-development-certification/intermediate-bonfires.json rename to challenges/01-front-end-development-certification/intermediate-bonfires.json diff --git a/challenges/front-end-development-certification/intermediate-ziplines.json b/challenges/01-front-end-development-certification/intermediate-ziplines.json similarity index 100% rename from challenges/front-end-development-certification/intermediate-ziplines.json rename to challenges/01-front-end-development-certification/intermediate-ziplines.json diff --git a/challenges/front-end-development-certification/jquery.json b/challenges/01-front-end-development-certification/jquery.json similarity index 100% rename from challenges/front-end-development-certification/jquery.json rename to challenges/01-front-end-development-certification/jquery.json diff --git a/challenges/front-end-development-certification/json-apis-and-ajax.json b/challenges/01-front-end-development-certification/json-apis-and-ajax.json similarity index 100% rename from challenges/front-end-development-certification/json-apis-and-ajax.json rename to challenges/01-front-end-development-certification/json-apis-and-ajax.json diff --git a/challenges/front-end-development-certification/object-oriented-and-functional-programming.json b/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json similarity index 100% rename from challenges/front-end-development-certification/object-oriented-and-functional-programming.json rename to challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json diff --git a/challenges/data-visualization-certification/data-visualization-certificate.json b/challenges/02-data-visualization-certification/data-visualization-certificate.json similarity index 100% rename from challenges/data-visualization-certification/data-visualization-certificate.json rename to challenges/02-data-visualization-certification/data-visualization-certificate.json diff --git a/challenges/data-visualization-certification/data-visualization-projects.json b/challenges/02-data-visualization-certification/data-visualization-projects.json similarity index 100% rename from challenges/data-visualization-certification/data-visualization-projects.json rename to challenges/02-data-visualization-certification/data-visualization-projects.json diff --git a/challenges/data-visualization-certification/react-projects.json b/challenges/02-data-visualization-certification/react-projects.json similarity index 100% rename from challenges/data-visualization-certification/react-projects.json rename to challenges/02-data-visualization-certification/react-projects.json diff --git a/challenges/back-end-development-certification/advanced-bonfires.json b/challenges/03-back-end-development-certification/advanced-bonfires.json similarity index 100% rename from challenges/back-end-development-certification/advanced-bonfires.json rename to challenges/03-back-end-development-certification/advanced-bonfires.json diff --git a/challenges/back-end-development-certification/api-projects.json b/challenges/03-back-end-development-certification/api-projects.json similarity index 100% rename from challenges/back-end-development-certification/api-projects.json rename to challenges/03-back-end-development-certification/api-projects.json diff --git a/challenges/back-end-development-certification/automated-testing-and-debugging.json b/challenges/03-back-end-development-certification/automated-testing-and-debugging.json similarity index 100% rename from challenges/back-end-development-certification/automated-testing-and-debugging.json rename to challenges/03-back-end-development-certification/automated-testing-and-debugging.json diff --git a/challenges/back-end-development-certification/back-end-development-certificate.json b/challenges/03-back-end-development-certification/back-end-development-certificate.json similarity index 100% rename from challenges/back-end-development-certification/back-end-development-certificate.json rename to challenges/03-back-end-development-certification/back-end-development-certificate.json diff --git a/challenges/back-end-development-certification/backend-heavy-web-apps.json b/challenges/03-back-end-development-certification/backend-heavy-web-apps.json similarity index 100% rename from challenges/back-end-development-certification/backend-heavy-web-apps.json rename to challenges/03-back-end-development-certification/backend-heavy-web-apps.json diff --git a/challenges/back-end-development-certification/git.json b/challenges/03-back-end-development-certification/git.json similarity index 100% rename from challenges/back-end-development-certification/git.json rename to challenges/03-back-end-development-certification/git.json diff --git a/challenges/back-end-development-certification/mongodb.json b/challenges/03-back-end-development-certification/mongodb.json similarity index 100% rename from challenges/back-end-development-certification/mongodb.json rename to challenges/03-back-end-development-certification/mongodb.json diff --git a/challenges/back-end-development-certification/nodejs-and-expressjs.json b/challenges/03-back-end-development-certification/nodejs-and-expressjs.json similarity index 100% rename from challenges/back-end-development-certification/nodejs-and-expressjs.json rename to challenges/03-back-end-development-certification/nodejs-and-expressjs.json diff --git a/challenges/back-end-development-certification/upper-intermediate-bonfires.json b/challenges/03-back-end-development-certification/upper-intermediate-bonfires.json similarity index 100% rename from challenges/back-end-development-certification/upper-intermediate-bonfires.json rename to challenges/03-back-end-development-certification/upper-intermediate-bonfires.json diff --git a/getChallenges.js b/getChallenges.js index 982ddb3d6e..12ccc5927f 100644 --- a/getChallenges.js +++ b/getChallenges.js @@ -1,7 +1,7 @@ +/* eslint-disable no-self-compare */ var fs = require('fs'); var path = require('path'); - function getFilesFor(dir) { return fs.readdirSync(path.join(__dirname, '/' + dir)) .map(function(file) { @@ -27,13 +27,33 @@ function getFilesFor(dir) { }, []); } +function getSupOrder(filePath) { + var order = parseInt((filePath || '').split('-')[0], 10); + // check for NaN + if (order !== order) { + return 0; + } + return order; +} + +function getSupName(filePath) { + var order = parseInt((filePath || '').split('-')[0], 10); + // check for NaN + if (order !== order) { + return filePath; + } + + return (filePath || '').split('-').splice(1).join('-'); +} + module.exports = function getChallenges() { try { return getFilesFor('challenges') .map(function(data) { var challengeSpec = require('./challenges/' + data.file); challengeSpec.fileName = data.file; - challengeSpec.superBlock = data.superBlock; + challengeSpec.superBlock = getSupName(data.superBlock); + challengeSpec.superBlockOrder = getSupOrder(data.superBlock); return challengeSpec; }); diff --git a/index.js b/index.js index 6ca98c33bb..98dd3255ea 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,7 @@ destroy() var order = challengeSpec.order; var block = challengeSpec.name; var superBlock = challengeSpec.superBlock; + var superBlockOrder = challengeSpec.superBlockOrder; var isBeta = !!challengeSpec.isBeta; var fileName = challengeSpec.fileName; console.log('parsed %s successfully', block); @@ -46,6 +47,7 @@ destroy() challenge.block = block; challenge.isBeta = challenge.isBeta || isBeta; challenge.time = challengeSpec.time; + challenge.superBlockOrder = superBlockOrder; challenge.superBlock = superBlock .split('-') .map(function(word) {