diff --git a/assets/css/2-double-bounce.css b/assets/css/2-double-bounce.css deleted file mode 100755 index 92c34ef8..00000000 --- a/assets/css/2-double-bounce.css +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This is Spinkit by the awesome Tobias Ahlin! - * http://tobiasahlin.com/spinkit/ - */ -/* - * Usage: - * -
-
-
-
- * - */ -.sk-double-bounce { - width: 40px; - height: 40px; - position: relative; - margin: 40px auto; } - .sk-double-bounce .sk-child { - width: 100%; - height: 100%; - border-radius: 50%; - background-color: #333; - opacity: 0.6; - position: absolute; - top: 0; - left: 0; - -webkit-animation: sk-doubleBounce 2s infinite ease-in-out; - animation: sk-doubleBounce 2s infinite ease-in-out; } - .sk-double-bounce .sk-double-bounce2 { - -webkit-animation-delay: -1.0s; - animation-delay: -1.0s; } - -@-webkit-keyframes sk-doubleBounce { - 0%, 100% { - -webkit-transform: scale(0); - transform: scale(0); } - 50% { - -webkit-transform: scale(1); - transform: scale(1); } } - -@keyframes sk-doubleBounce { - 0%, 100% { - -webkit-transform: scale(0); - transform: scale(0); } - 50% { - -webkit-transform: scale(1); - transform: scale(1); } } diff --git a/assets/css/new-challenge.css b/assets/css/new-challenge.css index 9b50ac3a..c70eb786 100644 --- a/assets/css/new-challenge.css +++ b/assets/css/new-challenge.css @@ -117,63 +117,56 @@ gre7-border.border-box code { display: inline-block; } - /* VERIFY - -------------------------------------------------------------------------- */ +/* VERIFY + -------------------------------------------------------------------------- */ - .verify h3 { - display: inline-block; - padding-right: 12px; - } - - #path-required-warning, - #div-selected-dir{ - padding: 6px 12px 6px 10px; - vertical-align: middle; - margin-bottom: 0; - font-size: 13px; - font-weight: 400; - text-align: center; - white-space: nowrap; - margin-left: -3px; - color: #8cf; - } +.verify h3 { + display: inline-block; + padding-right: 12px; +} - .verify-fail:before { - content: '✗ '; - } +#path-required-warning, +#div-selected-dir{ + padding: 6px 12px 6px 10px; + vertical-align: middle; + margin-bottom: 0; + font-size: 13px; + font-weight: 400; + text-align: center; + white-space: nowrap; + margin-left: -3px; + color: #8cf; +} - .verify-pass:before { - content: '✔︎ '; - } +.verify-fail:before { + content: '✗ '; +} - #verify-list { - display: none; - list-style: none; - padding-left: 0; - } +.verify-pass:before { + content: '✔︎ '; +} - #challenge-completed { - color: #2BDA9E; - font-size: 24px; - font-family: "NothingYouCouldDo"; - } +#verify-list { + display: none; + list-style: none; + padding-left: 0; +} - #challenge-completed h2 { - padding: 0; margin: 0; - } +#challenge-completed { + color: #2BDA9E; + font-size: 24px; + font-family: "NothingYouCouldDo"; +} - #verify-spinner.sk-double-bounce { - display: none; - width: 26px; - height: 26px; - position: relative; - margin: 0 auto 0 14px; - vertical-align: middle; - } +#challenge-completed h2 { + padding: 0; margin: 0; +} - #verify-spinner.sk-double-bounce .sk-child { - background-color: #E0E0E0; - } +#verify-spinner.sk-bounce { + display: none; + margin-left: 14px; + vertical-align: middle; +} /* CODE STYLES -------------------------------------------------------------------------- */ diff --git a/assets/css/sk-bounce.css b/assets/css/sk-bounce.css new file mode 100644 index 00000000..6e677176 --- /dev/null +++ b/assets/css/sk-bounce.css @@ -0,0 +1,46 @@ +/* + * This is a part of Spinkit by the awesome Tobias Ahlin! + * http://tobiasahlin.com/spinkit/ + */ + +/* Bounce Usage +
+
+
+
+*/ + +/* Config */ +:root { + --sk-size: 26px; + --sk-color: #E0E0E0; +} + +/* Implementation */ +.sk-bounce { + width: var(--sk-size); + height: var(--sk-size); + position: relative; +} + +.sk-bounce-dot { + width: 100%; + height: 100%; + border-radius: 50%; + background-color: var(--sk-color); + opacity: 0.6; + position: absolute; + top: 0; + left: 0; + animation: sk-bounce 2s infinite cubic-bezier(0.455, 0.03, 0.515, 0.955); +} + +.sk-bounce-dot:nth-child(2) { animation-delay: -1.0s; } + +@keyframes sk-bounce { + 0%, 100% { + transform: scale(0); + } 45%, 55% { + transform: scale(1); + } +} diff --git a/lib/verify/branches_arent_just_for_birds.js b/lib/verify/branches_arent_just_for_birds.js index ff5ecc95..1f1fa7cc 100644 --- a/lib/verify/branches_arent_just_for_birds.js +++ b/lib/verify/branches_arent_just_for_birds.js @@ -7,7 +7,7 @@ const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } // verify they've pushed // check the file is in contributors directory -module.exports = function (repopath) { +module.exports = async function (repopath) { const result = getEmptyVerifyResult() let username = '' @@ -19,7 +19,7 @@ module.exports = function (repopath) { // Get stored username try { - username = execGit('config user.username', { cwd: repopath }) + username = await execGit('config user.username', { cwd: repopath }) } catch (err) { addToVerifyList('Error: ' + err.message, false, result.verifyList) return result @@ -27,7 +27,7 @@ module.exports = function (repopath) { let currentBranch = '' try { - currentBranch = execGit('rev-parse --abbrev-ref HEAD', { cwd: repopath }) + currentBranch = await execGit('rev-parse --abbrev-ref HEAD', { cwd: repopath }) const expectedBranch = 'add-' + username if (currentBranch.match(expectedBranch)) { @@ -67,7 +67,7 @@ module.exports = function (repopath) { // TODO look into this, is using reflog the best way? what about origin? // sometimes it seems this doesn't work try { - const log = execGit('reflog show origin/' + currentBranch, { cwd: repopath }) + const log = await execGit('reflog show origin/' + currentBranch, { cwd: repopath }) if (log.match('update by push')) { addToVerifyList('verify~Changes have been pushed!', true, result.verifyList) diff --git a/lib/verify/commit_to_it.js b/lib/verify/commit_to_it.js index 54d76953..41496e54 100644 --- a/lib/verify/commit_to_it.js +++ b/lib/verify/commit_to_it.js @@ -2,7 +2,7 @@ const fs = require('fs') const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } = require('./verify-helpers') // check that they've commited changes -module.exports = function (path) { +module.exports = async function (path) { const result = getEmptyVerifyResult() // path should be a directory @@ -12,7 +12,7 @@ module.exports = function (path) { } try { - const show = execGit('status', { cwd: path }) + const show = await execGit('status', { cwd: path }) if (show.match('No commits yet')) { addToVerifyList("verify~Can't find committed changes.", false, result.verifyList) diff --git a/lib/verify/forks_and_clones.js b/lib/verify/forks_and_clones.js index 3cce4e1b..e8b72db7 100644 --- a/lib/verify/forks_and_clones.js +++ b/lib/verify/forks_and_clones.js @@ -5,7 +5,7 @@ const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } // that they've also then forked and cloned. // TODO Separate check on fork for nice feedback?! -module.exports = function (path) { +module.exports = async function (path) { const result = getEmptyVerifyResult() let username = '' @@ -17,7 +17,7 @@ module.exports = function (path) { // Get stored username try { - username = execGit('config user.username') + username = await execGit('config user.username') } catch (err) { addToVerifyList('Error: ' + err.message, false, result.verifyList) return result @@ -25,7 +25,7 @@ module.exports = function (path) { let remotes = [] try { - const out = execGit('remote -v', { cwd: path }) + const out = await execGit('remote -v', { cwd: path }) remotes = out.split('\n') if (remotes.length !== 4) { diff --git a/lib/verify/get_git.js b/lib/verify/get_git.js index 99277a66..b8513446 100644 --- a/lib/verify/get_git.js +++ b/lib/verify/get_git.js @@ -3,12 +3,12 @@ const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } // TODO // Think about how best to show errors to user -module.exports = function () { +module.exports = async function () { const result = getEmptyVerifyResult() // Check version, return if no git installed, as further checks are useless. try { - const gitOutput = execGit('--version') + const gitOutput = await execGit('--version') if (gitOutput.match('git version')) { addToVerifyList('verify~Found Git installed!', true, result.verifyList) @@ -24,7 +24,7 @@ module.exports = function () { // Check user.name try { - const name = execGit('config user.name') + const name = await execGit('config user.name') if (name !== '') { addToVerifyList('verify~Name Added!', true, result.verifyList) @@ -38,7 +38,7 @@ module.exports = function () { // Check user.email try { - const email = execGit('config user.email') + const email = await execGit('config user.email') if (email !== '') { addToVerifyList('verify~Email Added!', true, result.verifyList) diff --git a/lib/verify/githubbin.js b/lib/verify/githubbin.js index 1a9ddee2..9f5180c7 100644 --- a/lib/verify/githubbin.js +++ b/lib/verify/githubbin.js @@ -19,7 +19,7 @@ module.exports = async function () { // Check if username has been set on git-config try { - username = execGit('config user.username') + username = await execGit('config user.username') if (username === '') { addToVerifyList('verify~No username found.', false, result.verifyList) diff --git a/lib/verify/its_a_small_world.js b/lib/verify/its_a_small_world.js index 9e7c49f3..6c7ec596 100644 --- a/lib/verify/its_a_small_world.js +++ b/lib/verify/its_a_small_world.js @@ -9,7 +9,7 @@ module.exports = async function () { // Get stored username try { - username = execGit('config user.username') + username = await execGit('config user.username') } catch (err) { addToVerifyList('Error: ' + err.message, false, result.verifyList) return result diff --git a/lib/verify/merge_tada.js b/lib/verify/merge_tada.js index ab462664..fbcff6e8 100644 --- a/lib/verify/merge_tada.js +++ b/lib/verify/merge_tada.js @@ -4,7 +4,7 @@ const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } // check that they performed a merge // check there is not username named branch -module.exports = function (path) { +module.exports = async function (path) { const result = getEmptyVerifyResult() let username = '' @@ -16,7 +16,7 @@ module.exports = function (path) { // Get stored username try { - username = execGit('config user.username') + username = await execGit('config user.username') } catch (err) { addToVerifyList('Error: ' + err.message, false, result.verifyList) return result @@ -24,7 +24,7 @@ module.exports = function (path) { // Search log for merge activity try { - const ref = execGit('reflog -10', { cwd: path }) + const ref = await execGit('reflog -10', { cwd: path }) if (ref.match('merge add-' + username)) { addToVerifyList('verify~Your branch has been merged!', true, result.verifyList) } else { @@ -36,7 +36,7 @@ module.exports = function (path) { // Check if branch still exists try { - const branches = execGit('branch', { cwd: path }) + const branches = await execGit('branch', { cwd: path }) if (branches.match('add-' + username)) { addToVerifyList('verify~Uh oh, your branch is still there.', false, result.verifyList) } else { diff --git a/lib/verify/pull_never_out_of_date.js b/lib/verify/pull_never_out_of_date.js index b55aa7bc..e9915d02 100644 --- a/lib/verify/pull_never_out_of_date.js +++ b/lib/verify/pull_never_out_of_date.js @@ -3,11 +3,11 @@ const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } // do a fetch dry run to see if there is anything // to pull; if there is they haven't pulled yet -module.exports = function (path) { +module.exports = async function (path) { const result = getEmptyVerifyResult() try { - const status = execGit('fetch --dry-run', { cwd: path }) + const status = await execGit('fetch --dry-run', { cwd: path }) if (status === '') { addToVerifyList('verify~Up to date!', true, result.verifyList) diff --git a/lib/verify/remote_control.js b/lib/verify/remote_control.js index 8cd60467..b9c05511 100644 --- a/lib/verify/remote_control.js +++ b/lib/verify/remote_control.js @@ -1,7 +1,7 @@ const fs = require('fs') const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } = require('./verify-helpers') -module.exports = function (path) { +module.exports = async function (path) { const result = getEmptyVerifyResult() // path should be a directory @@ -12,7 +12,7 @@ module.exports = function (path) { // Checks for added remote try { - const remotes = execGit('remote -v', { cwd: path }) + const remotes = await execGit('remote -v', { cwd: path }) if (remotes.match('origin')) { addToVerifyList('verify~Found remote set up.', true, result.verifyList) @@ -27,7 +27,7 @@ module.exports = function (path) { // check that they've made a push try { - const ref = execGit('reflog show origin/master', { cwd: path }) + const ref = await execGit('reflog show origin/master', { cwd: path }) if (ref.match('update by push')) { addToVerifyList('verify~You pushed changes!', true, result.verifyList) diff --git a/lib/verify/repository.js b/lib/verify/repository.js index afb6d796..c5762753 100644 --- a/lib/verify/repository.js +++ b/lib/verify/repository.js @@ -1,7 +1,7 @@ const fs = require('fs') const { addToVerifyList, checkChallengeComplete, execGit, getEmptyVerifyResult } = require('./verify-helpers') -module.exports = function (path) { +module.exports = async function (path) { const result = getEmptyVerifyResult() // path should be a directory @@ -11,7 +11,7 @@ module.exports = function (path) { } try { - const status = execGit('status', { cwd: path }) + const status = await execGit('status', { cwd: path }) if (status.match('On branch')) { addToVerifyList('verify~This is a Git repository!', true, result.verifyList) diff --git a/lib/verify/requesting_you_pull_please.js b/lib/verify/requesting_you_pull_please.js index 847a6e25..ef3264bf 100644 --- a/lib/verify/requesting_you_pull_please.js +++ b/lib/verify/requesting_you_pull_please.js @@ -12,7 +12,7 @@ module.exports = async function () { // Get stored username try { - username = execGit('config user.username') + username = await execGit('config user.username') } catch (err) { addToVerifyList('Error: ' + err.message, false, result.verifyList) return result diff --git a/lib/verify/verify-helpers.js b/lib/verify/verify-helpers.js index b2af8708..30167819 100644 --- a/lib/verify/verify-helpers.js +++ b/lib/verify/verify-helpers.js @@ -2,7 +2,9 @@ * Helpers for challenge-specific verification-scripts */ -const execSync = require('child_process').execSync +const { exec } = require('child_process') +const { promisify } = require('util') +const execPromise = promisify(exec) // Set each challenge verifying process to use // English language pack @@ -33,14 +35,15 @@ function checkChallengeComplete (verifyList) { /* * Wrapper to the exec call used in each of the verify scripts. */ -function execGit (command, options = {}) { +async function execGit (command, options = {}) { // Encoding utf8 for usable output Object.assign(options, { encoding: 'utf8' }) // Use system-Git to execute command, trim output - return execSync('git ' + command, options).trim() + const execResult = await execPromise('git ' + command, options) + return execResult.stdout.trim() } /* diff --git a/resources/content/partials/verify-button.hbs b/resources/content/partials/verify-button.hbs index dd62fd4b..542216ae 100644 --- a/resources/content/partials/verify-button.hbs +++ b/resources/content/partials/verify-button.hbs @@ -1,8 +1,8 @@
-
-
-
+
+
+
diff --git a/resources/content/partials/verify-directory-button.hbs b/resources/content/partials/verify-directory-button.hbs index c36c6167..be273205 100644 --- a/resources/content/partials/verify-directory-button.hbs +++ b/resources/content/partials/verify-directory-button.hbs @@ -1,9 +1,9 @@
-
-
-
+
+
+
diff --git a/resources/layouts/challenge.hbs b/resources/layouts/challenge.hbs index 645c464f..128d3b78 100644 --- a/resources/layouts/challenge.hbs +++ b/resources/layouts/challenge.hbs @@ -4,7 +4,7 @@ Git-it - +