Update to rails 7.0.3

* updated ruby to 2.7.5
* updated rails to 7.0.3
* switched devise_token_auth to git for rails7 support
* ran `rails app:update`
* cleanup .gitlab-ci.yml
* remove unnecessary ci files
* remove unused docker rake task
* fix potential inconsistent image build by using commit images as base
This commit is contained in:
Thor77 2022-05-16 22:24:20 +02:00
parent c3af6f9232
commit 28a74654d4
23 changed files with 412 additions and 279 deletions

View File

@ -6,7 +6,6 @@ docker/**
.hound.yml .hound.yml
.rspec .rspec
.rubocop.yml .rubocop.yml
.travis-yml
docker-compose.yml docker-compose.yml
README.md README.md
sonar-project.properties .gitlab-ci.yml

View File

@ -4,26 +4,29 @@ stages:
- deploy - deploy
kaniko: kaniko:
tags:
- docker
stage: build stage: build
image: image:
name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug
entrypoint: [""] entrypoint: [""]
script: script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - mkdir -p /kaniko/.docker
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/docker/production/Dockerfile --destination $CI_REGISTRY_IMAGE/production --destination $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE/production/branches:$CI_COMMIT_REF_SLUG - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/docker/development/Dockerfile --destination $CI_REGISTRY_IMAGE/development --destination $CI_REGISTRY_IMAGE/development/commits:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE/development/branches:$CI_COMMIT_REF_SLUG - |
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/docker/test/Dockerfile --destination $CI_REGISTRY_IMAGE/test --destination $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE/test/branches:$CI_COMMIT_REF_SLUG for env in production development test; do
/kaniko/executor --context "${CI_PROJECT_DIR}" \
--dockerfile "${CI_PROJECT_DIR}/docker/${env}/Dockerfile" \
--destination "${CI_REGISTRY_IMAGE}/${env}:latest" \
--destination "${CI_REGISTRY_IMAGE}/${env}/commits:${CI_COMMIT_SHA}" \
--destination "${CI_REGISTRY_IMAGE}/${env}/refs:${CI_COMMIT_REF_SLUG}" \
--build-arg base_commit="$CI_COMMIT_SHA"
done
rails spec: rails spec:
tags:
- docker
stage: test stage: test
image: $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA image: $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA
only: only:
changes: changes:
- '*.rb' - '**/*.rb'
- 'Gemfile' - 'Gemfile'
- 'Gemfile.lock' - 'Gemfile.lock'
except: except:
@ -57,8 +60,6 @@ kubernetes:
- krane render -f kubernetes --current-sha "$CI_COMMIT_SHA" | krane deploy turniere-backend local -f kubernetes/secrets.ejson - - krane render -f kubernetes --current-sha "$CI_COMMIT_SHA" | krane deploy turniere-backend local -f kubernetes/secrets.ejson -
deploy_watchtower: deploy_watchtower:
tags:
- docker
stage: deploy stage: deploy
only: only:
refs: refs:

View File

@ -1,6 +0,0 @@
fail_on_violations: true
rubocop:
version: 0.72.0
config_file: .rubocop.yml

View File

@ -1 +1 @@
2.7.1 2.7.5

View File

