-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from unb-cic-esw/master
PR para sincronização
- Loading branch information
Showing
514 changed files
with
105,057 additions
and
14,106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "public/bower_components/" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Javascript Node CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | ||
# | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
# specify the version you desire here | ||
- image: circleci/node:9.10 | ||
- image: mongo:3.4.4 # and this image as the secondary service container | ||
# Specify service dependencies here if necessary | ||
# CircleCI maintains a library of pre-built images | ||
# documented at https://circleci.com/docs/2.0/circleci-images/ | ||
# - image: circleci/mongo:3.4.4 | ||
|
||
working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: | ||
name: install-cairo | ||
command: sudo apt-get install libcairo2-dev | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
- run: npm install | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
|
||
# run lint! | ||
- run: | ||
name: Run lint | ||
command: npm run lint | ||
|
||
# run tests! | ||
- run: | ||
name: Run tests | ||
command: | | ||
for i in $(seq 1 5); do npm test && s=0 && break || s=$? && sleep 1; done; (exit $s) | ||
environment: | ||
NODE_ENV: test | ||
PORT: 3000 | ||
MONGO_HOST: mongodb://localhost:27017/data-viz | ||
MONGO_PORT: 27017 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Ambiente de desenvolvimento | ||
# Aconselhado: 'development' | ||
NODE_ENV=<env> | ||
|
||
# Porta do servidor | ||
# Aconselhado: port={0, 65536} | ||
PORT=port | ||
|
||
# Host do servidor de MongoDB | ||
# 'data-viz' é o nome do banco de dados | ||
MONGO_HOST=mongodb://localhost/data-viz | ||
|
||
# Porta aberta pelo servidor Mongo | ||
# Default pelo MongoDB: 27017 | ||
# Verificar a porta utilizada | ||
MONGO_PORT=portMDB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
.DS_Store | ||
/node_modules | ||
credentials.json | ||
controllers/*.png | ||
yarn-error.log | ||
logs/ | ||
.env | ||
docs/ | ||
logs/ | ||
node_modules/ | ||
server/controllers/*.png | ||
config/credentials.json | ||
yarn-error.logs | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// require and configure dotenv, will load vars in .env in PROCESS.ENV | ||
require("dotenv").config(); | ||
|
||
const config = { | ||
env: process.env.NODE_ENV, | ||
port: process.env.PORT, | ||
mongo: { | ||
host: `${process.env.MONGO_HOST}-${process.env.NODE_ENV}`, | ||
port: process.env.MONGO_PORT, | ||
}, | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"web": { | ||
"client_id":"irrelevant", | ||
"project_id":"resocie-data-viz", | ||
"auth_uri":"https://accounts.google.com/o/oauth2/auth", | ||
"token_uri":"https://accounts.google.com/o/oauth2/token", | ||
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs", | ||
"client_secret":"irrelevant" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const express = require("express"); | ||
const bodyParser = require("body-parser"); | ||
const cookieParser = require("cookie-parser"); | ||
const compress = require("compression"); | ||
const methodOverride = require("method-override"); | ||
const cors = require("cors"); | ||
const helmet = require("helmet"); | ||
const path = require("path"); | ||
|
||
const routes = require("../server/routes/index.route"); | ||
|
||
// Open an http server to accept the oauth callback. In this | ||
// simple example, the only request to our webserver is to | ||
// /oauth2callback?code=<code> | ||
const app = express(); | ||
|
||
// parse body params and attach them to req.body | ||
app.use(bodyParser.json()); | ||
app.use(bodyParser.urlencoded({ extended: true })); | ||
|
||
// parse the cookies | ||
app.use(cookieParser()); | ||
|
||
app.use(compress()); | ||
app.use(methodOverride()); | ||
|
||
// secure apps by setting various HTTP headers | ||
app.use(helmet()); | ||
|
||
// enable CORS - Cross Origin Resource Sharing | ||
app.use(cors()); | ||
|
||
// mount all routes on / path | ||
app.use("/", routes); | ||
|
||
// Load View Engine | ||
app.set("views", path.join(__dirname, "../views")); | ||
app.set("view engine", "pug"); | ||
|
||
// Set Public Folder | ||
app.use(express.static(path.join(__dirname, "../public"))); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { google } = require("googleapis"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const config = require("./config"); | ||
|
||
/* Reference code for OAuth and Spreadsheets: | ||
https://github.com/google/google-api-nodejs-client/blob/master/samples/sheets/quickstart.js | ||
*/ | ||
let credentialsFileName = "credentials.json"; | ||
if (config.env === "test") { | ||
credentialsFileName = "credentials-stub.json"; | ||
} | ||
const keyfile = path.join(__dirname, credentialsFileName); | ||
const keys = JSON.parse(fs.readFileSync(keyfile)); | ||
const scopes = ["https://www.googleapis.com/auth/spreadsheets.readonly"]; | ||
const client = (redirectUri) => { | ||
return new google.auth.OAuth2( | ||
keys.web.client_id, | ||
keys.web.client_secret, | ||
redirectUri, | ||
); | ||
}; | ||
// Generate the url that will be used for authorization | ||
const authorizeUrl = (cClient) => { | ||
return cClient.generateAuthUrl({ | ||
access_type: "offline", | ||
prompt: "consent", | ||
scope: scopes, | ||
}); | ||
}; | ||
|
||
module.exports = { client, authorizeUrl }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const logger = require("./logger"); | ||
|
||
logger.remove(logger.transports.Console); |
Oops, something went wrong.