From f6a358874605425f6b8ede29c054f0936cf730d5 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Fri, 13 Oct 2017 10:11:01 -0700 Subject: [PATCH 01/11] Changes to css --- public/css/master.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/css/master.css b/public/css/master.css index 096d741..d1566cf 100644 --- a/public/css/master.css +++ b/public/css/master.css @@ -11,15 +11,17 @@ html { .project { display: flex; font-family: 'Yantramanav', sans-serif; - margin: 5px; + margin: 30px; border: 1px outset silver; box-shadow: 0 0 5px 10px silver; + font-size: 120%; padding: 15px; text-shadow: .75px .75px .75px black; flex-direction: column; justify-content: space-between; border-radius: 15px; - box-shadow: inset 10px 3px 38px 2px rgba(176,222,165,0.15); + box-shadow: inset 10px 3px 38px 2px rgba(1m run dev + 76,222,165,0.15); src: url(sansation_light.woff); } From 6e429cd4b67c064dd0a51e5ad9dc19c3ccdf6ca3 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Fri, 13 Oct 2017 18:59:03 -0700 Subject: [PATCH 02/11] updated api for v2 --- app.js | 76 ++++++----- auth.js | 16 +++ package-lock.json | 332 +++++++++++++++++++++++++++++++++++++--------- package.json | 2 + test.js | 29 ++++ utilities.js | 25 ++++ views/index.ejs | 9 +- 7 files changed, 388 insertions(+), 101 deletions(-) create mode 100644 auth.js create mode 100644 test.js create mode 100644 utilities.js diff --git a/app.js b/app.js index 8f481be..3835bc4 100644 --- a/app.js +++ b/app.js @@ -1,50 +1,60 @@ const express = require('express'); +require('dotenv').load(); + const app = express(); const request = require('request-promise'); +const getAuth = require('./auth'); +const { removeDuplicateProjects } = require('./utilities'); app.use(express.static('public')); app.set('view engine', 'ejs'); -const options = { - method: 'GET', - url: 'https://codeship.com/api/v1/projects.json', - qs: { api_key: '504c1e208ab901352ec212dfc1f1389b' }, - timeout: 1000, -}; +function renderProjects(res) { -const getProjects = (() => request(options).then(json => JSON.parse(json))); + const authOptions = { + method: 'POST', + url: 'https://api.codeship.com/v2/auth', + headers: + { + authorization: 'Basic bWlrZXRoZWtsZWluQGdtYWlsLmNvbTpJbGF3aGR5NjY=', + 'content-type': 'application/json', + }, + body: '{}', + }; -function deepCompare(objectA, objectB) { - return Object.values(objectA).join('') === Object.values(objectB).join(''); -} + const getAuth = (() => request(authOptions).then(body => JSON.parse(body))); -function deepIncludes(array, object) { - for (let i = 0; i < array.length; i += 1) { - if (deepCompare(array[i], object)) { - return true; - } - } - return false; -} + getAuth() + .then((user) => { + const options = { + method: 'GET', + url: `https://api.codeship.com/v2/organizations/${user.organizations[0].uuid}/projects`, + headers: { authorization: `${user.access_token}` }, + body: '{}', + timeout: 1000, + }; -function removeDuplicateProjects(projectsArray) { - const result = []; - for (let i = 0; i < projectsArray.length; i += 1) { - const alreadyInResult = deepIncludes(result, projectsArray[i]); - if (!alreadyInResult && projectsArray[i].repository_name !== null) { - result.push(projectsArray[i]); - } - } - return result; -} + const getProjects = (() => request(options).then(json => JSON.parse(json))); -function renderProjects(res) { - getProjects() - .then((projects) => { - const uniqueProjects = removeDuplicateProjects(projects.projects); - return res.render('index', { projects: uniqueProjects }); + getProjects() + .then((projects) => { + function listBuilds(organizationId, projectId) { + return request({ + uri: apiUrl + '/organizations/' + organizationId + '/projects/' + projectId + '/builds', + method: 'GET', + json: true, + headers: { + 'Content-Type': 'application/json', + 'Authorization': authorization.access_token, + }, + }); + } + const uniqueProjects = removeDuplicateProjects(projects.projects); + console.log( '---===uniqueProjects===---', uniqueProjects ) + return res.render('index', { projects: uniqueProjects }); + }); }); } diff --git a/auth.js b/auth.js new file mode 100644 index 0000000..ed71c2d --- /dev/null +++ b/auth.js @@ -0,0 +1,16 @@ +const request = require('request'); + +const authOptions = { + method: 'POST', + url: 'https://api.codeship.com/v2/auth', + headers: + { + authorization: 'Basic bWlrZXRoZWtsZWluQGdtYWlsLmNvbTpJbGF3aGR5NjY=', + 'content-type': 'application/json', + }, + body: '{}', +}; + +const getAuth = (() => request(authOptions).then(body => JSON.parse(body))); + +module.exports = getAuth; diff --git a/package-lock.json b/package-lock.json index 0e1d215..b629747 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,8 +7,7 @@ "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "accepts": { "version": "1.3.4", @@ -77,8 +76,7 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "2.2.1", @@ -96,6 +94,20 @@ "normalize-path": "2.1.1" } }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "are-we-there-yet": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.3.3" + } + }, "argparse": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", @@ -221,8 +233,23 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "bcrypt": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-1.0.3.tgz", + "integrity": "sha512-pRyDdo73C8Nim3jwFJ7DWe3TZCgwDfWZ6nHS5LSdU77kWbj1frruvdndP02AOavtD4y8v6Fp2dolbHgp4SDrfg==", + "requires": { + "nan": "2.6.2", + "node-pre-gyp": "0.6.36" + }, + "dependencies": { + "nan": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", + "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=" + } + } }, "bcrypt-pbkdf": { "version": "1.0.1", @@ -239,11 +266,18 @@ "integrity": "sha1-muuabF6IY4qtFx4Wf1kAq+JINdA=", "dev": true }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "requires": { + "inherits": "2.0.3" + } + }, "bluebird": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", - "dev": true + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" }, "body-parser": { "version": "1.18.2", @@ -289,7 +323,6 @@ "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" @@ -432,8 +465,7 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "color-convert": { "version": "1.9.0", @@ -461,8 +493,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { "version": "1.6.0", @@ -489,6 +520,11 @@ "xdg-basedir": "3.0.0" } }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, "contains-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", @@ -583,8 +619,7 @@ "deep-extend": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", - "dev": true + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=" }, "deep-is": { "version": "0.1.3", @@ -612,6 +647,11 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, "depd": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", @@ -641,6 +681,11 @@ "is-obj": "1.0.1" } }, + "dotenv": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-4.0.0.tgz", + "integrity": "sha1-hk7xN5rO1Vzm+V3r7NzhefegzR0=" + }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -1123,8 +1168,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { "version": "1.1.2", @@ -2025,6 +2069,27 @@ } } }, + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.2" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", + "integrity": "sha1-nDHa40dnAY/h0kmyTa2mfQktoQU=", + "requires": { + "fstream": "1.0.11", + "inherits": "2.0.3", + "minimatch": "3.0.4" + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -2037,6 +2102,49 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "requires": { + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "2.1.1" + } + } + } + }, "get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", @@ -2055,7 +2163,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", @@ -2126,8 +2233,7 @@ "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, "har-schema": { "version": "2.0.0", @@ -2167,6 +2273,11 @@ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", @@ -2250,7 +2361,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "1.4.0", "wrappy": "1.0.2" @@ -2264,8 +2374,7 @@ "ini": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", - "dev": true + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=" }, "inquirer": { "version": "3.3.0", @@ -2464,8 +2573,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -2615,8 +2723,7 @@ "lodash": { "version": "4.17.4", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, "lodash._baseassign": { "version": "3.2.0", @@ -2814,7 +2921,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "1.1.8" } @@ -2822,14 +2928,12 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, "requires": { "minimist": "0.0.8" } @@ -2863,6 +2967,33 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, + "node-pre-gyp": { + "version": "0.6.36", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz", + "integrity": "sha1-22BBEst04NR3VU6bUFsXq936t4Y=", + "requires": { + "mkdirp": "0.5.1", + "nopt": "4.0.1", + "npmlog": "4.1.2", + "rc": "1.2.1", + "request": "2.83.0", + "rimraf": "2.6.2", + "semver": "5.4.1", + "tar": "2.2.1", + "tar-pack": "3.4.0" + }, + "dependencies": { + "nopt": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "requires": { + "abbrev": "1.1.1", + "osenv": "0.1.4" + } + } + } + }, "nodemon": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.12.1.tgz", @@ -2920,11 +3051,21 @@ "path-key": "2.0.1" } }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "oauth-sign": { "version": "0.8.2", @@ -2934,8 +3075,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "object.omit": { "version": "2.0.1", @@ -2959,7 +3099,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1.0.2" } @@ -2987,11 +3126,24 @@ "wordwrap": "1.0.0" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "osenv": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } }, "p-finally": { "version": "1.0.0", @@ -3064,8 +3216,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-is-inside": { "version": "1.0.2", @@ -3170,8 +3321,7 @@ "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, "progress": { "version": "2.0.0", @@ -3274,7 +3424,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", - "dev": true, "requires": { "deep-extend": "0.4.2", "ini": "1.3.4", @@ -3285,8 +3434,7 @@ "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } }, @@ -3326,7 +3474,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", @@ -3428,7 +3575,6 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.2.tgz", "integrity": "sha1-0epG1lSm7k+O5qT+oQGMIpEZBLQ=", - "dev": true, "requires": { "bluebird": "3.5.1", "request-promise-core": "1.1.1", @@ -3440,7 +3586,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", - "dev": true, "requires": { "lodash": "4.17.4" } @@ -3484,7 +3629,6 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, "requires": { "glob": "7.1.2" } @@ -3521,8 +3665,7 @@ "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" }, "semver-diff": { "version": "2.1.0", @@ -3564,6 +3707,11 @@ "send": "0.16.1" } }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", @@ -3593,8 +3741,7 @@ "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "slice-ansi": { "version": "1.0.0", @@ -3672,8 +3819,7 @@ "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", - "dev": true + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" }, "stream-combiner": { "version": "0.0.4", @@ -3698,7 +3844,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, "requires": { "safe-buffer": "5.1.1" } @@ -3740,8 +3885,7 @@ "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "supports-color": { "version": "2.0.0", @@ -3763,6 +3907,31 @@ "string-width": "2.1.1" } }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "tar-pack": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.0.tgz", + "integrity": "sha1-I74tf2cagzk3bL2wuP4/3r8xeYQ=", + "requires": { + "debug": "2.6.9", + "fstream": "1.0.11", + "fstream-ignore": "1.0.5", + "once": "1.4.0", + "readable-stream": "2.3.3", + "rimraf": "2.6.2", + "tar": "2.2.1", + "uid-number": "0.0.6" + } + }, "term-size": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", @@ -3860,6 +4029,11 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "uid-number": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", + "integrity": "sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=" + }, "undefsafe": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-0.0.3.tgz", @@ -3938,8 +4112,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "utils-merge": { "version": "1.0.1", @@ -3985,6 +4158,42 @@ "isexe": "2.0.0" } }, + "wide-align": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "requires": { + "string-width": "1.0.2" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "2.1.1" + } + } + } + }, "widest-line": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", @@ -4034,8 +4243,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { "version": "0.2.1", diff --git a/package.json b/package.json index 90a0777..651066a 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,9 @@ }, "homepage": "https://github.com/mKleinCreative/status#readme", "dependencies": { + "bcrypt": "^1.0.3", "body-parser": "^1.18.2", + "dotenv": "^4.0.0", "ejs": "^2.5.7", "express": "^4.16.1", "request": "^2.83.0", diff --git a/test.js b/test.js new file mode 100644 index 0000000..6ad22d9 --- /dev/null +++ b/test.js @@ -0,0 +1,29 @@ +// curl --request POST \ +// --url 'https://codeship.com/api/v2/auth' \ +// --header 'content-type: text/plain' \ +// --data '{}' +// +// +// curl --request POST --url api.codeship.com/v2/auth --header ‘authorization: Basic ampqajpwcHBw’ --header ‘content-type: application/json’ --data ‘{“username”:“lallala”, “password” : “ksdjfkaj”}’ +// +// `curl --request POST --url https://api.codeship.com/v2/auth --header 'authorization: Basic' --header 'content-type: application/json' --data '{"username":"miketheklein@gmail.com", "password" : "Ilawhdy66"}'` +// + `curl --request POST --url https://api.codeship.com/v2/auth --header 'content-type: application/json' --data '{}' --user miketheklein@gmail.com:Ilawhdy66` + +var request = require("request"); +var options = { method: 'POST', +url: 'https://api.codeship.com/v2/auth', +headers: +{ authorization: 'Basic bWlrZXRoZWtsZWluQGdtYWlsLmNvbTpJbGF3aGR5NjY=', +'content-type': 'application/json' }, +body: '{}' }; + +function getAuth(){ + request(options, function (error, response, body) { + if (error) throw new Error(error); + + console.log(body); + }) +}; + +module.exports = getAuth \ No newline at end of file diff --git a/utilities.js b/utilities.js new file mode 100644 index 0000000..3da9100 --- /dev/null +++ b/utilities.js @@ -0,0 +1,25 @@ +function deepCompare(objectA, objectB) { + return Object.values(objectA).join('') === Object.values(objectB).join(''); +} + +function deepIncludes(array, object) { + for (let i = 0; i < array.length; i += 1) { + if (deepCompare(array[i], object)) { + return true; + } + } + return false; +} + +function removeDuplicateProjects(projectsArray) { + const result = []; + for (let i = 0; i < projectsArray.length; i += 1) { + const alreadyInResult = deepIncludes(result, projectsArray[i]); + if (!alreadyInResult && projectsArray[i].repository_name !== null) { + result.push(projectsArray[i]); + } + } + return result; +} + +module.exports = { removeDuplicateProjects }; diff --git a/views/index.ejs b/views/index.ejs index b0d0e44..1dd54d8 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -12,14 +12,14 @@
<% projects.forEach(function(project) { %> -
+
<% if (project.repository_name !== null) { %>
Project ID:
- <%= project.id %> + <%= project.repository_url %>

@@ -27,7 +27,7 @@ Repository Name:
- <%= project.repository_name %> + <%= project.name %>

@@ -35,7 +35,6 @@ Status:
- <%= project.builds[0].status %>

@@ -43,7 +42,6 @@ Pushed By:
- <%= project.builds[0].github_username %>

@@ -51,7 +49,6 @@ GitHub Commit SSH:
- <%= project.builds[0].commit_id %>

From 28a4ce1a1822e834b357872836bcf68a08ecafb0 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Mon, 16 Oct 2017 10:43:08 -0700 Subject: [PATCH 03/11] reformatting files as per punits request --- package.json | 3 ++- app.js => src/app.js | 6 +++--- src/config.js | 6 ++++++ src/gateway/codeship.js | 0 auth.js => src/server/routes/auth.js | 0 utilities.js => src/utilities.js | 0 {views => src/views}/index.ejs | 0 7 files changed, 11 insertions(+), 4 deletions(-) rename app.js => src/app.js (93%) create mode 100644 src/config.js create mode 100644 src/gateway/codeship.js rename auth.js => src/server/routes/auth.js (100%) rename utilities.js => src/utilities.js (100%) rename {views => src/views}/index.ejs (100%) diff --git a/package.json b/package.json index 651066a..7d56ded 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "status", "version": "1.0.0", "description": "", - "main": "app.js", + "main": "src/app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "nodemon" @@ -24,6 +24,7 @@ "dotenv": "^4.0.0", "ejs": "^2.5.7", "express": "^4.16.1", + "lodash": "^4.17.4", "request": "^2.83.0", "request-promise": "^4.2.2" }, diff --git a/app.js b/src/app.js similarity index 93% rename from app.js rename to src/app.js index 3835bc4..64da7ea 100644 --- a/app.js +++ b/src/app.js @@ -4,15 +4,16 @@ require('dotenv').load(); const app = express(); const request = require('request-promise'); -const getAuth = require('./auth'); +const path = require('path'); +// const getAuth = require('./server/routes/auth'); const { removeDuplicateProjects } = require('./utilities'); app.use(express.static('public')); +app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); function renderProjects(res) { - const authOptions = { method: 'POST', url: 'https://api.codeship.com/v2/auth', @@ -23,7 +24,6 @@ function renderProjects(res) { }, body: '{}', }; - const getAuth = (() => request(authOptions).then(body => JSON.parse(body))); getAuth() diff --git a/src/config.js b/src/config.js new file mode 100644 index 0000000..fe38448 --- /dev/null +++ b/src/config.js @@ -0,0 +1,6 @@ +module.exports = { + codeship: { + username: process.env.CODESHIP_USERNAME, + password: process.env.CODESHIP_PASSWORD, + }, +}; diff --git a/src/gateway/codeship.js b/src/gateway/codeship.js new file mode 100644 index 0000000..e69de29 diff --git a/auth.js b/src/server/routes/auth.js similarity index 100% rename from auth.js rename to src/server/routes/auth.js diff --git a/utilities.js b/src/utilities.js similarity index 100% rename from utilities.js rename to src/utilities.js diff --git a/views/index.ejs b/src/views/index.ejs similarity index 100% rename from views/index.ejs rename to src/views/index.ejs From 95f4b0ce57b6e29f21d03359d61bb8c223273f97 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Tue, 17 Oct 2017 13:26:06 -0700 Subject: [PATCH 04/11] further progress, getting right information displaying --- .babelrc | 5 + package-lock.json | 748 +++++++++++++++++++++++++++++++++++++++++- package.json | 3 + public/css/master.css | 6 +- src/app.js | 63 ++-- src/views/index.ejs | 21 +- 6 files changed, 783 insertions(+), 63 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..6a9be79 --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "env" + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b629747..ed58d47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,8 +81,7 @@ "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "anymatch": { "version": "1.3.2", @@ -195,11 +194,15 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, + "babel": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel/-/babel-6.23.0.tgz", + "integrity": "sha1-0NHn2APpdHZb7qMjLU4VPA77kPQ=" + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, "requires": { "chalk": "1.1.3", "esutils": "2.0.2", @@ -210,7 +213,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, "requires": { "ansi-styles": "2.2.1", "escape-string-regexp": "1.0.5", @@ -223,13 +225,562 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "2.1.1" } } } }, + "babel-core": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", + "requires": { + "babel-code-frame": "6.26.0", + "babel-generator": "6.26.0", + "babel-helpers": "6.24.1", + "babel-messages": "6.23.0", + "babel-register": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "convert-source-map": "1.5.0", + "debug": "2.6.9", + "json5": "0.5.1", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "path-is-absolute": "1.0.1", + "private": "0.1.8", + "slash": "1.0.0", + "source-map": "0.5.7" + } + }, + "babel-generator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", + "requires": { + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "detect-indent": "4.0.0", + "jsesc": "1.3.0", + "lodash": "4.17.4", + "source-map": "0.5.7", + "trim-right": "1.0.1" + } + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "requires": { + "babel-helper-explode-assignable-expression": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "requires": { + "babel-helper-hoist-variables": "6.24.1", + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.4" + } + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "requires": { + "babel-helper-get-function-arity": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.4" + } + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "requires": { + "babel-helper-optimise-call-expression": "6.24.1", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=" + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=" + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=" + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "requires": { + "babel-helper-remap-async-to-generator": "6.24.1", + "babel-plugin-syntax-async-functions": "6.13.0", + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.4" + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "requires": { + "babel-helper-define-map": "6.26.0", + "babel-helper-function-name": "6.24.1", + "babel-helper-optimise-call-expression": "6.24.1", + "babel-helper-replace-supers": "6.24.1", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz", + "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", + "requires": { + "babel-plugin-transform-strict-mode": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "requires": { + "babel-helper-hoist-variables": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "requires": { + "babel-plugin-transform-es2015-modules-amd": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "requires": { + "babel-helper-replace-supers": "6.24.1", + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "requires": { + "babel-helper-call-delegate": "6.24.1", + "babel-helper-get-function-arity": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "requires": { + "babel-helper-regex": "6.26.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "requires": { + "babel-helper-regex": "6.26.0", + "babel-runtime": "6.26.0", + "regexpu-core": "2.0.0" + } + }, + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "requires": { + "babel-helper-builder-binary-assignment-operator-visitor": "6.24.1", + "babel-plugin-syntax-exponentiation-operator": "6.13.0", + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "requires": { + "regenerator-transform": "0.10.1" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-preset-env": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", + "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "requires": { + "babel-plugin-check-es2015-constants": "6.22.0", + "babel-plugin-syntax-trailing-function-commas": "6.22.0", + "babel-plugin-transform-async-to-generator": "6.24.1", + "babel-plugin-transform-es2015-arrow-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoping": "6.26.0", + "babel-plugin-transform-es2015-classes": "6.24.1", + "babel-plugin-transform-es2015-computed-properties": "6.24.1", + "babel-plugin-transform-es2015-destructuring": "6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", + "babel-plugin-transform-es2015-for-of": "6.23.0", + "babel-plugin-transform-es2015-function-name": "6.24.1", + "babel-plugin-transform-es2015-literals": "6.22.0", + "babel-plugin-transform-es2015-modules-amd": "6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", + "babel-plugin-transform-es2015-modules-systemjs": "6.24.1", + "babel-plugin-transform-es2015-modules-umd": "6.24.1", + "babel-plugin-transform-es2015-object-super": "6.24.1", + "babel-plugin-transform-es2015-parameters": "6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", + "babel-plugin-transform-es2015-spread": "6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "6.24.1", + "babel-plugin-transform-es2015-template-literals": "6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", + "babel-plugin-transform-es2015-unicode-regex": "6.24.1", + "babel-plugin-transform-exponentiation-operator": "6.24.1", + "babel-plugin-transform-regenerator": "6.26.0", + "browserslist": "2.5.1", + "invariant": "2.2.2", + "semver": "5.4.1" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "requires": { + "babel-core": "6.26.0", + "babel-runtime": "6.26.0", + "core-js": "2.5.1", + "home-or-tmp": "2.0.0", + "lodash": "4.17.4", + "mkdirp": "0.5.1", + "source-map-support": "0.4.18" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.9", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -339,6 +890,15 @@ "repeat-element": "1.1.2" } }, + "browserslist": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", + "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "requires": { + "caniuse-lite": "1.0.30000746", + "electron-to-chromium": "1.3.26" + } + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -371,6 +931,11 @@ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, + "caniuse-lite": { + "version": "1.0.30000746", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", + "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + }, "capture-stack-trace": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", @@ -541,6 +1106,11 @@ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, + "convert-source-map": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=" + }, "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", @@ -551,6 +1121,11 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "core-js": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=" + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -662,6 +1237,14 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "requires": { + "repeating": "2.0.1" + } + }, "doctrine": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", @@ -717,6 +1300,11 @@ "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.7.tgz", "integrity": "sha1-zIcsFoiArjxxiXYv1f/ACJbJUYo=" }, + "electron-to-chromium": { + "version": "1.3.26", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.26.tgz", + "integrity": "sha1-mWQnKUhhp02cfIK5Jg6jAejALWY=" + }, "encodeurl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", @@ -745,8 +1333,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { "version": "4.8.0", @@ -911,8 +1498,7 @@ "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" }, "etag": { "version": "1.8.1", @@ -2194,8 +2780,7 @@ "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" }, "globby": { "version": "5.0.0", @@ -2262,7 +2847,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, "requires": { "ansi-regex": "2.1.1" } @@ -2294,6 +2878,15 @@ "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, "hosted-git-info": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", @@ -2398,6 +2991,14 @@ "through": "2.3.8" } }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "requires": { + "loose-envify": "1.3.1" + } + }, "ipaddr.js": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz", @@ -2460,6 +3061,14 @@ "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "requires": { + "number-is-nan": "1.0.1" + } + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", @@ -2598,8 +3207,7 @@ "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, "js-yaml": { "version": "3.10.0", @@ -2623,6 +3231,11 @@ "integrity": "sha512-vE2hT1D0HLZCLLclfBSfkfTTedhVj0fubHpJBHKwwUWX0nSbhPAfk+SG9rTX95BYNmau8rGFfCeaT6T5OW1C2A==", "dev": true }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=" + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -2646,6 +3259,11 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" + }, "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", @@ -2826,6 +3444,14 @@ "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", "dev": true }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "requires": { + "js-tokens": "3.0.2" + } + }, "lowercase-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", @@ -3318,6 +3944,11 @@ "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" + }, "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", @@ -3496,6 +4127,26 @@ "set-immediate-shim": "1.0.1" } }, + "regenerate": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", + "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==" + }, + "regenerator-runtime": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==" + }, + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "private": "0.1.8" + } + }, "regex-cache": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", @@ -3505,6 +4156,16 @@ "is-equal-shallow": "0.1.3" } }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "requires": { + "regenerate": "1.3.3", + "regjsgen": "0.2.0", + "regjsparser": "0.1.5" + } + }, "registry-auth-token": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz", @@ -3524,6 +4185,26 @@ "rc": "1.2.1" } }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=" + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "requires": { + "jsesc": "0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=" + } + } + }, "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", @@ -3542,6 +4223,14 @@ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "requires": { + "is-finite": "1.0.2" + } + }, "request": { "version": "2.83.0", "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", @@ -3743,6 +4432,11 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" + }, "slice-ansi": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", @@ -3760,6 +4454,19 @@ "hoek": "4.2.0" } }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "requires": { + "source-map": "0.5.7" + } + }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", @@ -3890,8 +4597,7 @@ "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "table": { "version": "4.0.2", @@ -3968,6 +4674,11 @@ "os-tmpdir": "1.0.2" } }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" + }, "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", @@ -3985,6 +4696,11 @@ "punycode": "1.4.1" } }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" + }, "tryit": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", diff --git a/package.json b/package.json index 7d56ded..0d6d418 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ }, "homepage": "https://github.com/mKleinCreative/status#readme", "dependencies": { + "babel": "^6.23.0", + "babel-core": "^6.26.0", + "babel-preset-env": "^1.6.0", "bcrypt": "^1.0.3", "body-parser": "^1.18.2", "dotenv": "^4.0.0", diff --git a/public/css/master.css b/public/css/master.css index d1566cf..9501bf8 100644 --- a/public/css/master.css +++ b/public/css/master.css @@ -5,11 +5,9 @@ html { .projects-wrapper { display: flex; justify-content: center; - flex-direction: row; } .project { - display: flex; font-family: 'Yantramanav', sans-serif; margin: 30px; border: 1px outset silver; @@ -23,6 +21,8 @@ html { box-shadow: inset 10px 3px 38px 2px rgba(1m run dev 76,222,165,0.15); src: url(sansation_light.woff); + flex: 1; + width: 32%; } .shadow { @@ -73,7 +73,7 @@ html { background-color: grey; } -.testing { +.running { background-color: mediumaquamarine; } diff --git a/src/app.js b/src/app.js index 64da7ea..d66e399 100644 --- a/src/app.js +++ b/src/app.js @@ -6,14 +6,13 @@ const app = express(); const request = require('request-promise'); const path = require('path'); // const getAuth = require('./server/routes/auth'); -const { removeDuplicateProjects } = require('./utilities'); app.use(express.static('public')); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); -function renderProjects(res) { +async function renderProjects(res) { const authOptions = { method: 'POST', url: 'https://api.codeship.com/v2/auth', @@ -24,38 +23,40 @@ function renderProjects(res) { }, body: '{}', }; - const getAuth = (() => request(authOptions).then(body => JSON.parse(body))); + const getAuth = (() => request(authOptions)); - getAuth() - .then((user) => { - const options = { - method: 'GET', - url: `https://api.codeship.com/v2/organizations/${user.organizations[0].uuid}/projects`, - headers: { authorization: `${user.access_token}` }, - body: '{}', - timeout: 1000, - }; + const user = JSON.parse(await getAuth()); + const projectFromOrganizationOptions = { + method: 'GET', + url: `https://api.codeship.com/v2/organizations/${user.organizations[0].uuid}/projects/`, + headers: { authorization: `${user.access_token}` }, + body: '{}', + timeout: 1000, + }; + + const getProjects = (() => request(projectFromOrganizationOptions)); - const getProjects = (() => request(options).then(json => JSON.parse(json))); + let projectsJSON = JSON.parse(await getProjects()).projects; + projectsJSON = await Promise.all(projectsJSON.map(async (project) => { + project.builds = (await listBuilds(user.organizations[0].uuid, project.uuid, user)).builds + return project; + })); + console.log( '---===projectsJSON===---', projectsJSON ) + console.log( '---===projectsJSON.builds===---', projectsJSON[0].builds ) + res.render('index', { projects: projectsJSON }) +} - getProjects() - .then((projects) => { - function listBuilds(organizationId, projectId) { - return request({ - uri: apiUrl + '/organizations/' + organizationId + '/projects/' + projectId + '/builds', - method: 'GET', - json: true, - headers: { - 'Content-Type': 'application/json', - 'Authorization': authorization.access_token, - }, - }); - } - const uniqueProjects = removeDuplicateProjects(projects.projects); - console.log( '---===uniqueProjects===---', uniqueProjects ) - return res.render('index', { projects: uniqueProjects }); - }); - }); +function listBuilds(organizationID, projectID, user) { + const buildOptions = { + uri: 'https://api.codeship.com/v2/organizations/' + organizationID + '/projects/' + projectID + '/builds', + method: 'GET', + json: true, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `${user.access_token}`, + }, + }; + return request(buildOptions); } app.get('/', (req, res) => { diff --git a/src/views/index.ejs b/src/views/index.ejs index 1dd54d8..47f7d9a 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -12,22 +12,14 @@
<% projects.forEach(function(project) { %> -
- <% if (project.repository_name !== null) { %> -
-
- Project ID: -
-
- <%= project.repository_url %> -
-

+
+ <% if (project.repository_url !== null && project.builds !== null) { %>
- Repository Name: + Repository:
- <%= project.name %> + <%= project.repository_url %>

@@ -35,6 +27,7 @@ Status:
+ <%= project.builds[0].status %>

@@ -42,13 +35,15 @@ Pushed By:
+ <%= project.builds[0].username %>

- GitHub Commit SSH: + GitHub Commit Message:
+ <%= project.builds[0].commit_message %>

From 8ff02f7b78deab23f65b8b451c9e7ff2d7557140 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Tue, 17 Oct 2017 18:21:02 -0700 Subject: [PATCH 05/11] Reorganized functions in files --- src/app.js | 55 ++--------------------------------- src/gateway/codeship.js | 61 +++++++++++++++++++++++++++++++++++++++ src/server/routes/auth.js | 33 ++++++++++++--------- 3 files changed, 83 insertions(+), 66 deletions(-) diff --git a/src/app.js b/src/app.js index d66e399..a39747a 100644 --- a/src/app.js +++ b/src/app.js @@ -1,67 +1,16 @@ const express = require('express'); - -require('dotenv').load(); +const projects = require('./server/routes/auth'); const app = express(); -const request = require('request-promise'); const path = require('path'); -// const getAuth = require('./server/routes/auth'); app.use(express.static('public')); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); -async function renderProjects(res) { - const authOptions = { - method: 'POST', - url: 'https://api.codeship.com/v2/auth', - headers: - { - authorization: 'Basic bWlrZXRoZWtsZWluQGdtYWlsLmNvbTpJbGF3aGR5NjY=', - 'content-type': 'application/json', - }, - body: '{}', - }; - const getAuth = (() => request(authOptions)); - - const user = JSON.parse(await getAuth()); - const projectFromOrganizationOptions = { - method: 'GET', - url: `https://api.codeship.com/v2/organizations/${user.organizations[0].uuid}/projects/`, - headers: { authorization: `${user.access_token}` }, - body: '{}', - timeout: 1000, - }; - - const getProjects = (() => request(projectFromOrganizationOptions)); - let projectsJSON = JSON.parse(await getProjects()).projects; - projectsJSON = await Promise.all(projectsJSON.map(async (project) => { - project.builds = (await listBuilds(user.organizations[0].uuid, project.uuid, user)).builds - return project; - })); - console.log( '---===projectsJSON===---', projectsJSON ) - console.log( '---===projectsJSON.builds===---', projectsJSON[0].builds ) - res.render('index', { projects: projectsJSON }) -} - -function listBuilds(organizationID, projectID, user) { - const buildOptions = { - uri: 'https://api.codeship.com/v2/organizations/' + organizationID + '/projects/' + projectID + '/builds', - method: 'GET', - json: true, - headers: { - 'Content-Type': 'application/json', - 'Authorization': `${user.access_token}`, - }, - }; - return request(buildOptions); -} - -app.get('/', (req, res) => { - renderProjects(res); -}); +app.get('/', projects.list); const port = process.env.PORT || 3900; diff --git a/src/gateway/codeship.js b/src/gateway/codeship.js index e69de29..97a8d3a 100644 --- a/src/gateway/codeship.js +++ b/src/gateway/codeship.js @@ -0,0 +1,61 @@ +require('dotenv').load(); +const request = require('request-promise'); + +const apiUrl = process.env.CODESHIP_API_URL; +const username = process.env.CODESHIP_USERNAME; +const password = process.env.CODESHIP_PASSWORD; +let authorization; + +async function postAuth() { + if (accessTokenExpired()) { + authorization = await request({ + uri: apiUrl + '/auth', + method: 'POST', + auth: { + user: username, + pass: password, + }, + json: true, + headers: {'Content-Type': 'application/json'}, + }); + } + return authorization; +} + +function listProjects(organizationId) { + return request({ + uri: apiUrl + '/organizations/' + organizationId + '/projects', + method: 'GET', + json: true, + headers: { + 'Content-Type': 'application/json', + 'Authorization': authorization.access_token, + }, + }); +} + +function listBuilds(organizationId, projectId) { + return request({ + uri: apiUrl + '/organizations/' + organizationId + '/projects/' + projectId + '/builds', + method: 'GET', + json: true, + headers: { + 'Content-Type': 'application/json', + 'Authorization': authorization.access_token, + }, + }); +} + +function accessTokenExpired() { + const now = Math.round((new Date()).getTime() / 1000); + if (authorization && authorization.access_token && authorization.expires_at) { + return authorization.expires_at <= now; + } + return true; +} + +module.exports = { + postAuth, + listProjects, + listBuilds, +}; diff --git a/src/server/routes/auth.js b/src/server/routes/auth.js index ed71c2d..cab5840 100644 --- a/src/server/routes/auth.js +++ b/src/server/routes/auth.js @@ -1,16 +1,23 @@ -const request = require('request'); +const apiClient = require('../../gateway/codeship'); -const authOptions = { - method: 'POST', - url: 'https://api.codeship.com/v2/auth', - headers: - { - authorization: 'Basic bWlrZXRoZWtsZWluQGdtYWlsLmNvbTpJbGF3aGR5NjY=', - 'content-type': 'application/json', - }, - body: '{}', -}; +async function list(req, res) { + // Authenticate the user + const authorization = await apiClient.postAuth(); -const getAuth = (() => request(authOptions).then(body => JSON.parse(body))); + // Use their first organization UUID + const orgId = authorization.organizations[0].uuid; -module.exports = getAuth; + // Get the organization's projects + let { projects } = (await apiClient.listProjects(orgId)).projects; + + // Embed the latest builds into each project + projects = await Promise.all(projects.map(async (project) => { + project.builds = (await apiClient.listBuilds(orgId, project.uuid)).builds; + return project; + })); + + // Render the list view with projects + res.render('list', { projects }); +} + +module.exports = { list }; From cc3db677dae30b2d44a3589946209bc533c1d1eb Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 18 Oct 2017 09:42:36 -0700 Subject: [PATCH 06/11] finished styling in flexbox and fixed issue causing promise failure --- public/css/master.css | 7 ++++ src/server/routes/auth.js | 4 +- src/views/index.ejs | 78 ++++++++++++++++++++------------------- 3 files changed, 49 insertions(+), 40 deletions(-) diff --git a/public/css/master.css b/public/css/master.css index 9501bf8..904d41e 100644 --- a/public/css/master.css +++ b/public/css/master.css @@ -7,7 +7,14 @@ html { justify-content: center; } +.projects-wrapper .project-grid { + display: flex; + justify-content: flex-start; + flex-wrap: wrap; +} + .project { + justify-content: space-around; font-family: 'Yantramanav', sans-serif; margin: 30px; border: 1px outset silver; diff --git a/src/server/routes/auth.js b/src/server/routes/auth.js index cab5840..291d488 100644 --- a/src/server/routes/auth.js +++ b/src/server/routes/auth.js @@ -8,7 +8,7 @@ async function list(req, res) { const orgId = authorization.organizations[0].uuid; // Get the organization's projects - let { projects } = (await apiClient.listProjects(orgId)).projects; + let projects = (await apiClient.listProjects(orgId)).projects; // Embed the latest builds into each project projects = await Promise.all(projects.map(async (project) => { @@ -17,7 +17,7 @@ async function list(req, res) { })); // Render the list view with projects - res.render('list', { projects }); + res.render('index', { projects }); } module.exports = { list }; diff --git a/src/views/index.ejs b/src/views/index.ejs index 47f7d9a..617a061 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -11,44 +11,46 @@
- <% projects.forEach(function(project) { %> -
- <% if (project.repository_url !== null && project.builds !== null) { %> -
-
- Repository: -
-
- <%= project.repository_url %> -
-

-
-
- Status: -
-
- <%= project.builds[0].status %> -
-

-
-
- Pushed By: -
-
- <%= project.builds[0].username %> -
-

-
-
- GitHub Commit Message: -
-
- <%= project.builds[0].commit_message %> -
-

-
- <% } %> - <% }) %> +
+ <% projects.forEach(function(project) { %> +
+ <% if (project.repository_url !== null && project.builds !== null) { %> +
+
+ Repository: +
+
+ <%= project.repository_url %> +
+

+
+
+ Status: +
+
+ <%= project.builds[0].status %> +
+

+
+
+ Pushed By: +
+
+ <%= project.builds[0].username %> +
+

+
+
+ GitHub Commit Message: +
+
+ <%= project.builds[0].commit_message %> +
+

+
+ <% } %> + <% }) %> +
\ No newline at end of file From df40bf9f126c2472e428996a394be3fe0097e5b4 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 18 Oct 2017 11:53:51 -0700 Subject: [PATCH 07/11] broken commit, saving for future --- src/app.js | 7 +++--- src/config.js | 3 +++ src/gateway/codeship.js | 26 ++++++++++----------- src/server/routes/{auth.js => dashboard.js} | 12 +++++----- src/server/routes/index.js | 7 ++++++ 5 files changed, 32 insertions(+), 23 deletions(-) rename src/server/routes/{auth.js => dashboard.js} (55%) create mode 100644 src/server/routes/index.js diff --git a/src/app.js b/src/app.js index a39747a..ed02391 100644 --- a/src/app.js +++ b/src/app.js @@ -1,5 +1,5 @@ const express = require('express'); -const projects = require('./server/routes/auth'); +const router = require('./server/routes'); const app = express(); const path = require('path'); @@ -9,8 +9,9 @@ app.use(express.static('public')); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); - -app.get('/', projects.list); +console.log( '<3333333 here in app <3333333' ) +app.use(router); +console.log( '<3333333 here in app 2 <3333333' ) const port = process.env.PORT || 3900; diff --git a/src/config.js b/src/config.js index fe38448..347c32e 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,8 @@ +require('dotenv').load(); + module.exports = { codeship: { + apiUrl: process.env.CODESHIP_API_URL, username: process.env.CODESHIP_USERNAME, password: process.env.CODESHIP_PASSWORD, }, diff --git a/src/gateway/codeship.js b/src/gateway/codeship.js index 97a8d3a..6b4a4c0 100644 --- a/src/gateway/codeship.js +++ b/src/gateway/codeship.js @@ -1,19 +1,17 @@ -require('dotenv').load(); const request = require('request-promise'); -const apiUrl = process.env.CODESHIP_API_URL; -const username = process.env.CODESHIP_USERNAME; -const password = process.env.CODESHIP_PASSWORD; -let authorization; +const { codeship } = require('../config'); -async function postAuth() { +let authorization; +console.log( '---===config===---', codeship.apiUrl ) +async function authenticate() { if (accessTokenExpired()) { authorization = await request({ - uri: apiUrl + '/auth', + uri: codeship.apiUrl + '/auth', method: 'POST', auth: { - user: username, - pass: password, + user: codeship.username, + pass: codeship.password, }, json: true, headers: {'Content-Type': 'application/json'}, @@ -22,7 +20,7 @@ async function postAuth() { return authorization; } -function listProjects(organizationId) { +function getProjects(organizationId) { return request({ uri: apiUrl + '/organizations/' + organizationId + '/projects', method: 'GET', @@ -34,7 +32,7 @@ function listProjects(organizationId) { }); } -function listBuilds(organizationId, projectId) { +function getBuilds(organizationId, projectId) { return request({ uri: apiUrl + '/organizations/' + organizationId + '/projects/' + projectId + '/builds', method: 'GET', @@ -55,7 +53,7 @@ function accessTokenExpired() { } module.exports = { - postAuth, - listProjects, - listBuilds, + authenticate, + getProjects, + getBuilds, }; diff --git a/src/server/routes/auth.js b/src/server/routes/dashboard.js similarity index 55% rename from src/server/routes/auth.js rename to src/server/routes/dashboard.js index 291d488..0e338e5 100644 --- a/src/server/routes/auth.js +++ b/src/server/routes/dashboard.js @@ -1,23 +1,23 @@ const apiClient = require('../../gateway/codeship'); -async function list(req, res) { +async function getProjects(req, res) { // Authenticate the user - const authorization = await apiClient.postAuth(); + const authorization = await apiClient.authenticate(); // Use their first organization UUID const orgId = authorization.organizations[0].uuid; // Get the organization's projects - let projects = (await apiClient.listProjects(orgId)).projects; + let projects = (await apiClient.getProjects(orgId)).projects; // Embed the latest builds into each project projects = await Promise.all(projects.map(async (project) => { - project.builds = (await apiClient.listBuilds(orgId, project.uuid)).builds; + project.builds = (await apiClient.getBuilds(orgId, project.uuid)).builds; return project; })); - // Render the list view with projects + // Render the getProjects view with projects res.render('index', { projects }); } -module.exports = { list }; +module.exports = { getProjects }; diff --git a/src/server/routes/index.js b/src/server/routes/index.js new file mode 100644 index 0000000..0114b08 --- /dev/null +++ b/src/server/routes/index.js @@ -0,0 +1,7 @@ +const router = require('express').Router(); +const { getProjects } = require('./dashboard'); + +router.use('/dashboard', getProjects); + +module.exports = router; + From 81306922cbc281c7125677488144fab1bcb3dcc6 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Thu, 19 Oct 2017 09:59:13 -0700 Subject: [PATCH 08/11] working on further serparations of concerns and testing --- src/app.js | 2 -- src/gateway/codeship.js | 5 ++--- src/server/routes/dashboard.js | 10 ++++++---- src/server/routes/index.js | 2 +- src/utilities.js | 25 ------------------------- test.js | 29 ----------------------------- 6 files changed, 9 insertions(+), 64 deletions(-) delete mode 100644 src/utilities.js delete mode 100644 test.js diff --git a/src/app.js b/src/app.js index ed02391..f4f7f7f 100644 --- a/src/app.js +++ b/src/app.js @@ -9,9 +9,7 @@ app.use(express.static('public')); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); -console.log( '<3333333 here in app <3333333' ) app.use(router); -console.log( '<3333333 here in app 2 <3333333' ) const port = process.env.PORT || 3900; diff --git a/src/gateway/codeship.js b/src/gateway/codeship.js index 6b4a4c0..129cfbd 100644 --- a/src/gateway/codeship.js +++ b/src/gateway/codeship.js @@ -3,7 +3,6 @@ const request = require('request-promise'); const { codeship } = require('../config'); let authorization; -console.log( '---===config===---', codeship.apiUrl ) async function authenticate() { if (accessTokenExpired()) { authorization = await request({ @@ -22,7 +21,7 @@ async function authenticate() { function getProjects(organizationId) { return request({ - uri: apiUrl + '/organizations/' + organizationId + '/projects', + uri: codeship.apiUrl + '/organizations/' + organizationId + '/projects', method: 'GET', json: true, headers: { @@ -34,7 +33,7 @@ function getProjects(organizationId) { function getBuilds(organizationId, projectId) { return request({ - uri: apiUrl + '/organizations/' + organizationId + '/projects/' + projectId + '/builds', + uri: codeship.apiUrl + '/organizations/' + organizationId + '/projects/' + projectId + '/builds', method: 'GET', json: true, headers: { diff --git a/src/server/routes/dashboard.js b/src/server/routes/dashboard.js index 0e338e5..db827d1 100644 --- a/src/server/routes/dashboard.js +++ b/src/server/routes/dashboard.js @@ -1,6 +1,11 @@ const apiClient = require('../../gateway/codeship'); async function getProjects(req, res) { + async function appendBuildsToProjects(project) { + project.builds = (await apiClient.getBuilds(orgId, project.uuid)).builds; + return project; + } + // Authenticate the user const authorization = await apiClient.authenticate(); @@ -11,10 +16,7 @@ async function getProjects(req, res) { let projects = (await apiClient.getProjects(orgId)).projects; // Embed the latest builds into each project - projects = await Promise.all(projects.map(async (project) => { - project.builds = (await apiClient.getBuilds(orgId, project.uuid)).builds; - return project; - })); + projects = await Promise.all(projects.map(appendBuildsToProjects)); // Render the getProjects view with projects res.render('index', { projects }); diff --git a/src/server/routes/index.js b/src/server/routes/index.js index 0114b08..8ed04aa 100644 --- a/src/server/routes/index.js +++ b/src/server/routes/index.js @@ -1,7 +1,7 @@ const router = require('express').Router(); const { getProjects } = require('./dashboard'); -router.use('/dashboard', getProjects); +router.use('/', getProjects); module.exports = router; diff --git a/src/utilities.js b/src/utilities.js deleted file mode 100644 index 3da9100..0000000 --- a/src/utilities.js +++ /dev/null @@ -1,25 +0,0 @@ -function deepCompare(objectA, objectB) { - return Object.values(objectA).join('') === Object.values(objectB).join(''); -} - -function deepIncludes(array, object) { - for (let i = 0; i < array.length; i += 1) { - if (deepCompare(array[i], object)) { - return true; - } - } - return false; -} - -function removeDuplicateProjects(projectsArray) { - const result = []; - for (let i = 0; i < projectsArray.length; i += 1) { - const alreadyInResult = deepIncludes(result, projectsArray[i]); - if (!alreadyInResult && projectsArray[i].repository_name !== null) { - result.push(projectsArray[i]); - } - } - return result; -} - -module.exports = { removeDuplicateProjects }; diff --git a/test.js b/test.js deleted file mode 100644 index 6ad22d9..0000000 --- a/test.js +++ /dev/null @@ -1,29 +0,0 @@ -// curl --request POST \ -// --url 'https://codeship.com/api/v2/auth' \ -// --header 'content-type: text/plain' \ -// --data '{}' -// -// -// curl --request POST --url api.codeship.com/v2/auth --header ‘authorization: Basic ampqajpwcHBw’ --header ‘content-type: application/json’ --data ‘{“username”:“lallala”, “password” : “ksdjfkaj”}’ -// -// `curl --request POST --url https://api.codeship.com/v2/auth --header 'authorization: Basic' --header 'content-type: application/json' --data '{"username":"miketheklein@gmail.com", "password" : "Ilawhdy66"}'` -// - `curl --request POST --url https://api.codeship.com/v2/auth --header 'content-type: application/json' --data '{}' --user miketheklein@gmail.com:Ilawhdy66` - -var request = require("request"); -var options = { method: 'POST', -url: 'https://api.codeship.com/v2/auth', -headers: -{ authorization: 'Basic bWlrZXRoZWtsZWluQGdtYWlsLmNvbTpJbGF3aGR5NjY=', -'content-type': 'application/json' }, -body: '{}' }; - -function getAuth(){ - request(options, function (error, response, body) { - if (error) throw new Error(error); - - console.log(body); - }) -}; - -module.exports = getAuth \ No newline at end of file From 4a98e1af851d9ef68f2a73ff6f90f9f5fccd6377 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Thu, 19 Oct 2017 10:07:39 -0700 Subject: [PATCH 09/11] moved the dashboard into a get route --- src/server/routes/dashboard.js | 21 +++++++++++++-------- src/server/routes/index.js | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/server/routes/dashboard.js b/src/server/routes/dashboard.js index db827d1..179ef13 100644 --- a/src/server/routes/dashboard.js +++ b/src/server/routes/dashboard.js @@ -1,25 +1,30 @@ const apiClient = require('../../gateway/codeship'); +const router = require('express').Router(); -async function getProjects(req, res) { +router.get('/', async (req, res) => { async function appendBuildsToProjects(project) { project.builds = (await apiClient.getBuilds(orgId, project.uuid)).builds; return project; } - + // Authenticate the user const authorization = await apiClient.authenticate(); - + // Use their first organization UUID const orgId = authorization.organizations[0].uuid; - + // Get the organization's projects let projects = (await apiClient.getProjects(orgId)).projects; - + // Embed the latest builds into each project projects = await Promise.all(projects.map(appendBuildsToProjects)); - + // Render the getProjects view with projects res.render('index', { projects }); -} +}) + + +// async function getProjects(req, res) { +// } -module.exports = { getProjects }; +module.exports = router; diff --git a/src/server/routes/index.js b/src/server/routes/index.js index 8ed04aa..ed654a8 100644 --- a/src/server/routes/index.js +++ b/src/server/routes/index.js @@ -1,7 +1,7 @@ const router = require('express').Router(); -const { getProjects } = require('./dashboard'); +const dashboard = require('./dashboard'); -router.use('/', getProjects); +router.use('/', dashboard); module.exports = router; From edbd1d0c05cf9969558cfda5ffc26ddbb07dd81e Mon Sep 17 00:00:00 2001 From: Helen Yau Date: Thu, 19 Oct 2017 10:53:19 -0700 Subject: [PATCH 10/11] install mocha chai and chai http to begin testing for api --- package-lock.json | 215 +++++++++++++++++++++++++++--- package.json | 5 +- src/app.js | 2 + test/end-to-end/dashboard.test.js | 18 +++ views/index.ejs | 62 +++++++++ 5 files changed, 283 insertions(+), 19 deletions(-) create mode 100644 test/end-to-end/dashboard.test.js create mode 100644 views/index.ejs diff --git a/package-lock.json b/package-lock.json index ed58d47..03ec1ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -173,6 +173,16 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=" + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", @@ -890,6 +900,11 @@ "repeat-element": "1.1.2" } }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=" + }, "browserslist": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", @@ -947,6 +962,31 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "requires": { + "assertion-error": "1.0.2", + "check-error": "1.0.2", + "deep-eql": "3.0.1", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.3" + } + }, + "chai-http": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chai-http/-/chai-http-3.0.0.tgz", + "integrity": "sha1-VGDYA24fGhKwtbXL1Snm3B0x60s=", + "requires": { + "cookiejar": "2.0.6", + "is-ip": "1.0.0", + "methods": "1.1.2", + "qs": "6.5.1", + "superagent": "2.3.0" + } + }, "chalk": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", @@ -978,6 +1018,11 @@ } } }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" + }, "chokidar": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", @@ -1055,6 +1100,16 @@ "delayed-stream": "1.0.0" } }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1121,6 +1176,11 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cookiejar": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.0.6.tgz", + "integrity": "sha1-Cr81atANHFohnYjURRgEbdAmrP4=" + }, "core-js": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", @@ -1191,6 +1251,14 @@ "ms": "2.0.0" } }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "requires": { + "type-detect": "4.0.3" + } + }, "deep-extend": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", @@ -1245,6 +1313,11 @@ "repeating": "2.0.1" } }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==" + }, "doctrine": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", @@ -1735,6 +1808,11 @@ "mime-types": "2.1.17" } }, + "formidable": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.1.1.tgz", + "integrity": "sha1-lriIb3w8NQi5Mta9cMTTqI818ak=" + }, "forwarded": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", @@ -2525,22 +2603,22 @@ } } }, - "string-width": { - "version": "1.0.2", + "string_decoder": { + "version": "1.0.1", "bundled": true, "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "safe-buffer": "5.0.1" } }, - "string_decoder": { - "version": "1.0.1", + "string-width": { + "version": "1.0.2", "bundled": true, "dev": true, "requires": { - "safe-buffer": "5.0.1" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "stringstream": { @@ -2731,6 +2809,11 @@ } } }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + }, "get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", @@ -2820,6 +2903,11 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==" + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -2854,8 +2942,7 @@ "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" }, "has-unicode": { "version": "2.0.1", @@ -2873,6 +2960,11 @@ "sntp": "2.0.2" } }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" + }, "hoek": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", @@ -2999,6 +3091,11 @@ "loose-envify": "1.3.1" } }, + "ip-regex": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-1.0.3.tgz", + "integrity": "sha1-3FiQdvZZ9BnCIgOaMzFvHHOH7/0=" + }, "ipaddr.js": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz", @@ -3084,6 +3181,14 @@ "is-extglob": "1.0.0" } }, + "is-ip": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-1.0.0.tgz", + "integrity": "sha1-K7aVn3l8zW+f3IEnWLy8h8TFkHQ=", + "requires": { + "ip-regex": "1.0.3" + } + }, "is-npm": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", @@ -3564,6 +3669,41 @@ "minimist": "0.0.8" } }, + "mocha": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", + "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "requires": { + "has-flag": "2.0.0" + } + } + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -3876,6 +4016,11 @@ "pify": "2.3.0" } }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=" + }, "pause-stream": { "version": "0.0.11", "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", @@ -4537,6 +4682,14 @@ "duplexer": "0.1.1" } }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" + } + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -4547,14 +4700,6 @@ "strip-ansi": "4.0.0" } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "requires": { - "safe-buffer": "5.1.1" - } - }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -4594,6 +4739,35 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, + "superagent": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-2.3.0.tgz", + "integrity": "sha1-cDUpoHFOV+EjlZ3e+84ZOy5Q0RU=", + "requires": { + "component-emitter": "1.2.1", + "cookiejar": "2.0.6", + "debug": "2.6.9", + "extend": "3.0.1", + "form-data": "1.0.0-rc4", + "formidable": "1.1.1", + "methods": "1.1.2", + "mime": "1.4.1", + "qs": "6.5.1", + "readable-stream": "2.3.3" + }, + "dependencies": { + "form-data": { + "version": "1.0.0-rc4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz", + "integrity": "sha1-BaxrwiIntD5EYfSIFhVUaZ1Pi14=", + "requires": { + "async": "1.5.2", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + } + } + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -4730,6 +4904,11 @@ "prelude-ls": "1.1.2" } }, + "type-detect": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=" + }, "type-is": { "version": "1.6.15", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", diff --git a/package.json b/package.json index 0d6d418..70c6876 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "src/app.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "mocha ./test/ --recursive ", "dev": "nodemon" }, "repository": { @@ -24,10 +24,13 @@ "babel-preset-env": "^1.6.0", "bcrypt": "^1.0.3", "body-parser": "^1.18.2", + "chai": "^4.1.2", + "chai-http": "^3.0.0", "dotenv": "^4.0.0", "ejs": "^2.5.7", "express": "^4.16.1", "lodash": "^4.17.4", + "mocha": "^4.0.1", "request": "^2.83.0", "request-promise": "^4.2.2" }, diff --git a/src/app.js b/src/app.js index f4f7f7f..da67b18 100644 --- a/src/app.js +++ b/src/app.js @@ -16,3 +16,5 @@ const port = process.env.PORT || 3900; app.listen(port, () => { console.log(`Listening on http://localhost:${port}...`); }); + +module.exports = app; diff --git a/test/end-to-end/dashboard.test.js b/test/end-to-end/dashboard.test.js new file mode 100644 index 0000000..07584b0 --- /dev/null +++ b/test/end-to-end/dashboard.test.js @@ -0,0 +1,18 @@ +const chai = require('chai'); +const expect = require('chai').expect; +const chaiHttp = require('chai-http'); +const app = require('../../src/app.js'); + +chai.use(chaiHttp); + +describe('app', () => { + it('sddasd', (done) => { + chai.request(app) + .get('/') + .then(function (res) { + console.log('res', res); + expect(res).to.be.an('array') + done() + }) + }); +}); diff --git a/views/index.ejs b/views/index.ejs new file mode 100644 index 0000000..f7e1ec4 --- /dev/null +++ b/views/index.ejs @@ -0,0 +1,62 @@ + + + + + + + + STATUS + + +
+ <% projects.forEach(function(project) { %> +
+ <% if (project.repository_name !== null) { %> +
+
+ Project ID: +
+
+ <%= project.id %> +
+

+
+
+ Repository Name: +
+
+ <%= project.repository_name %> +
+

+
+
+ Status: +
+
+ <%= project.builds[0].status %> +
+

+
+
+ Pushed By: +
+
+ <%= project.builds[0].github_username %> +
+

+
+
+ GitHub Commit SSH: +
+
+ <%= project.builds[0].commit_id %> +
+

+
+ <% } %> + <% }) %> +
+ + From 5bcd88f090086341609df4058f3e5577994f238d Mon Sep 17 00:00:00 2001 From: Helen Yau Date: Fri, 20 Oct 2017 10:45:28 -0700 Subject: [PATCH 11/11] create test for api --- test/end-to-end/dashboard.test.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/end-to-end/dashboard.test.js b/test/end-to-end/dashboard.test.js index 07584b0..d2c1afd 100644 --- a/test/end-to-end/dashboard.test.js +++ b/test/end-to-end/dashboard.test.js @@ -1,17 +1,21 @@ const chai = require('chai'); -const expect = require('chai').expect; +const expect = require('chai').expect; const chaiHttp = require('chai-http'); const app = require('../../src/app.js'); chai.use(chaiHttp); describe('app', () => { - it('sddasd', (done) => { + it('Should get back all repositories along with the build status', (done) => { chai.request(app) .get('/') .then(function (res) { - console.log('res', res); - expect(res).to.be.an('array') + expect(res).to.have.status(200) + expect(res).to.be.an('object') + expect(res.res.text).to.includes('Repository:\n \n
\n https://github.com/mKleinCreative/idm\n') + expect(res.res.text).to.includes('Repository:\n
\n
\n https://github.com/mKleinCreative/echo\n') + expect(res.res.text).to.includes('Repository:\n
\n
\n https://github.com/helenyau0/contacts-snapshot-starter\n') + expect(res.res.text).to.includes('Status:\n
\n
\n') done() }) });