@ -1,16 +0,0 @@
language: ruby
addons:
sonarcloud:
organization: turniere-dhbw
env:
- RAILS_ENV=test
script:
- bundle exec rails db:migrate
- bundle exec rails spec
- sonar-scanner
notifications:
slack:
secure: EDlQKAXSltE2d4vdOtwVdFhPScjFU2rsSSgAGSqV24br4Jb/KihpjracavZW5wnmloiWe0ulj19j7LOtJSCNJOGqeAnct+axNyBRTI+9ctpeBDMHHtiOH9IX2EBsnEBpHdL4gMgOrPFfMoyn+sqbZ7EJgOFU41f/c7X0XUf1QeJ02Gh/uY1+m8Qo0eT9x4u8W+wnCFYCQeTWOB9/4aemkgbELOEDCbLYr5n+HCGK1vi+glmYoyldVr2yQBnbfME2fcNSOb7ytPDzjBI00cdGVhj8e/AMsF84W+Q+U3RIF0zjestQeFp3lPtTcHDt/MRH39MV1fjRaZB4A8+QYrjuECJ6wjzvzXJbGWUjE++6OmbRmszPlkFxXDiiiAe/Vs1NzUr4i7c2aWZhq8Q/6HDwYXx+/OUJY3THpCHjel/PC49s+KZqMrmq53nd6NWSCtZSPCXN/1uqb3m/zUq7i4wSNFirN+9E8reYkEq6GrpG1VwZkpKp9SkjWnd88cgM0JQEpC/dxRrmeI3o+uPRSIXV+RIaGCXIAdWO7eWBIJdpVQNrA4GDjWc+zj0X02qgbn6d6iByFCDtXzB+ognZwmKUnpJ4tF3oh5xv7j6cFw/GNirgThTLwEoXMfC/Q9OmhlYByOsZ+PBApsj0hfs74YXfN753eCglmtOKGqkpRT6kwG8=
on_success: change
on_failure: always
on_pull_requests: false

18
Gemfile
View File

@ -3,14 +3,14 @@
source 'https://rubygems.org' source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.1' ruby '2.7.5'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3' gem 'rails', '~> 7.0.3'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
gem 'sqlite3' gem 'sqlite3'
# Use Puma as the app server # Use Puma as the app server
gem 'puma', '~> 4.1' gem 'puma', '~> 5.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5' # gem 'jbuilder', '~> 2.5'
# Use ActiveModel has_secure_password # Use ActiveModel has_secure_password
@ -23,14 +23,14 @@ gem 'puma', '~> 4.1'
# gem 'capistrano-rails', group: :development # gem 'capistrano-rails', group: :development
# Reduces boot times through caching; required in config/boot.rb # Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false gem 'bootsnap', require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors' # gem 'rack-cors'
# Authentication # Authentication
gem 'devise' gem 'devise'
gem 'devise_token_auth' gem 'devise_token_auth', :git => 'https://github.com/lynndylanhurley/devise_token_auth.git'
gem 'rack-cors' gem 'rack-cors'
@ -42,9 +42,7 @@ gem 'active_model_serializers'
gem 'mailgun-ruby' gem 'mailgun-ruby'
group :development, :test do group :test, optional: true do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'coveralls', require: false gem 'coveralls', require: false
gem 'factory_bot_rails' gem 'factory_bot_rails'
gem 'faker' gem 'faker'
@ -52,8 +50,8 @@ group :development, :test do
gem 'shoulda-matchers' gem 'shoulda-matchers'
end end
group :development do group :development, optional: true do
gem 'listen', '>= 3.0.5', '< 3.2' gem 'listen', '~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'railroady' gem 'railroady'
gem 'rubocop' gem 'rubocop'

View File

