├── config └── .env-example ├── public ├── .browserslistrc ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── assets │ │ └── components │ │ │ ├── instructions.scss │ │ │ ├── header.scss │ │ │ ├── modal.scss │ │ │ └── form.scss │ ├── main.js │ ├── components │ │ ├── header.vue │ │ ├── modal.vue │ │ ├── instructions.vue │ │ └── form.vue │ ├── App.vue │ └── pages │ │ └── ci.vue ├── .gitignore ├── README.md └── package.json ├── nodemon.json ├── server.js ├── routes └── generateRoute.js ├── .gitignore ├── templates └── common-ci.js ├── controllers └── generateController.js ├── package.json ├── app.js ├── README.md ├── LICENSE └── README.pt-br.md /config/.env-example: -------------------------------------------------------------------------------- 1 | PORT=3000 -------------------------------------------------------------------------------- /public/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /public/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siimaoo/gitlabci-generator/HEAD/public/public/favicon.ico -------------------------------------------------------------------------------- /nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": [ 3 | "./" 4 | ], 5 | "ext": "js", 6 | "execMap": { 7 | "js": "sucrase-node server.js" 8 | } 9 | } -------------------------------------------------------------------------------- /public/src/assets/components/instructions.scss: -------------------------------------------------------------------------------- 1 | ul { 2 | list-style: none; 3 | 4 | li { 5 | padding: 5px 0px; 6 | 7 | p { 8 | font-size: 1.2rem; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /public/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: function (h) { return h(App) }, 8 | }).$mount('#app') 9 | -------------------------------------------------------------------------------- /public/src/assets/components/header.scss: -------------------------------------------------------------------------------- 1 | nav { 2 | width: 100%; 3 | height: 80px; 4 | box-shadow: 0px 0px 3px 1px #ddd; 5 | display: flex; 6 | flex-direction: row; 7 | align-items: center; 8 | 9 | & h1 { 10 | font-size: 3rem; 11 | } 12 | } -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | import app from "./app"; 2 | import dotenv from 'dotenv'; 3 | 4 | dotenv.config({path: './config/.env'}); 5 | 6 | const port = process.env.PORT || 3000; 7 | 8 | app.listen((port), () => { 9 | console.log(`Server is running on port ${port}`); 10 | }) -------------------------------------------------------------------------------- /public/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /public/README.md: -------------------------------------------------------------------------------- 1 | # public 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn build 16 | ``` 17 | 18 | ### Customize configuration 19 | See [Configuration Reference](https://cli.vuejs.org/config/). 20 | -------------------------------------------------------------------------------- /routes/generateRoute.js: -------------------------------------------------------------------------------- 1 | import { Router } from 'express'; 2 | 3 | import generateController from '../controllers/generateController' 4 | 5 | const routes = Router(); 6 | 7 | routes.post('/generate', generateController.generate); 8 | 9 | routes.get('/', (req, res) => { 10 | res.render(__dirname + '/../public/dist/index.html'); 11 | }) 12 | 13 | export default routes; -------------------------------------------------------------------------------- /public/src/components/header.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | ci-files/* 3 | yarn.lock 4 | .env 5 | 6 | public/node_modules/ 7 | public/dist 8 | 9 | .DS_Store 10 | node_modules 11 | /dist 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | # Editor directories and files 23 | .idea 24 | .vscode 25 | *.suo 26 | *.ntvs* 27 | *.njsproj 28 | *.sln 29 | *.sw? 30 | -------------------------------------------------------------------------------- /public/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "public", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "axios": "^0.19.2", 11 | "bootstrap": "^4.4.1", 12 | "vue": "^2.6.11" 13 | }, 14 | "devDependencies": { 15 | "@vue/cli-service": "~4.2.0", 16 | "node-sass": "^4.12.0", 17 | "sass-loader": "^8.0.2", 18 | "vue-template-compiler": "^2.6.11" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /public/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 18 | 19 | 29 | -------------------------------------------------------------------------------- /templates/common-ci.js: -------------------------------------------------------------------------------- 1 | export function common(user, ip, path) { 2 | return `image: 3 | stages: 4 | - deploy 5 | 6 | deploy: 7 | stage: deploy 8 | only: 9 | - master 10 | script: 11 | - mkdir -p ~/.ssh 12 | - echo "$PRODUCTION_KEY" >> ~/.ssh/id_rsa 13 | - chmod 600 ~/.ssh/id_rsa 14 | - echo -e "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > ~/.ssh/config 15 | - rsync --progress -rav -e "ssh" --delete * ${user}@${ip}:../${path} 16 | - ssh ${user}@${ip} "chown -R root.root ..${path}" 17 | `; 18 | } -------------------------------------------------------------------------------- /controllers/generateController.js: -------------------------------------------------------------------------------- 1 | import { common } from '../templates/common-ci'; 2 | 3 | class generateController { 4 | generate(req, res) { 5 | const { user, ip, path } = req.body; 6 | 7 | const fileData = common(user, ip, path); 8 | const fileName = 'gitlab-ci.txt' 9 | const fileType = 'text/plain' 10 | 11 | res.writeHead(200, { 12 | 'Content-Disposition': `attachment; filename="${fileName}"`, 13 | 'Content-Type': fileType, 14 | }) 15 | 16 | const download = Buffer.from(fileData); 17 | res.end(download); 18 | } 19 | } 20 | 21 | export default new generateController(); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generate-ci-file", 3 | "version": "1.0.0", 4 | "description": "Gerador de arquivo para CI no gitlab", 5 | "main": "app.js", 6 | "author": "Lucas Simão", 7 | "license": "MIT", 8 | "scripts": { 9 | "dev": "concurrently --kill-others-on-fail \"nodemon server.js\" \"cd public/ && yarn serve\" ", 10 | "dev-mvc": "cd public/ && yarn build && cd .. && nodemon server.js" 11 | }, 12 | "dependencies": { 13 | "dotenv": "^8.2.0", 14 | "express": "^4.17.1" 15 | }, 16 | "devDependencies": { 17 | "nodemon": "^2.0.2", 18 | "sucrase": "^3.12.1", 19 | "concurrently": "^5.1.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /public/src/assets/components/modal.scss: -------------------------------------------------------------------------------- 1 | .bg { 2 | width: 100%; 3 | height: 100vh; 4 | position: absolute; 5 | top: 0; 6 | background-color: rgba(0, 0, 0, 0.8); 7 | z-index: 1; 8 | } 9 | 10 | .dialog { 11 | padding: 5%; 12 | width: 90%; 13 | max-width: 500px; 14 | position: fixed; 15 | top: 50%; 16 | border-radius: 5px; 17 | left: 50%; 18 | transform: translate(-50%, -50%); 19 | background-color: #fff; 20 | z-index: 1; 21 | animation: showModal 0.4s ease-in; 22 | 23 | button { 24 | width: 100%; 25 | } 26 | } 27 | 28 | @keyframes showModal { 29 | 0% { 30 | opacity: 0; 31 | top: 60%; 32 | } 33 | 34 | 100% { 35 | opacity: 1; 36 | top: 50%; 37 | } 38 | } -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import path from 'path'; 3 | 4 | import routes from './routes/generateRoute'; 5 | 6 | class App { 7 | constructor() { 8 | this.express = express(); 9 | this.middlewares(); 10 | this.routes(); 11 | } 12 | 13 | middlewares() { 14 | this.express.use((req, res, next) => { 15 | res.set({ 16 | 'Access-Control-Allow-Origin': '*', 17 | 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE', 18 | 'Access-Control-Allow-Headers': 'Content-Type' 19 | }) 20 | next(); 21 | }); 22 | 23 | this.express.use(express.static(path.join(__dirname, '/public/dist'))); 24 | this.express.use(express.json()); 25 | } 26 | 27 | routes() { 28 | this.express.use(routes); 29 | } 30 | } 31 | 32 | export default new App().express; -------------------------------------------------------------------------------- /public/src/assets/components/form.scss: -------------------------------------------------------------------------------- 1 | form { 2 | box-shadow: 0px 0px 3px 1px #ddd; 3 | padding: 5%; 4 | width: 90%; 5 | height: 80%; 6 | max-width: 400px; 7 | border-radius: 10px; 8 | margin: 30px auto; 9 | 10 | .btn { 11 | border-radius: 5px; 12 | width: 100%; 13 | } 14 | 15 | input { 16 | width: 100%; 17 | border: 1px solid #c4e2ec; 18 | border-radius: 5px; 19 | height: 50px; 20 | padding: { 21 | left: 10px; 22 | right: 10px; 23 | top: 20px; 24 | }; 25 | margin: -10px 0px; 26 | } 27 | 28 | label { 29 | position: relative; 30 | top: -42px; 31 | left: 12px; 32 | font-size: 1rem; 33 | transition: all .1s ease-in; 34 | } 35 | } 36 | 37 | .active { 38 | color: #00afe6; 39 | font-size: 0.8rem; 40 | top: -47px; 41 | } 42 | 43 | .inputFocus { 44 | outline: none; 45 | border: 1px solid #00c3e6; 46 | } -------------------------------------------------------------------------------- /public/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <%= htmlWebpackPlugin.options.title %> 10 | 13 | 14 | 15 | 16 | 17 | 21 |
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /public/src/components/modal.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [EN](/README.md) [PT-BR](/README.pt-br.md) 2 | 3 | # CI Generator 4 | CI Generator is a project that generate a file gitlab-ci.yml to your repository (gitlab) 5 | This project it’s being built with: 6 | * Node.js 7 | * Express 8 | * Sucrase 9 | * Vue.js 10 | ## Attention 11 | To run this project it is necessary node.js, yam or npm in your instance 12 | ## Installing dependencies 13 | in the root of the project 14 | ``` 15 | yarn && yarn dev 16 | ``` 17 | or 18 | ``` 19 | npm i && npm run dev 20 | ``` 21 | then 22 | ``` 23 | cd public/ 24 | ``` 25 | and run again 26 | ``` 27 | yarn && yarn serve 28 | ``` 29 | or 30 | ``` 31 | npm i && npm run serve 32 | ``` 33 | After the server starts, just go to 34 | ```http://localhost:8080``` 35 | ## Contributions 36 | New issues, features ideas, pull requests are welcome :) 37 | How to contribute: 38 | 1. Make a fork in the project 39 | 2. Create your own feature branch (git checkout -b feature/yourfeature) 40 | 3. Commit what you added (git commit -m 'I added that thing') 41 | 4. Make the push for your branch (git push origin feature/yourfeature) 42 | 5. Open a pull request 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Lucas Simão 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.pt-br.md: -------------------------------------------------------------------------------- 1 | [EN](/README.md) [PT-BR](/README.pt-br.md) 2 | 3 | # CI Generator 4 | 5 | CI Generator é um projeto que gera um arquivo gitlab-ci.yml para seu repositorio (gitlab) 6 | 7 | Esse projeto está sendo feito com: 8 | * Node.js 9 | * Express 10 | * Sucrase 11 | * Vue.js 12 | 13 | ## Atenção 14 | 15 | Para executar esse projeto sera necessário ter em sua maquina o node.js, yarn ou npm. 16 | 17 | ## Instalando dependências 18 | 19 | Na raiz do projeto 20 | ``` 21 | yarn && yarn dev 22 | ``` 23 | ou 24 | 25 | ``` 26 | npm i && npm run dev 27 | ``` 28 | 29 | Em seguida 30 | 31 | ``` 32 | cd public/ 33 | ``` 34 | e execute novamente 35 | ``` 36 | yarn && yarn serve 37 | ``` 38 | ou 39 | 40 | ``` 41 | npm i && npm run serve 42 | ``` 43 | 44 | Após o servidor ter sido iniciado basta acessar 45 | ```http://localhost:8080``` 46 | 47 | ## Contribuições 48 | Novas issues, ideas de features, pull requests são muito bem-vindos :) 49 | 50 | Como contribuir: 51 | 52 | 1. Faça um fork no projeto 53 | 2. Crie sua feature branch (git checkout -b feature/suafeature) 54 | 3. Commit suas alterações (git commit -m 'Adicionei tal coisa') 55 | 4. Faça o push para sua branch (git push origin feature/suafeature) 56 | 5. Abra um pull request 57 | -------------------------------------------------------------------------------- /public/src/components/instructions.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | -------------------------------------------------------------------------------- /public/src/pages/ci.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 58 | 59 | 66 | -------------------------------------------------------------------------------- /public/src/components/form.vue: -------------------------------------------------------------------------------- 1 | 72 | 73 | 101 | 102 | --------------------------------------------------------------------------------