Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
25 changes: 25 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### APPLICATION HELPER
## Interage::ApplicationHelper
#
APP_NAME='Desafio Impulso'
ENV_NAME='development'
PREFIX_ADMIN_PAGE_TITLE='Administração :: '
PREFIX_DEVISE_PAGE_TITLE='Autenticação :: '
DEFAULT_PASSWORD='Impulso@2021'

# Rails
#
PORT=3000
RAILS_ACTIVE_STORAGE_SERVICE='local'

# Database
#
DATABASE_HOST=''
DATABASE_USERNAME='walmir'
DATABASE_PASSWORD=''
DATABASE_NAME='desafio_impulso'
DISABLE_DATABASE_ENVIRONMENT_CHECK=1

# Mailers
#
DEVISE_MAILER_SENDER='desafio-impulso@interage.in'
18 changes: 18 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
linters:
ErbSafety:
enabled: false
Rubocop:
enabled: true
rubocop_config:
inherit_from:
- .rubocop.yml
Style/FrozenStringLiteralComment:
Enabled: false
Layout/InitialIndentation:
Enabled: false
Layout/TrailingEmptyLines:
Enabled: false
Layout/TrailingWhitespace:
Enabled: false
Rails/OutputSafety:
Enabled: false
Empty file added .eslintignore
Empty file.
49 changes: 49 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parser": "babel-eslint",
"extends": ["airbnb-base"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"import/no-unresolved": "off",
"max-len": ["error", { "code": 80, "tabWidth": 2 }]
},
"overrides": [
{
"files": [
"app/javascript/packs/application.js",
"app/javascript/packs/devise.js"
],
"rules": {
"no-unused-expressions": "off"
}
},
{
"files": [
"app/javascript/packs/bootstrap/bootstrap.js"
],
"rules": {
"no-underscore-dangle": "off"
}
},
{
"files": [
"app/javascript/packs/select2/select2-remote.js"
],
"rules": {
"no-param-reassign": "off",
"class-methods-use-this": "off"
}
}
]
}
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
push:
branches:
- master
- develop

jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:11@sha256:85d79cba2d4942dad7c99f84ec389a5b9cc84fb07a3dcd3aff0fb06948cdc03b
ports: ['5432:5432']

steps:
- uses: actions/checkout@v2
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 3.0.0
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- name: Build and run tests
env:
DATABASE_URL: postgres://postgres:@localhost:5432/test
POSTGRES_PASSWORD: postgres
RAILS_SECRET_KEY: ${{ secrets.RAILS_MASTER_KEY }}
RAILS_ENV: test
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler
ruby --version
bin/bundle --version
bin/bundle install --jobs 4 --retry 3
node --version
bin/yarn --version
bin/rails yarn:install webpacker:compile
bin/ci
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
### Rails ###
*.rbc
capybara-*.html
/db/*.sqlite3
/db/*.sqlite3-journal
/public/system
/coverage/
/spec/tmp
*.orig
rerun.txt
pickle-email-*.html
.browserslistrc

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

/db/dumps/*
!/db/dumps/.keep

# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/master.key

# Only include if you have production secrets in this file, which is no longer a Rails default
# config/secrets.yml

# dotenv
# TODO Comment out this rule if environment variables can be committed
.env
.env.production

## Environment normalization:
/.bundle
/vendor/bundle

# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json

# Ignore pow environment settings
.powenv

# Ignore Byebug command history file.
.byebug_history

# Ignore node_modules
node_modules/

# Ignore precompiled javascript packs
/public/packs
/public/packs-test
/public/assets

# Ignore yarn files
/yarn-error.log
yarn-debug.log*
.yarn-integrity
package-lock.json

# Ignore uploaded files in development
/storage/*
!/storage/.keep

# cTags
tags
tags.lock
tags.temp.tmp
46 changes: 46 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
stages:
- test
- deploy

specs:
stage: test
image: registry.gitlab.com/interage/docker-hub/ruby-for-rails-6:2.6.6
cache:
paths:
- vendor/ruby
- node_modules
services:
- postgres:11.6-alpine
variables:
TZ: 'America/Recife'
NODE_ENV: test
RAILS_ENV: test
DATABASE_HOST: postgres
before_script:
- ruby --version
- bin/bundle --version
- bin/bundle install --path vendor
- node --version
- bin/yarn --version
- bin/rails yarn:install webpacker:compile
script:
- bin/ci

packaging:
stage: deploy
image: docker:stable
only:
- tags
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay
script:
- LATEST_IMAGE_TAG="$CI_REGISTRY_IMAGE:latest"
- CURRENT_IMAGE_TAG="$CI_REGISTRY_IMAGE:$(echo $CI_COMMIT_SHA | cut -c -8)"
- docker pull $LATEST_IMAGE_TAG || true
- docker build --cache-from $LATEST_IMAGE_TAG -t $CURRENT_IMAGE_TAG -t $LATEST_IMAGE_TAG .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
- docker push $CURRENT_IMAGE_TAG
- docker push $LATEST_IMAGE_TAG
4 changes: 4 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--require rails_helper
--format documentation
--force-color
--order rand
49 changes: 49 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require:
- rubocop-rails
- rubocop-performance
- rubocop-rspec

Lint/MissingSuper:
Enabled: false

RSpec/MultipleMemoizedHelpers:
Enabled: false

Style/Documentation:
Enabled: false

Style/EmptyMethod:
EnforcedStyle: expanded

Style/SymbolArray:
Enabled: false

Style/WordArray:
Enabled: false

Layout/LineLength:
Exclude:
- config/initializers/**/*
- config/environments/**/*

Metrics/BlockLength:
Exclude:
- config/routes.rb
- config/initializers/**/*
- config/environments/**/*
- spec/controllers/**/*
- spec/factories/**/*
- spec/support/shared_contexts/**/*

AllCops:
NewCops: enable
TargetRubyVersion: 2.6
Exclude:
- Rakefile
- bin/**/*
- db/migrate/**/*
- db/schema.rb
- db/seeds.rb
- db/seeds/**/*
- vendor/**/*
- node_modules/**/*
1 change: 1 addition & 0 deletions .ruby-gemset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
interage-desafio-impulso
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.0
30 changes: 30 additions & 0 deletions .scss-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
scss_files:
- 'app/javascript/packs/**/{*.scss,*.css}'

exclude:
- 'node_modules/**'

linters:
IdSelector:
enabled: false

ImportantRule:
enabled: false

PropertySortOrder:
enabled: false

SelectorDepth:
enabled: false

SelectorFormat:
enabled: false

UrlFormat:
enabled: false

Indentation:
exclude:
- 'node_modules/**'
severity: warning
width: 2
Loading