@ -1,77 +1,95 @@
GIT
remote: https://github.com/lynndylanhurley/devise_token_auth.git
revision: 798255ee7e3fee5cfa2fdc519fd90e281bd9b6f5
specs:
devise_token_auth (1.2.0)
bcrypt (~> 3.0)
devise (> 3.5.2, < 5)
rails (>= 4.2.0, < 7.1)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.0.4) actioncable (7.0.3)
actionpack (= 6.0.4) actionpack (= 7.0.3)
activesupport (= 7.0.3)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.0.4) actionmailbox (7.0.3)
actionpack (= 6.0.4) actionpack (= 7.0.3)
activejob (= 6.0.4) activejob (= 7.0.3)
activerecord (= 6.0.4) activerecord (= 7.0.3)
activestorage (= 6.0.4) activestorage (= 7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.0.4) net-imap
actionpack (= 6.0.4) net-pop
actionview (= 6.0.4) net-smtp
activejob (= 6.0.4) actionmailer (7.0.3)
actionpack (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activesupport (= 7.0.3)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.0.4) actionpack (7.0.3)
actionview (= 6.0.4) actionview (= 7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
rack (~> 2.0, >= 2.0.8) rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.4) actiontext (7.0.3)
actionpack (= 6.0.4) actionpack (= 7.0.3)
activerecord (= 6.0.4) activerecord (= 7.0.3)
activestorage (= 6.0.4) activestorage (= 7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.0.4) actionview (7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.12) active_model_serializers (0.10.13)
actionpack (>= 4.1, < 6.2) actionpack (>= 4.1, < 7.1)
activemodel (>= 4.1, < 6.2) activemodel (>= 4.1, < 7.1)
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (6.0.4) activejob (7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.0.4) activemodel (7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
activerecord (6.0.4) activerecord (7.0.3)
activemodel (= 6.0.4) activemodel (= 7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
activestorage (6.0.4) activestorage (7.0.3)
actionpack (= 6.0.4) actionpack (= 7.0.3)
activejob (= 6.0.4) activejob (= 7.0.3)
activerecord (= 6.0.4) activerecord (= 7.0.3)
marcel (~> 1.0.0) activesupport (= 7.0.3)
activesupport (6.0.4) marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.3)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 1.6, < 2)
minitest (~> 5.1) minitest (>= 5.1)
tzinfo (~> 1.1) tzinfo (~> 2.0)
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.2) ast (2.4.2)
backport (1.2.0) backport (1.2.0)
bcrypt (3.1.16) bcrypt (3.1.18)
benchmark (0.1.1) benchmark (0.2.0)
bootsnap (1.7.7) bootsnap (1.11.1)
msgpack (~> 1.0) msgpack (~> 1.2)
builder (3.2.4) builder (3.2.4)
byebug (11.1.3)
case_transform (0.2) case_transform (0.2)
activesupport activesupport
concurrent-ruby (1.1.9) concurrent-ruby (1.1.10)
coveralls (0.8.23) coveralls (0.8.23)
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov (~> 0.16.1) simplecov (~> 0.16.1)
@ -79,119 +97,127 @@ GEM
thor (>= 0.19.4, < 2.0) thor (>= 0.19.4, < 2.0)
tins (~> 1.6) tins (~> 1.6)
crass (1.0.6) crass (1.0.6)
devise (4.8.0) devise (4.8.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0) railties (>= 4.1.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise_token_auth (1.2.0) diff-lcs (1.5.0)
bcrypt (~> 3.0) digest (3.1.0)
devise (> 3.5.2, < 5)
rails (>= 4.2.0, < 6.2)
diff-lcs (1.4.4)
docile (1.4.0) docile (1.4.0)
domain_name (0.5.20190701) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
e2mmap (0.1.0) e2mmap (0.1.0)
erubi (1.10.0) erubi (1.10.0)
factory_bot (6.2.0) factory_bot (6.2.1)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
factory_bot_rails (6.2.0) factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0) factory_bot (~> 6.2.0)
railties (>= 5.0.0) railties (>= 5.0.0)
faker (2.18.0) faker (2.21.0)
i18n (>= 1.6, < 2) i18n (>= 1.8.11, < 2)
ffi (1.15.3) ffi (1.15.5)
globalid (0.5.2) globalid (1.0.0)
activesupport (>= 5.0) activesupport (>= 5.0)
http-accept (1.7.0) http-accept (1.7.0)
http-cookie (1.0.4) http-cookie (1.0.4)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (1.8.10) i18n (1.10.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
interactor (3.1.2) interactor (3.1.2)
interactor-rails (2.2.1) interactor-rails (2.2.1)
interactor (~> 3.0) interactor (~> 3.0)
rails (>= 4.2) rails (>= 4.2)
jaro_winkler (1.5.4) jaro_winkler (1.5.4)
json (2.5.1) json (2.6.2)
jsonapi-renderer (0.2.2) jsonapi-renderer (0.2.2)
kramdown (2.3.1) kramdown (2.4.0)
rexml rexml
kramdown-parser-gfm (1.1.0) kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0) kramdown (~> 2.0)
listen (3.1.5) listen (3.7.1)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.10)
ruby_dep (~> 1.2) loofah (2.18.0)
loofah (2.12.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
mailgun-ruby (1.2.5) mailgun-ruby (1.2.5)
rest-client (>= 2.0.2) rest-client (>= 2.0.2)
marcel (1.0.1) marcel (1.0.2)
method_source (1.0.0) method_source (1.0.0)
mime-types (3.3.1) mime-types (3.4.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2021.0704) mime-types-data (3.2022.0105)
mini_mime (1.1.0) mini_mime (1.1.2)
mini_portile2 (2.6.1) minitest (5.15.0)
minitest (5.14.4) msgpack (1.5.1)
msgpack (1.4.2) net-imap (0.2.3)
digest
net-protocol
strscan
net-pop (0.1.1)
digest
net-protocol
timeout
net-protocol (0.1.3)
timeout
net-smtp (0.3.1)
digest
net-protocol
timeout
netrc (0.11.0) netrc (0.11.0)
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.12.3) nokogiri (1.13.6-x86_64-linux)
mini_portile2 (~> 2.6.1)
racc (~> 1.4) racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.20.1) parallel (1.22.1)
parser (3.0.2.0) parser (3.1.2.0)
ast (~> 2.4.1) ast (~> 2.4.1)
pg (1.2.3) pg (1.3.5)
puma (4.3.8) puma (5.6.4)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.5.2) racc (1.6.0)
rack (2.2.3) rack (2.2.3)
rack-cors (1.1.1) rack-cors (1.1.1)
rack (>= 2.0.0) rack (>= 2.0.0)
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
railroady (1.6.0) railroady (1.6.0)
rails (6.0.4) rails (7.0.3)
actioncable (= 6.0.4) actioncable (= 7.0.3)
actionmailbox (= 6.0.4) actionmailbox (= 7.0.3)
actionmailer (= 6.0.4) actionmailer (= 7.0.3)
actionpack (= 6.0.4) actionpack (= 7.0.3)
actiontext (= 6.0.4) actiontext (= 7.0.3)
actionview (= 6.0.4) actionview (= 7.0.3)
activejob (= 6.0.4) activejob (= 7.0.3)
activemodel (= 6.0.4) activemodel (= 7.0.3)
activerecord (= 6.0.4) activerecord (= 7.0.3)
activestorage (= 6.0.4) activestorage (= 7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
bundler (>= 1.3.0) bundler (>= 1.15.0)
railties (= 6.0.4) railties (= 7.0.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.4.2)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.0.4) railties (7.0.3)
actionpack (= 6.0.4) actionpack (= 7.0.3)
activesupport (= 6.0.4) activesupport (= 7.0.3)
method_source method_source
rake (>= 0.8.7) rake (>= 12.2)
thor (>= 0.20.3, < 2.0) thor (~> 1.0)
rainbow (3.0.0) zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6) rake (13.0.6)
rb-fsevent (0.11.0) rb-fsevent (0.11.1)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
regexp_parser (2.1.1) regexp_parser (2.4.0)
responders (3.0.1) responders (3.0.1)
actionpack (>= 5.0) actionpack (>= 5.0)
railties (>= 5.0) railties (>= 5.0)
@ -200,18 +226,18 @@ GEM
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
netrc (~> 0.8) netrc (~> 0.8)
reverse_markdown (2.0.0) reverse_markdown (2.1.1)
nokogiri nokogiri
rexml (3.2.5) rexml (3.2.5)
rspec-core (3.10.1) rspec-core (3.11.0)
rspec-support (~> 3.10.0) rspec-support (~> 3.11.0)
rspec-expectations (3.10.1) rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0) rspec-support (~> 3.11.0)
rspec-mocks (3.10.2) rspec-mocks (3.11.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0) rspec-support (~> 3.11.0)
rspec-rails (5.0.2) rspec-rails (5.1.2)
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
railties (>= 5.2) railties (>= 5.2)
@ -219,35 +245,34 @@ GEM
rspec-expectations (~> 3.10) rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10) rspec-mocks (~> 3.10)
rspec-support (~> 3.10) rspec-support (~> 3.10)
rspec-support (3.10.2) rspec-support (3.11.0)
rubocop (1.19.0) rubocop (1.29.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.0.0.0) parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.9.1, < 2.0) rubocop-ast (>= 1.17.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.10.0) rubocop-ast (1.18.0)
parser (>= 3.0.1.1) parser (>= 3.1.1.0)
rubocop-performance (1.11.4) rubocop-performance (1.13.3)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0) rubocop-ast (>= 0.4.0)
rubocop-rails (2.11.3) rubocop-rails (2.14.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)
ruby_dep (1.5.0) shoulda-matchers (5.1.0)
shoulda-matchers (5.0.0)
activesupport (>= 5.2.0) activesupport (>= 5.2.0)
simplecov (0.16.1) simplecov (0.16.1)
docile (~> 1.1) docile (~> 1.1)
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.2) simplecov-html (0.10.2)
solargraph (0.43.0) solargraph (0.44.3)
backport (~> 1.2) backport (~> 1.2)
benchmark benchmark
bundler (>= 1.17.2) bundler (>= 1.17.2)
@ -266,57 +291,52 @@ GEM
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 1.2, < 3.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.4.2) sqlite3 (1.4.2)
strscan (3.0.3)
sync (0.5.0) sync (0.5.0)
term-ansicolor (1.7.1) term-ansicolor (1.7.1)
tins (~> 1.0) tins (~> 1.0)
thor (1.1.0) thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
tins (1.29.1) timeout (0.2.0)
tins (1.31.1)
sync sync
tzinfo (1.2.9) tzinfo (2.0.4)
thread_safe (~> 0.1) concurrent-ruby (~> 1.0)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.7) unf_ext (0.0.8.1)
unicode-display_width (2.0.0) unicode-display_width (2.1.0)
warden (1.2.9) warden (1.2.9)
rack (>= 2.0.9) rack (>= 2.0.9)
webrick (1.7.0)
websocket-driver (0.7.5) websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
yard (0.9.26) yard (0.9.27)
zeitwerk (2.4.2) webrick (~> 1.7.0)
zeitwerk (2.5.4)
PLATFORMS PLATFORMS
ruby x86_64-linux
DEPENDENCIES DEPENDENCIES
active_model_serializers active_model_serializers
bootsnap (>= 1.4.2) bootsnap
byebug
coveralls coveralls
devise devise
devise_token_auth devise_token_auth!
factory_bot_rails factory_bot_rails
faker faker
interactor interactor
interactor-rails interactor-rails
listen (>= 3.0.5, < 3.2) listen (~> 3.3)
mailgun-ruby mailgun-ruby
pg pg
puma (~> 4.1) puma (~> 5.0)
rack-cors rack-cors
railroady railroady
rails (~> 6.0.3) rails (~> 7.0.3)
rspec-rails rspec-rails
rubocop rubocop
rubocop-performance rubocop-performance
@ -329,7 +349,7 @@ DEPENDENCIES
tzinfo-data tzinfo-data
RUBY VERSION RUBY VERSION
ruby 2.7.1p83 ruby 2.7.5p203
BUNDLED WITH BUNDLED WITH
1.17.2 2.3.13

