From 49d5be2205dcedf8fd13b8172f3a27509eb45b1f Mon Sep 17 00:00:00 2001 From: Jesus Laiz Date: Tue, 9 Apr 2024 12:03:42 +0100 Subject: [PATCH 1/2] Update ruby and gems, remove unused code https://trello.com/c/zW0sJIvV Part of the legacy cleanup, but this service didn't really have any legacy code left, so I took the opportunity to update the ruby version as it was quite old, and some other general cleanup/maintenance. Disabled unused rails frameworks as this reduce potential attacks surface. Bump gems and removed no longer needed ones. --- .circleci/config.yml | 17 +- .gitignore | 4 - .ruby-version | 2 +- Dockerfile | 2 +- Gemfile | 6 +- Gemfile.lock | 227 +++++++----------- Guardfile | 71 ------ app/channels/application_cable/channel.rb | 4 - app/channels/application_cable/connection.rb | 4 - app/jobs/application_job.rb | 2 - app/mailers/application_mailer.rb | 4 - app/models/application_record.rb | 3 - app/services/adapters/file_cache_adapter.rb | 2 +- app/views/layouts/mailer.html.erb | 13 - app/views/layouts/mailer.text.erb | 1 - config/application.rb | 12 +- config/cable.yml | 10 - config/database.yml | 25 -- config/environments/development.rb | 6 +- config/environments/production.rb | 6 +- config/environments/test.rb | 6 +- config/storage.yml | 34 --- db/schema.rb | 14 -- db/seeds.rb | 7 - spec/rails_helper.rb | 22 +- .../adapters/file_cache_adapter_spec.rb | 4 +- 26 files changed, 127 insertions(+), 381 deletions(-) delete mode 100644 Guardfile delete mode 100644 app/channels/application_cable/channel.rb delete mode 100644 app/channels/application_cable/connection.rb delete mode 100644 app/jobs/application_job.rb delete mode 100644 app/mailers/application_mailer.rb delete mode 100644 app/models/application_record.rb delete mode 100644 app/views/layouts/mailer.html.erb delete mode 100644 app/views/layouts/mailer.text.erb delete mode 100644 config/cable.yml delete mode 100644 config/database.yml delete mode 100644 config/storage.yml delete mode 100644 db/schema.rb delete mode 100644 db/seeds.rb diff --git a/.circleci/config.yml b/.circleci/config.yml index 1caee27..c9dda4e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ orbs: jobs: login-to-aws: docker: &docker_image - - image: 'cimg/ruby:3.1.3-node' + - image: 'cimg/ruby:3.2.3-node' steps: - checkout - aws-cli/setup: @@ -26,7 +26,7 @@ jobs: test: working_directory: ~/circle docker: - - image: 'cimg/ruby:3.1.3' + - image: 'cimg/ruby:3.2.3' environment: RAILS_ENV: test steps: @@ -190,6 +190,7 @@ workflows: branches: only: - main + - legacy-cleanup - deploy_to_test_dev_eks: context: *moj-forms-context requires: @@ -203,18 +204,22 @@ workflows: requires: - deploy_to_test_dev_eks - deploy_to_test_production_eks - filters: - branches: - only: - - main - deploy_to_live_dev_eks: context: *moj-forms-context requires: - acceptance_tests + filters: + branches: + only: + - main - deploy_to_live_production_eks: context: *moj-forms-context requires: - acceptance_tests + filters: + branches: + only: + - main - smoke_tests: context: *moj-forms-context requires: diff --git a/.gitignore b/.gitignore index f380bea..6021033 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,6 @@ # Ignore bundler config. /.bundle -# Ignore the default SQLite database. -/db/*.sqlite3 -/db/*.sqlite3-journal - # Ignore all logfiles and tempfiles. /log/* /tmp/* diff --git a/.ruby-version b/.ruby-version index ff365e0..b347b11 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.3 +3.2.3 diff --git a/Dockerfile b/Dockerfile index 8059d66..ee249cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.1.3-alpine3.17 +FROM ruby:3.2.3-alpine3.19 RUN apk add build-base bash libcurl sqlite sqlite-dev sqlite-libs tzdata RUN apk add --no-cache gcompat diff --git a/Gemfile b/Gemfile index c50d324..84fc9ec 100644 --- a/Gemfile +++ b/Gemfile @@ -10,22 +10,18 @@ gem 'redis', '~> 5.0' gem 'sentry-rails', '~> 5.14' gem 'sentry-ruby', '~> 5.14' gem 'jwt' -gem 'sqlite3' group :development, :test do - gem 'dotenv-rails', require: 'dotenv/rails-now' + gem 'dotenv', require: 'dotenv/load' gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'rspec-rails', '>= 3.5.0' end group :development do gem 'listen' - gem 'guard-rspec', require: false end group :test do - gem 'factory_bot_rails', '~> 6.4' - gem 'shoulda-matchers', '~> 5.3' gem 'simplecov' gem 'simplecov-console', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 93f60ae..26c77d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,172 +1,143 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + actioncable (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + actionmailbox (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8) - actionpack (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activesupport (= 7.0.8) + actionmailer (7.0.8.1) + actionpack (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.8) - actionview (= 7.0.8) - activesupport (= 7.0.8) + actionpack (7.0.8.1) + actionview (= 7.0.8.1) + activesupport (= 7.0.8.1) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8) - actionpack (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + actiontext (7.0.8.1) + actionpack (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8) - activesupport (= 7.0.8) + actionview (7.0.8.1) + activesupport (= 7.0.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8) - activesupport (= 7.0.8) + activejob (7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.3.6) - activemodel (7.0.8) - activesupport (= 7.0.8) - activerecord (7.0.8) - activemodel (= 7.0.8) - activesupport (= 7.0.8) - activestorage (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activesupport (= 7.0.8) + activemodel (7.0.8.1) + activesupport (= 7.0.8.1) + activerecord (7.0.8.1) + activemodel (= 7.0.8.1) + activesupport (= 7.0.8.1) + activestorage (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activesupport (= 7.0.8.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.8) + activesupport (7.0.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) ansi (1.5.0) - bootsnap (1.17.1) + base64 (0.2.0) + bigdecimal (3.1.7) + bootsnap (1.18.3) msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - coderay (1.1.3) concurrent-ruby (1.2.3) connection_pool (2.4.1) crass (1.0.6) date (3.3.4) - diff-lcs (1.5.0) + diff-lcs (1.5.1) docile (1.4.0) - dotenv (2.8.1) - dotenv-rails (2.8.1) - dotenv (= 2.8.1) - railties (>= 3.2) + dotenv (3.1.0) erubi (1.12.0) - factory_bot (6.4.5) - activesupport (>= 5.0.0) - factory_bot_rails (6.4.3) - factory_bot (~> 6.4) - railties (>= 5.0.0) ffi (1.16.3) - formatador (1.1.0) globalid (1.2.1) activesupport (>= 6.1) - guard (2.18.1) - formatador (>= 0.2.4) - listen (>= 2.7, < 4.0) - lumberjack (>= 1.0.12, < 2.0) - nenv (~> 0.1) - notiffany (~> 0.0) - pry (>= 0.13.0) - shellany (~> 0.0) - thor (>= 0.18.1) - guard-compat (1.2.1) - guard-rspec (4.7.3) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) - i18n (1.14.1) + i18n (1.14.4) concurrent-ruby (~> 1.0) - jwt (2.7.1) - listen (3.8.0) + jwt (2.8.1) + base64 + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lumberjack (1.2.10) mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) method_source (1.0.0) mini_mime (1.1.5) mini_portile2 (2.8.5) - minitest (5.21.2) + minitest (5.22.3) msgpack (1.7.2) - nenv (0.3.0) - net-imap (0.4.9.1) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) - nokogiri (1.16.0) + nio4r (2.7.1) + nokogiri (1.16.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) - notiffany (0.1.3) - nenv (~> 0.1) - shellany (~> 0.0) - pry (0.14.2) - coderay (~> 1.1) - method_source (~> 1.0) puma (6.4.2) nio4r (~> 2.0) racc (1.7.3) - rack (2.2.8) + rack (2.2.9) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8) - actioncable (= 7.0.8) - actionmailbox (= 7.0.8) - actionmailer (= 7.0.8) - actionpack (= 7.0.8) - actiontext (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activemodel (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + rails (7.0.8.1) + actioncable (= 7.0.8.1) + actionmailbox (= 7.0.8.1) + actionmailer (= 7.0.8.1) + actionpack (= 7.0.8.1) + actiontext (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activemodel (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) bundler (>= 1.15.0) - railties (= 7.0.8) + railties (= 7.0.8.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -174,50 +145,44 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + railties (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) - rake (13.1.0) + rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - redis (5.0.8) + redis (5.1.0) redis-client (>= 0.17.0) - redis-client (0.19.1) + redis-client (0.21.1) connection_pool - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (6.1.0) + rspec-support (~> 3.13.0) + rspec-rails (6.1.2) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) - rspec-support (3.12.1) - sentry-rails (5.16.1) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.1) + sentry-rails (5.17.2) railties (>= 5.0) - sentry-ruby (~> 5.16.1) - sentry-ruby (5.16.1) + sentry-ruby (~> 5.17.2) + sentry-ruby (5.17.2) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - shellany (0.0.1) - shoulda-matchers (5.3.0) - activesupport (>= 5.2.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) @@ -228,11 +193,9 @@ GEM terminal-table simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sqlite3 (1.7.0) - mini_portile2 (~> 2.8.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.3.0) + thor (1.3.1) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -240,7 +203,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.12) + zeitwerk (2.6.13) PLATFORMS ruby @@ -248,9 +211,7 @@ PLATFORMS DEPENDENCIES bootsnap (>= 1.1.0) byebug - dotenv-rails - factory_bot_rails (~> 6.4) - guard-rspec + dotenv jwt listen puma (~> 6.4) @@ -259,14 +220,12 @@ DEPENDENCIES rspec-rails (>= 3.5.0) sentry-rails (~> 5.14) sentry-ruby (~> 5.14) - shoulda-matchers (~> 5.3) simplecov simplecov-console - sqlite3 tzinfo-data RUBY VERSION - ruby 3.1.3p185 + ruby 3.2.3p157 BUNDLED WITH - 2.4.6 + 2.4.19 diff --git a/Guardfile b/Guardfile deleted file mode 100644 index e62f0d2..0000000 --- a/Guardfile +++ /dev/null @@ -1,71 +0,0 @@ -# A sample Guardfile -# More info at https://github.com/guard/guard#readme - -## Uncomment and set this to only include directories you want to watch -# directories %w(app lib config test spec features) \ -# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")} - -## Note: if you are using the `directories` clause above and you are not -## watching the project directory ('.'), then you will want to move -## the Guardfile to a watched dir and symlink it back, e.g. -# -# $ mkdir config -# $ mv Guardfile config/ -# $ ln -s config/Guardfile . -# -# and, you'll have to watch "config/Guardfile" instead of "Guardfile" - -# Note: The cmd option is now required due to the increasing number of ways -# rspec may be run, below are examples of the most common uses. -# * bundler: 'bundle exec rspec' -# * bundler binstubs: 'bin/rspec' -# * spring: 'bin/rspec' (This will use spring if running and you have -# installed the spring binstubs per the docs) -# * zeus: 'zeus rspec' (requires the server to be started separately) -# * 'just' rspec: 'rspec' - -guard :rspec, cmd: "bundle exec rspec", all_on_start: true, - all_after_pass: true do - require "guard/rspec/dsl" - dsl = Guard::RSpec::Dsl.new(self) - - # Feel free to open issues for suggestions and improvements - - # RSpec files - rspec = dsl.rspec - watch(rspec.spec_helper) { rspec.spec_dir } - watch(rspec.spec_support) { rspec.spec_dir } - watch(rspec.spec_files) - - # Ruby files - ruby = dsl.ruby - dsl.watch_spec_files_for(ruby.lib_files) - - # Rails files - rails = dsl.rails(view_extensions: %w(erb haml slim)) - dsl.watch_spec_files_for(rails.app_files) - dsl.watch_spec_files_for(rails.views) - - watch(rails.controllers) do |m| - [ - rspec.spec.call("routing/#{m[1]}_routing"), - rspec.spec.call("controllers/#{m[1]}_controller"), - rspec.spec.call("acceptance/#{m[1]}") - ] - end - - # Rails config changes - watch(rails.spec_helper) { rspec.spec_dir } - watch(rails.routes) { "#{rspec.spec_dir}/routing" } - watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" } - - # Capybara features specs - watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") } - watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") } - - # Turnip features and steps - watch(%r{^spec/acceptance/(.+)\.feature$}) - watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m| - Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" - end -end diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb deleted file mode 100644 index d672697..0000000 --- a/app/channels/application_cable/channel.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Channel < ActionCable::Channel::Base - end -end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb deleted file mode 100644 index 0ff5442..0000000 --- a/app/channels/application_cable/connection.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Connection < ActionCable::Connection::Base - end -end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb deleted file mode 100644 index a009ace..0000000 --- a/app/jobs/application_job.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApplicationJob < ActiveJob::Base -end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb deleted file mode 100644 index 286b223..0000000 --- a/app/mailers/application_mailer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' - layout 'mailer' -end diff --git a/app/models/application_record.rb b/app/models/application_record.rb deleted file mode 100644 index 10a4cba..0000000 --- a/app/models/application_record.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationRecord < ActiveRecord::Base - self.abstract_class = true -end diff --git a/app/services/adapters/file_cache_adapter.rb b/app/services/adapters/file_cache_adapter.rb index a238e5a..aa375f0 100644 --- a/app/services/adapters/file_cache_adapter.rb +++ b/app/services/adapters/file_cache_adapter.rb @@ -14,7 +14,7 @@ def self.put(key, value) private def self.create_cache_dir_if_needed! - FileUtils.mkdir_p(cache_dir) unless Dir.exists?(cache_dir) + FileUtils.mkdir_p(cache_dir) unless Dir.exist?(cache_dir) end def self.file_path(key) diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb deleted file mode 100644 index cbd34d2..0000000 --- a/app/views/layouts/mailer.html.erb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - <%= yield %> - - diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb deleted file mode 100644 index 37f0bdd..0000000 --- a/app/views/layouts/mailer.text.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> diff --git a/config/application.rb b/config/application.rb index b2872ba..24e25ca 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,13 +2,13 @@ require "rails" require "active_model/railtie" -require "active_job/railtie" -require "active_record/railtie" -require "active_storage/engine" +# require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" require "action_controller/railtie" -require "action_mailer/railtie" -require "action_view/railtie" -require "action_cable/engine" +# require "action_mailer/railtie" +# require "action_view/railtie" +# require "action_cable/engine" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. diff --git a/config/cable.yml b/config/cable.yml deleted file mode 100644 index 0e6759d..0000000 --- a/config/cable.yml +++ /dev/null @@ -1,10 +0,0 @@ -development: - adapter: async - -test: - adapter: async - -production: - adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: fb-service-token-cache_production diff --git a/config/database.yml b/config/database.yml deleted file mode 100644 index 0d02f24..0000000 --- a/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# -default: &default - adapter: sqlite3 - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - timeout: 5000 - -development: - <<: *default - database: db/development.sqlite3 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - <<: *default - database: db/test.sqlite3 - -production: - <<: *default - database: db/production.sqlite3 diff --git a/config/environments/development.rb b/config/environments/development.rb index d083dc4..d24aafa 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -33,12 +33,12 @@ end # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local + # config.active_storage.service = :local # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false + # config.action_mailer.raise_delivery_errors = false - config.action_mailer.perform_caching = false + # config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/environments/production.rb b/config/environments/production.rb index 038d615..da112d6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -32,7 +32,7 @@ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local + # config.active_storage.service = :local # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil @@ -56,7 +56,7 @@ # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "fb_service_token_cache_production" - config.action_mailer.perform_caching = false + # config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -83,5 +83,5 @@ end # Do not dump schema after migrations. - config.active_record.dump_schema_after_migration = false + # config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index c56d731..55697bf 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -34,14 +34,14 @@ config.action_controller.allow_forgery_protection = false # Store uploaded files on the local file system in a temporary directory. - config.active_storage.service = :test + # config.active_storage.service = :test - config.action_mailer.perform_caching = false + # config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test + # config.action_mailer.delivery_method = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr diff --git a/config/storage.yml b/config/storage.yml deleted file mode 100644 index d32f76e..0000000 --- a/config/storage.yml +++ /dev/null @@ -1,34 +0,0 @@ -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> - -local: - service: Disk - root: <%= Rails.root.join("storage") %> - -# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) -# amazon: -# service: S3 -# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> -# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> -# region: us-east-1 -# bucket: your_own_bucket - -# Remember not to checkin your GCS keyfile to a repository -# google: -# service: GCS -# project: your_project -# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> -# bucket: your_own_bucket - -# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) -# microsoft: -# service: AzureStorage -# storage_account_name: your_account_name -# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> -# container: your_container_name - -# mirror: -# service: Mirror -# primary: local -# mirrors: [ amazon, google, microsoft ] diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index 6a1a60e..0000000 --- a/db/schema.rb +++ /dev/null @@ -1,14 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# This file is the source Rails uses to define your schema when running `bin/rails -# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to -# be faster and is potentially less error prone than running all of your -# migrations from scratch. Old migrations may fail to apply correctly if those -# migrations use external dependencies or application code. -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema[7.0].define(version: 2022_05_27_101240) do -end diff --git a/db/seeds.rb b/db/seeds.rb deleted file mode 100644 index 1beea2a..0000000 --- a/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). -# -# Examples: -# -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 553fabc..22e7510 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -7,16 +7,6 @@ require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! -# [...] -# configure shoulda matchers to use rspec as the test framework and full -# matcher libraries for rails -Shoulda::Matchers.configure do |config| - config.integrate do |with| - with.test_framework :rspec - with.library :rails - end -end - # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end @@ -32,22 +22,14 @@ # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f } -# Checks for pending migrations and applies them before tests are run. -# If you are not using ActiveRecord, you can remove these lines. -begin - ActiveRecord::Migration.maintain_test_schema! -rescue ActiveRecord::PendingMigrationError => e - puts e.to_s.strip - exit 1 -end RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + # config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. - config.use_transactional_fixtures = true + # config.use_transactional_fixtures = true # RSpec Rails can automatically mix in different behaviours to your tests # based on their file location, for example enabling you to call `get` and diff --git a/spec/services/adapters/file_cache_adapter_spec.rb b/spec/services/adapters/file_cache_adapter_spec.rb index ac0c756..baa9188 100644 --- a/spec/services/adapters/file_cache_adapter_spec.rb +++ b/spec/services/adapters/file_cache_adapter_spec.rb @@ -59,7 +59,7 @@ end context 'when the cache_dir exists' do before do - allow(Dir).to receive(:exists?).with(cache_dir).and_return(true) + allow(Dir).to receive(:exist?).with(cache_dir).and_return(true) end it 'does not create it' do expect(FileUtils).to_not receive(:mkdir_p).with(cache_dir) @@ -68,7 +68,7 @@ end context 'when the cache_dir does not exist' do before do - allow(Dir).to receive(:exists?).with(cache_dir).and_return(false) + allow(Dir).to receive(:exist?).with(cache_dir).and_return(false) end it 'does create it' do expect(FileUtils).to receive(:mkdir_p).with(cache_dir) From 83ea951d96d2d12cadb27298cd0670577e4af74c Mon Sep 17 00:00:00 2001 From: Jesus Laiz Date: Tue, 9 Apr 2024 12:16:55 +0100 Subject: [PATCH 2/2] Prepare for release to live --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9dda4e..bd83bf0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -190,7 +190,6 @@ workflows: branches: only: - main - - legacy-cleanup - deploy_to_test_dev_eks: context: *moj-forms-context requires: