From 28a74654d4f570f2889fc3419a052677bc044513 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Mon, 16 May 2022 22:24:20 +0200 Subject: [PATCH] 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 --- .dockerignore | 3 +- .gitlab-ci.yml | 23 +- .hound.yml | 6 - .ruby-version | 2 +- .travis.yml | 16 - Gemfile | 18 +- Gemfile.lock | 322 ++++++++++-------- bin/rails | 11 +- bin/rake | 9 +- bin/setup | 26 +- config/application.rb | 4 + config/boot.rb | 8 +- .../initializers/filter_parameter_logging.rb | 10 +- .../new_framework_defaults_7_0.rb | 117 +++++++ ..._to_active_storage_blobs.active_storage.rb | 22 ++ ..._storage_variant_records.active_storage.rb | 27 ++ ...e_storage_blobs_checksum.active_storage.rb | 8 + db/seeds.rb | 4 +- docker/development/Dockerfile | 7 +- docker/production/Dockerfile | 7 +- docker/test/Dockerfile | 7 +- lib/tasks/docker.rake | 28 -- sonar-project.properties | 6 - 23 files changed, 412 insertions(+), 279 deletions(-) delete mode 100644 .hound.yml delete mode 100644 .travis.yml create mode 100644 config/initializers/new_framework_defaults_7_0.rb create mode 100644 db/migrate/20220516203838_add_service_name_to_active_storage_blobs.active_storage.rb create mode 100644 db/migrate/20220516203839_create_active_storage_variant_records.active_storage.rb create mode 100644 db/migrate/20220516203840_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb delete mode 100644 lib/tasks/docker.rake delete mode 100644 sonar-project.properties diff --git a/.dockerignore b/.dockerignore index 8a3ef0c..5778f88 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,7 +6,6 @@ docker/** .hound.yml .rspec .rubocop.yml -.travis-yml docker-compose.yml README.md -sonar-project.properties \ No newline at end of file +.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50be965..e0ad253 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,26 +4,29 @@ stages: - deploy kaniko: - tags: - - docker stage: build image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /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 - - /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 + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json + - | + 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: - tags: - - docker stage: test image: $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA only: changes: - - '*.rb' + - '**/*.rb' - 'Gemfile' - 'Gemfile.lock' except: @@ -57,8 +60,6 @@ kubernetes: - krane render -f kubernetes --current-sha "$CI_COMMIT_SHA" | krane deploy turniere-backend local -f kubernetes/secrets.ejson - deploy_watchtower: - tags: - - docker stage: deploy only: refs: diff --git a/.hound.yml b/.hound.yml deleted file mode 100644 index 39fc2a5..0000000 --- a/.hound.yml +++ /dev/null @@ -1,6 +0,0 @@ -fail_on_violations: true - -rubocop: - version: 0.72.0 - config_file: .rubocop.yml - diff --git a/.ruby-version b/.ruby-version index 860487c..a603bb5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.1 +2.7.5 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d413499..0000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/Gemfile b/Gemfile index 2afaccd..bef2a4c 100644 --- a/Gemfile +++ b/Gemfile @@ -3,14 +3,14 @@ source 'https://rubygems.org' 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' -gem 'rails', '~> 6.0.3' +gem 'rails', '~> 7.0.3' # Use sqlite3 as the database for Active Record gem 'sqlite3' # 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 # gem 'jbuilder', '~> 2.5' # Use ActiveModel has_secure_password @@ -23,14 +23,14 @@ gem 'puma', '~> 4.1' # gem 'capistrano-rails', group: :development # 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 # gem 'rack-cors' # Authentication gem 'devise' -gem 'devise_token_auth' +gem 'devise_token_auth', :git => 'https://github.com/lynndylanhurley/devise_token_auth.git' gem 'rack-cors' @@ -42,9 +42,7 @@ gem 'active_model_serializers' gem 'mailgun-ruby' -group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug', platforms: %i[mri mingw x64_mingw] +group :test, optional: true do gem 'coveralls', require: false gem 'factory_bot_rails' gem 'faker' @@ -52,8 +50,8 @@ group :development, :test do gem 'shoulda-matchers' end -group :development do - gem 'listen', '>= 3.0.5', '< 3.2' +group :development, optional: true do + gem 'listen', '~> 3.3' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'railroady' gem 'rubocop' diff --git a/Gemfile.lock b/Gemfile.lock index 073e79c..7ef0944 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 remote: https://rubygems.org/ specs: - actioncable (6.0.4) - actionpack (= 6.0.4) + actioncable (7.0.3) + actionpack (= 7.0.3) + activesupport (= 7.0.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.4) - actionpack (= 6.0.4) - activejob (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) + actionmailbox (7.0.3) + actionpack (= 7.0.3) + activejob (= 7.0.3) + activerecord (= 7.0.3) + activestorage (= 7.0.3) + activesupport (= 7.0.3) mail (>= 2.7.1) - actionmailer (6.0.4) - actionpack (= 6.0.4) - actionview (= 6.0.4) - activejob (= 6.0.4) + net-imap + net-pop + net-smtp + 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) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.0.4) - actionview (= 6.0.4) - activesupport (= 6.0.4) - rack (~> 2.0, >= 2.0.8) + actionpack (7.0.3) + actionview (= 7.0.3) + activesupport (= 7.0.3) + rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.4) - actionpack (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) + actiontext (7.0.3) + actionpack (= 7.0.3) + activerecord (= 7.0.3) + activestorage (= 7.0.3) + activesupport (= 7.0.3) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.0.4) - activesupport (= 6.0.4) + actionview (7.0.3) + activesupport (= 7.0.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_model_serializers (0.10.12) - actionpack (>= 4.1, < 6.2) - activemodel (>= 4.1, < 6.2) + active_model_serializers (0.10.13) + actionpack (>= 4.1, < 7.1) + activemodel (>= 4.1, < 7.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (6.0.4) - activesupport (= 6.0.4) + activejob (7.0.3) + activesupport (= 7.0.3) globalid (>= 0.3.6) - activemodel (6.0.4) - activesupport (= 6.0.4) - activerecord (6.0.4) - activemodel (= 6.0.4) - activesupport (= 6.0.4) - activestorage (6.0.4) - actionpack (= 6.0.4) - activejob (= 6.0.4) - activerecord (= 6.0.4) - marcel (~> 1.0.0) - activesupport (6.0.4) + activemodel (7.0.3) + activesupport (= 7.0.3) + activerecord (7.0.3) + activemodel (= 7.0.3) + activesupport (= 7.0.3) + activestorage (7.0.3) + actionpack (= 7.0.3) + activejob (= 7.0.3) + activerecord (= 7.0.3) + activesupport (= 7.0.3) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.3) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) ast (2.4.2) backport (1.2.0) - bcrypt (3.1.16) - benchmark (0.1.1) - bootsnap (1.7.7) - msgpack (~> 1.0) + bcrypt (3.1.18) + benchmark (0.2.0) + bootsnap (1.11.1) + msgpack (~> 1.2) builder (3.2.4) - byebug (11.1.3) case_transform (0.2) activesupport - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) coveralls (0.8.23) json (>= 1.8, < 3) simplecov (~> 0.16.1) @@ -79,119 +97,127 @@ GEM thor (>= 0.19.4, < 2.0) tins (~> 1.6) crass (1.0.6) - devise (4.8.0) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise_token_auth (1.2.0) - bcrypt (~> 3.0) - devise (> 3.5.2, < 5) - rails (>= 4.2.0, < 6.2) - diff-lcs (1.4.4) + diff-lcs (1.5.0) + digest (3.1.0) docile (1.4.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) e2mmap (0.1.0) erubi (1.10.0) - factory_bot (6.2.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faker (2.18.0) - i18n (>= 1.6, < 2) - ffi (1.15.3) - globalid (0.5.2) + faker (2.21.0) + i18n (>= 1.8.11, < 2) + ffi (1.15.5) + globalid (1.0.0) activesupport (>= 5.0) http-accept (1.7.0) http-cookie (1.0.4) domain_name (~> 0.5) - i18n (1.8.10) + i18n (1.10.0) concurrent-ruby (~> 1.0) interactor (3.1.2) interactor-rails (2.2.1) interactor (~> 3.0) rails (>= 4.2) jaro_winkler (1.5.4) - json (2.5.1) + json (2.6.2) jsonapi-renderer (0.2.2) - kramdown (2.3.1) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.12.0) + listen (3.7.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.18.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) mailgun-ruby (1.2.5) rest-client (>= 2.0.2) - marcel (1.0.1) + marcel (1.0.2) method_source (1.0.0) - mime-types (3.3.1) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2021.0704) - mini_mime (1.1.0) - mini_portile2 (2.6.1) - minitest (5.14.4) - msgpack (1.4.2) + mime-types-data (3.2022.0105) + mini_mime (1.1.2) + minitest (5.15.0) + msgpack (1.5.1) + 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) nio4r (2.5.8) - nokogiri (1.12.3) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.6-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - parallel (1.20.1) - parser (3.0.2.0) + parallel (1.22.1) + parser (3.1.2.0) ast (~> 2.4.1) - pg (1.2.3) - puma (4.3.8) + pg (1.3.5) + puma (5.6.4) nio4r (~> 2.0) - racc (1.5.2) + racc (1.6.0) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) rack-test (1.1.0) rack (>= 1.0, < 3) railroady (1.6.0) - rails (6.0.4) - actioncable (= 6.0.4) - actionmailbox (= 6.0.4) - actionmailer (= 6.0.4) - actionpack (= 6.0.4) - actiontext (= 6.0.4) - actionview (= 6.0.4) - activejob (= 6.0.4) - activemodel (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) - bundler (>= 1.3.0) - railties (= 6.0.4) - sprockets-rails (>= 2.0.0) + rails (7.0.3) + actioncable (= 7.0.3) + actionmailbox (= 7.0.3) + actionmailer (= 7.0.3) + actionpack (= 7.0.3) + actiontext (= 7.0.3) + actionview (= 7.0.3) + activejob (= 7.0.3) + activemodel (= 7.0.3) + activerecord (= 7.0.3) + activestorage (= 7.0.3) + activesupport (= 7.0.3) + bundler (>= 1.15.0) + railties (= 7.0.3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (6.0.4) - actionpack (= 6.0.4) - activesupport (= 6.0.4) + railties (7.0.3) + actionpack (= 7.0.3) + activesupport (= 7.0.3) method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) - rainbow (3.0.0) + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rainbow (3.1.1) rake (13.0.6) - rb-fsevent (0.11.0) + rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.1.1) + regexp_parser (2.4.0) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) @@ -200,18 +226,18 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - reverse_markdown (2.0.0) + reverse_markdown (2.1.1) nokogiri rexml (3.2.5) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.11.0) + rspec-mocks (3.11.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-rails (5.0.2) + rspec-support (~> 3.11.0) + rspec-rails (5.1.2) actionpack (>= 5.2) activesupport (>= 5.2) railties (>= 5.2) @@ -219,35 +245,34 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.10.2) - rubocop (1.19.0) + rspec-support (3.11.0) + rubocop (1.29.1) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.9.1, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.10.0) - parser (>= 3.0.1.1) - rubocop-performance (1.11.4) + rubocop-ast (1.18.0) + parser (>= 3.1.1.0) + rubocop-performance (1.13.3) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.11.3) + rubocop-rails (2.14.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) ruby-progressbar (1.11.0) - ruby_dep (1.5.0) - shoulda-matchers (5.0.0) + shoulda-matchers (5.1.0) activesupport (>= 5.2.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - solargraph (0.43.0) + solargraph (0.44.3) backport (~> 1.2) benchmark bundler (>= 1.17.2) @@ -266,57 +291,52 @@ GEM spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.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) + strscan (3.0.3) sync (0.5.0) term-ansicolor (1.7.1) tins (~> 1.0) - thor (1.1.0) - thread_safe (0.3.6) + thor (1.2.1) tilt (2.0.10) - tins (1.29.1) + timeout (0.2.0) + tins (1.31.1) sync - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) - unicode-display_width (2.0.0) + unf_ext (0.0.8.1) + unicode-display_width (2.1.0) warden (1.2.9) rack (>= 2.0.9) + webrick (1.7.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - yard (0.9.26) - zeitwerk (2.4.2) + yard (0.9.27) + webrick (~> 1.7.0) + zeitwerk (2.5.4) PLATFORMS - ruby + x86_64-linux DEPENDENCIES active_model_serializers - bootsnap (>= 1.4.2) - byebug + bootsnap coveralls devise - devise_token_auth + devise_token_auth! factory_bot_rails faker interactor interactor-rails - listen (>= 3.0.5, < 3.2) + listen (~> 3.3) mailgun-ruby pg - puma (~> 4.1) + puma (~> 5.0) rack-cors railroady - rails (~> 6.0.3) + rails (~> 7.0.3) rspec-rails rubocop rubocop-performance @@ -329,7 +349,7 @@ DEPENDENCIES tzinfo-data RUBY VERSION - ruby 2.7.1p83 + ruby 2.7.5p203 BUNDLED WITH - 1.17.2 + 2.3.13 diff --git a/bin/rails b/bin/rails index 5badb2f..efc0377 100755 --- a/bin/rails +++ b/bin/rails @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index d87d5f5..4fbf10b 100755 --- a/bin/rake +++ b/bin/rake @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index a334d86..ec47b79 100755 --- a/bin/setup +++ b/bin/setup @@ -1,33 +1,33 @@ #!/usr/bin/env ruby -require 'fileutils' -include FileUtils +require "fileutils" # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +FileUtils.chdir APP_ROOT do + # 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. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" # end puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! "bin/rails db:prepare" 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 ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/config/application.rb b/config/application.rb index fad1661..ba2e151 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,6 +23,7 @@ module TurniereBackend class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 + config.autoloader = :zeitwerk # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers @@ -46,5 +47,8 @@ module TurniereBackend config.action_mailer.default_options = { from: 'noreply@turnie.re' } + + # Active Record + config.active_record.legacy_connection_handling = false end end diff --git a/config/boot.rb b/config/boot.rb index c04863f..988a5dd 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -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. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 7a4f47b..adc6568 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,8 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# 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 +] diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb new file mode 100644 index 0000000..a579326 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -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 `