View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin APP_PATH = File.expand_path("../config/application", __dir__)
load File.expand_path('../spring', __FILE__) require_relative "../config/boot"
rescue LoadError => e require "rails/commands"
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'

View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin require_relative "../config/boot"
load File.expand_path('../spring', __FILE__) require "rake"
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run Rake.application.run

View File

@ -1,33 +1,33 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'fileutils' require "fileutils"
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = File.expand_path('..', __dir__) APP_ROOT = File.expand_path("..", __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end end
chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts "== Installing dependencies =="
system! 'gem install bundler --conservative' system! "gem install bundler --conservative"
system('bundle check') || system!('bundle install') system("bundle check") || system!("bundle install")
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml') # unless File.exist?("config/database.yml")
# cp 'config/database.yml.sample', 'config/database.yml' # FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! 'bin/rails db:setup' system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear' system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server ==" puts "\n== Restarting application server =="
system! 'bin/rails restart' system! "bin/rails restart"
end end

View File

@ -23,6 +23,7 @@ module TurniereBackend
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2 config.load_defaults 5.2
config.autoloader = :zeitwerk
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers # Application configuration can go into files in config/initializers
@ -46,5 +47,8 @@ module TurniereBackend
config.action_mailer.default_options = { config.action_mailer.default_options = {
from: 'noreply@turnie.re' from: 'noreply@turnie.re'
} }
# Active Record
config.active_record.legacy_connection_handling = false
end end
end end

View File

@ -1,6 +1,4 @@
# frozen_string_literal: true ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure parameters to be filtered from the log file. Use this to limit dissemination of
Rails.application.config.filter_parameters += [:password] # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View File

@ -0,0 +1,117 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `7.0`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
# `button_to` view helper will render `<button>` element, regardless of whether
# or not the content is passed as the first argument or as a block.
# Rails.application.config.action_view.button_to_generates_button_tag = true
# `stylesheet_link_tag` view helper will not render the media attribute by default.
# Rails.application.config.action_view.apply_stylesheet_media_default = false
# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
# Changing this default means invalidate all encrypted messages generated by
# your application and, all the encrypted cookies. Only change this after you
# rotated all the messages using the key rotator.
#
# See upgrading guide for more information on how to build a rotator.
# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
# Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
# Change the digest class for ActiveSupport::Digest.
# Changing this default means that for example Etags change and
# various cache keys leading to cache invalidation.
# Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
# implementation.
# Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
# Change the format of the cache entry.
# Changing this default means that all new cache entries added to the cache
# will have a different format that is not supported by Rails 6.1 applications.
# Only change this value after your application is fully deployed to Rails 7.0
# and you have no plans to rollback.
# Rails.application.config.active_support.cache_format_version = 7.0
# Calls `Rails.application.executor.wrap` around test cases.
# This makes test cases behave closer to an actual request or job.
# Several features that are normally disabled in test, such as Active Record query cache
# and asynchronous queries will then be enabled.
# Rails.application.config.active_support.executor_around_test_case = true
# Define the isolation level of most of Rails internal state.
# If you use a fiber based server or job processor, you should set it to `:fiber`.
# Otherwise the default of `:thread` if preferable.
# Rails.application.config.active_support.isolation_level = :thread
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
# Rails.application.config.action_mailer.smtp_timeout = 5
# The ActiveStorage video previewer will now use scene change detection to generate
# better preview images (rather than the previous default of using the first frame
# of the video).
# Rails.application.config.active_storage.video_preview_arguments =
# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
# Automatically infer `inverse_of` for associations with a scope.
# Rails.application.config.active_record.automatic_scope_inversing = true
# Raise when running tests if fixtures contained foreign key violations
# Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
# Disable partial inserts.
# This default means that all columns will be referenced in INSERT queries
# regardless of whether they have a default or not.
# Rails.application.config.active_record.partial_inserts = false
#
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
# Rails.application.config.action_controller.raise_on_open_redirects = true
# Change the variant processor for Active Storage.
# Changing this default means updating all places in your code that
# generate variants to use image processing macros and ruby-vips
# operations. See the upgrading guide for detail on the changes required.
# The `:mini_magick` option is not deprecated; it's fine to keep using it.
# Rails.application.config.active_storage.variant_processor = :vips
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
# was `:marshal`. Convert all cookies to JSON, using the `:hybrid` formatter.
#
# If you're confident all your cookies are JSON formatted, you can switch to the `:json` formatter.
#
# Continue to use `:marshal` for backward-compatibility with old cookies.
#
# If you have configured the serializer elsewhere, you can remove this.
#
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
# Enable parameter wrapping for JSON.
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
# To disable parameter wrapping entirely, set this config to `false`.
# Rails.application.config.action_controller.wrap_parameters_by_default = true
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
#
# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
# more information.
# Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
# Change the default headers to disable browsers' flawed legacy XSS protection.
# Rails.application.config.action_dispatch.default_headers = {
# "X-Frame-Options" => "SAMEORIGIN",
# "X-XSS-Protection" => "0",
# "X-Content-Type-Options" => "nosniff",
# "X-Download-Options" => "noopen",
# "X-Permitted-Cross-Domain-Policies" => "none",
# "Referrer-Policy" => "strict-origin-when-cross-origin"
# }

View File

@ -0,0 +1,22 @@
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return unless table_exists?(:active_storage_blobs)
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end
change_column :active_storage_blobs, :service_name, :string, null: false
end
end
def down
return unless table_exists?(:active_storage_blobs)
remove_column :active_storage_blobs, :service_name
end
end

View File

@ -0,0 +1,27 @@
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
# Use Active Record's configured type for primary key
create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
t.string :variation_digest, null: false
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
private
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end
def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
end

View File

@ -0,0 +1,8 @@
# This migration comes from active_storage (originally 20211119233751)
class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
change_column_null(:active_storage_blobs, :checksum, true)
end
end

View File

@ -7,7 +7,7 @@ tournament = user.tournaments.create! name: Faker::Creature::Dog.name
@teams = [] @teams = []
16.times do 16.times do
team = tournament.teams.create! name: Faker::HarryPotter.character team = tournament.teams.create! name: Faker::Movies::HarryPotter.character
@teams << team @teams << team
end end
4.times do |i| 4.times do |i|
@ -19,7 +19,7 @@ end
match.match_scores.create! team: @teams.sample, points: rand(10) match.match_scores.create! team: @teams.sample, points: rand(10)
match.match_scores.create! team: @teams.sample, points: rand(10) match.match_scores.create! team: @teams.sample, points: rand(10)
match.position = j match.position = j
match.state = rand(7) match.state = rand(5)
match.save! match.save!
end end
stage.save! stage.save!

View File

@ -1,6 +1,7 @@
# Build production container locally first with following tag # Build production container locally first with following tag
FROM registry.gitlab.com/turniere/turniere-backend/production ARG base_commit
FROM registry.gitlab.com/turniere/turniere-backend/production/commits:$base_commit
WORKDIR /app WORKDIR /app
RUN bundle install --deployment --with development RUN bundle config set with 'development' && bundle install
ENV RAILS_ENV development ENV RAILS_ENV development
CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0 CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0

View File

@ -1,8 +1,9 @@
FROM ruby:2.7.1-alpine ARG base_commit
RUN apk add --no-cache build-base tzdata sqlite sqlite-dev postgresql-dev && gem install tzinfo-data FROM ruby:2.7.5-alpine
RUN apk add --no-cache build-base tzdata sqlite sqlite-dev postgresql-dev git && gem install tzinfo-data
WORKDIR /app WORKDIR /app
COPY Gemfile* /app/ COPY Gemfile* /app/
RUN bundle install --deployment --without development test RUN gem install bundler:2.3.13 && bundle config set deployment 'true' && bundle install
COPY . /app COPY . /app
ENV RAILS_ENV production ENV RAILS_ENV production
CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0 CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0

View File

@ -1,6 +1,7 @@
# Build development container locally first with following tag # Build development container locally first with following tag
FROM registry.gitlab.com/turniere/turniere-backend/development ARG base_commit
FROM registry.gitlab.com/turniere/turniere-backend/development/commits:$base_commit
WORKDIR /app WORKDIR /app
RUN bundle install --deployment --with test RUN bundle config set with 'test' && bundle install
ENV RAILS_ENV test ENV RAILS_ENV test
CMD bundle exec rails db:migrate && bundle exec rails spec CMD bundle exec rails db:migrate && bundle exec rails spec

View File

@ -1,28 +0,0 @@
# frozen_string_literal: true
IMAGE_NAME = 'turniere/backend'
namespace :docker do
desc 'Build docker image'
task build: :environment, [:tag] do |_, args|
args.with_defaults(tag: 'latest')
sh "docker build -t #{IMAGE_NAME}:#{args.tag} ."
end
desc 'Tag docker image with Travis build number'
task tag: :environment do
next if ENV['TRAVIS_PULL_REQUEST'] != 'false'
tag = "build#{ENV['TRAVIS_BUILD_NUMBER']}"
sh "docker tag #{IMAGE_NAME} #{IMAGE_NAME}:#{tag}"
end
desc 'Push docker image'
task push: :environment do
sh "docker push #{IMAGE_NAME}"
end
desc 'Run TravisCI tasks'
task travis: %i[build tag push] do
end
end

View File

@ -1,6 +0,0 @@
sonar.projectKey=turniere_turniere-backend
sonar.organization=turniere-dhbw
sonar.projectName=turniere-backend
sonar.projectVersion=1.0
sonar.sources=app
sonar.ruby.coverage.reportPaths=coverage/.resultset.json