diff --git a/.gitattributes b/.gitattributes index 5168571..31eeee0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,8 +3,5 @@ # Mark the database schema as having been generated. db/schema.rb linguist-generated -# Mark the yarn lockfile as having been generated. -yarn.lock linguist-generated - # Mark any vendored files as having been vendored. vendor/* linguist-vendored diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 171e535..0d7790f 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -47,14 +47,6 @@ jobs: bundle exec rails db:create bundle exec rails db:schema:load - - name: Set up node - uses: actions/setup-node@v3 - with: - node-version: 16.20.0 - - - name: Install yarn dependencies and precompile assets - run: bundle exec rails assets:precompile - - name: RSpec tests run: bundle exec rspec --color @@ -86,8 +78,5 @@ jobs: - name: StandardRB run: bundle exec standardrb --format simple - - name: Install yarn dependencies - run: yarn install --frozen-lockfile - - - name: Yarn audit - run: yarn run improved-yarn-audit --ignore-dev-deps + - name: JavaScript Audit + run: bin/importmap audit diff --git a/.gitignore b/.gitignore index 9606af5..f293bf8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,11 @@ # Ignore uploaded files in development. /storage/* !/storage/.keep +/tmp/storage/* +!/tmp/storage/ +!/tmp/storage/.keep /public/assets -.byebug_history # Ignore master key for decrypting credentials and more. /config/master.key @@ -29,10 +31,3 @@ /.idea /.env.* /coverage - -/public/packs -/public/packs-test -/node_modules -/yarn-error.log -yarn-debug.log* -.yarn-integrity diff --git a/.iyarc b/.iyarc deleted file mode 100644 index 114cbd1..0000000 --- a/.iyarc +++ /dev/null @@ -1,10 +0,0 @@ -# No dependency path exists to fix this vulnerability currently - -# glob-parent -GHSA-ww39-953v-wcq6 - -# nth-check -GHSA-rp65-9cf3-cjxr - -# semver -GHSA-c2qf-rxjj-qqgw diff --git a/Dockerfile b/Dockerfile index d61f90b..f5cb7d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ WORKDIR /home/webapp/app RUN apk upgrade --no-cache # Install rails/app dependencies -RUN apk --no-cache add libc6-compat git postgresql-libs tzdata nodejs=~16.20 yarn +RUN apk --no-cache add libc6-compat git postgresql-libs tzdata # Copy dependency definitions and lock files COPY Gemfile Gemfile.lock ./ diff --git a/Gemfile b/Gemfile index 817fa92..a523d52 100644 --- a/Gemfile +++ b/Gemfile @@ -7,63 +7,76 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.0.6" -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem "rails", "~> 6.1.3" +# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" +gem "rails", "~> 7.0.7" + +# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] +gem "sprockets-rails" + # Use sqlite3 as the database for Active Record -# gem 'sqlite3', '~> 1.4' -# Use Puma as the app server -gem "puma", "~> 5.6" -# Use SCSS for stylesheets -gem "sass-rails", ">= 6" -# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker -gem "webpacker", "~> 5.0" -# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks -# gem 'turbolinks', '~> 5' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem "jbuilder", "~> 2.7" +# gem "sqlite3", "~> 1.4" + +# Use the Puma web server [https://github.com/puma/puma] +gem "puma", "~> 5.0" + +# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] +gem "importmap-rails" + +# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] +gem "turbo-rails" + +# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] +gem "stimulus-rails" + +# Build JSON APIs with ease [https://github.com/rails/jbuilder] +gem "jbuilder" + # Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 4.0' -# Use Active Model has_secure_password -# gem 'bcrypt', '~> 3.1.7' +# gem "redis", "~> 4.0" + +# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] +# gem "kredis" -# Use Active Storage variant -# gem 'image_processing', '~> 1.2' +# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] +# gem "bcrypt", "~> 3.1.7" + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby] # Reduces boot times through caching; required in config/boot.rb -gem "bootsnap", ">= 1.4.4", require: false +gem "bootsnap", require: false + +# Use Sass to process CSS +gem "sassc-rails" + +# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] +# gem "image_processing", "~> 1.2" group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem "byebug", platforms: [:mri, :mingw, :x64_mingw] + # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem + gem "debug", platforms: %i[mri mingw x64_mingw] end group :development do - # Access an interactive console on exception pages or by calling 'console' anywhere in the code. - gem "web-console", ">= 4.1.0" - # Display performance information such as SQL time and flame graphs for each request in your browser. - # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md - gem "rack-mini-profiler", "~> 2.0" - gem "listen", "~> 3.3" - # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem "spring" - gem "spring-watcher-listen", "~> 2.0.0" + # Use console on exceptions pages [https://github.com/rails/web-console] + gem "web-console" + + # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] + # gem "rack-mini-profiler" + + # Speed up commands on slow machines / big apps [https://github.com/rails/spring] + # gem "spring" end group :test do - # Adds support for Capybara system testing and selenium driver - gem "capybara", ">= 3.26" + # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] + gem "capybara" gem "selenium-webdriver" - # Easy installation and use of web drivers to run system tests with browsers - gem "webdrivers" - gem "simplecov-cobertura" # Codecov, CI only + # gem "webdrivers" end -# Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] - gem "pg" -gem "active_admin_flat_skin" gem "activeadmin" gem "activeadmin_addons" gem "adobe-campaign", "~> 0.2" @@ -83,12 +96,14 @@ gem "omniauth-oktaoauth", github: "CruGlobal/omniauth-oktaoauth" gem "omniauth-rails_csrf_protection" gem "ougai", "~> 1.7" gem "rack-cors" +gem "redis", "< 5.0" gem "redis-actionpack" gem "rollbar" +gem "sidekiq", "~> 6.5.10" gem "sidekiq-failures" gem "sidekiq-unique-jobs" gem "standardrb" -gem "strip_attributes", "~> 1.11.0" +gem "strip_attributes", "~> 1.11" group :development, :test do gem "database_cleaner-active_record" diff --git a/Gemfile.lock b/Gemfile.lock index 413b68a..efd0d33 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,83 +15,89 @@ GEM GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) + actioncable (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + actionmailbox (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (>= 2.7.1) - actionmailer (6.1.7.6) - actionpack (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activesupport (= 6.1.7.6) + net-imap + net-pop + net-smtp + actionmailer (7.0.7.2) + actionpack (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.7.6) - actionview (= 6.1.7.6) - activesupport (= 6.1.7.6) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.7.2) + actionview (= 7.0.7.2) + activesupport (= 7.0.7.2) + 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 (6.1.7.6) - actionpack (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + actiontext (7.0.7.2) + actionpack (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.6) - activesupport (= 6.1.7.6) + actionview (7.0.7.2) + activesupport (= 7.0.7.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_admin_flat_skin (0.1.2) active_material (1.5.2) - activeadmin (2.9.0) + activeadmin (3.1.0) arbre (~> 1.2, >= 1.2.1) - formtastic (>= 3.1, < 5.0) - formtastic_i18n (~> 0.4) + formtastic (>= 3.1) + formtastic_i18n (>= 0.4) inherited_resources (~> 1.7) - jquery-rails (~> 4.2) - kaminari (~> 1.0, >= 1.2.1) - railties (>= 5.2, < 6.2) - ransack (~> 2.1, >= 2.1.1) - activeadmin_addons (1.7.1) + jquery-rails (>= 4.2) + kaminari (>= 1.2.1) + railties (>= 6.1) + ransack (>= 4.0) + activeadmin_addons (1.10.1) active_material railties - require_all (~> 1.5) - sass - select2-rails (~> 4.0) + redcarpet + require_all + sassc + sassc-rails xdan-datetimepicker-rails (~> 2.5.1) - activejob (6.1.7.6) - activesupport (= 6.1.7.6) + activejob (7.0.7.2) + activesupport (= 7.0.7.2) globalid (>= 0.3.6) - activemodel (6.1.7.6) - activesupport (= 6.1.7.6) - activerecord (6.1.7.6) - activemodel (= 6.1.7.6) - activesupport (= 6.1.7.6) - activestorage (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activesupport (= 6.1.7.6) + activemodel (7.0.7.2) + activesupport (= 7.0.7.2) + activerecord (7.0.7.2) + activemodel (= 7.0.7.2) + activesupport (= 7.0.7.2) + activestorage (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activesupport (= 7.0.7.2) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.6) + activesupport (7.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) adobe-campaign (0.3.2) @@ -99,12 +105,13 @@ GEM jwt (~> 1.0) rails (>= 3.1) rest-client (>= 1.6.0) - arbre (1.4.0) - activesupport (>= 3.0.0, < 6.2) - ruby2_keywords (>= 0.0.2, < 1.0) + arbre (1.7.0) + activesupport (>= 3.0.0) + ruby2_keywords (>= 0.0.2) ast (2.4.2) awesome_print (1.9.2) - bcrypt (3.1.18) + base64 (0.2.0) + bcrypt (3.1.20) bindex (0.8.1) bootsnap (1.13.0) msgpack (~> 1.2) @@ -119,18 +126,18 @@ GEM bundler (>= 1.2.0, < 3) thor (~> 1.0) byebug (9.1.0) - capybara (3.35.3) + capybara (3.39.2) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - childprocess (3.0.0) coderay (1.1.2) concurrent-ruby (1.2.2) - connection_pool (2.2.5) + connection_pool (2.4.1) countries (3.0.1) i18n_data (~> 0.10.0) sixarm_ruby_unaccent (~> 1.1) @@ -149,14 +156,16 @@ GEM libddwaf (~> 1.3.0.2.0) msgpack debase-ruby_core_source (0.10.16) - devise (4.8.1) + debug (1.8.0) + irb (>= 1.5.0) + reline (>= 0.3.1) + devise (4.9.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) diff-lcs (1.4.4) - docile (1.4.0) dogstatsd-ruby (5.5.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) @@ -172,15 +181,16 @@ GEM railties (>= 3.0.0) faker (2.23.0) i18n (>= 1.8.11, < 2) - faraday (2.6.0) + faraday (2.7.12) + base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.1) - ffi (1.15.1) - font-awesome-rails (4.7.0.7) - railties (>= 3.2, < 7) - formtastic (4.0.0) - actionpack (>= 5.2.0) + faraday-net_http (3.0.2) + ffi (1.15.5) + font-awesome-rails (4.7.0.8) + railties (>= 3.2, < 8.0) + formtastic (5.0.0) + actionpack (>= 6.0.0) formtastic_i18n (0.7.0) global_registry (1.5.1) activesupport @@ -191,7 +201,7 @@ GEM retryable-rb (~> 1.1) globalid (1.2.1) activesupport (>= 6.1) - has_scope (0.8.0) + has_scope (0.8.2) actionpack (>= 5.2) activesupport (>= 5.2) hashdiff (0.3.7) @@ -202,42 +212,45 @@ GEM i18n (1.14.1) concurrent-ruby (~> 1.0) i18n_data (0.10.0) - inherited_resources (1.13.0) - actionpack (>= 5.2, < 6.2) - has_scope (~> 0.6) - railties (>= 5.2, < 6.2) - responders (>= 2, < 4) + importmap-rails (1.2.1) + actionpack (>= 6.0.0) + railties (>= 6.0.0) + inherited_resources (1.14.0) + actionpack (>= 6.0) + has_scope (>= 0.6) + railties (>= 6.0) + responders (>= 2) + io-console (0.6.0) + irb (1.7.4) + reline (>= 0.3.6) jbuilder (2.10.0) activesupport (>= 5.0.0) - jquery-rails (4.4.0) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jwt (1.5.6) - kaminari (1.2.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) libdatadog (0.7.0.1.1) libddwaf (1.3.0.2.0) ffi (~> 1.0) - listen (3.5.1) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) lograge (0.11.1) actionpack (>= 4) activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -246,12 +259,13 @@ GEM net-pop net-smtp marcel (1.0.2) + matrix (0.4.2) method_source (0.9.2) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2019.1009) mini_mime (1.1.5) - mini_portile2 (2.8.4) + mini_portile2 (2.8.5) minitest (5.20.0) msgpack (1.5.6) multi_xml (0.6.0) @@ -266,7 +280,7 @@ GEM net-protocol netrc (0.11.0) nio4r (2.5.9) - nokogiri (1.15.4) + nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth2 (2.0.9) @@ -278,15 +292,16 @@ GEM version_gem (~> 1.1) oj (3.7.12) oj_mimic_json (1.0.1) - omniauth (1.9.2) + omniauth (2.1.1) hashie (>= 3.4.6) - rack (>= 1.6.2, < 3) - omniauth-oauth2 (1.7.3) + rack (>= 2.2.3) + rack-protection + omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) - omniauth (>= 1.9, < 3) - omniauth-rails_csrf_protection (0.1.2) + omniauth (~> 2.0) + omniauth-rails_csrf_protection (1.0.1) actionpack (>= 4.2) - omniauth (>= 1.3.1) + omniauth (~> 2.0) orm_adapter (0.5.0) ougai (1.7.1) oj (~> 3.4) @@ -303,31 +318,28 @@ GEM public_suffix (4.0.6) puma (5.6.7) nio4r (~> 2.0) - racc (1.7.1) + racc (1.7.3) rack (2.2.8) rack-cors (1.1.1) rack (>= 2.0.0) - rack-mini-profiler (2.3.2) - rack (>= 1.2.0) - rack-proxy (0.6.5) - rack + rack-protection (3.1.0) + rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.6) - actioncable (= 6.1.7.6) - actionmailbox (= 6.1.7.6) - actionmailer (= 6.1.7.6) - actionpack (= 6.1.7.6) - actiontext (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activemodel (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + rails (7.0.7.2) + actioncable (= 7.0.7.2) + actionmailbox (= 7.0.7.2) + actionmailer (= 7.0.7.2) + actionpack (= 7.0.7.2) + actiontext (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activemodel (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) bundler (>= 1.15.0) - railties (= 6.1.7.6) - sprockets-rails (>= 2.0.0) + railties (= 7.0.7.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -335,45 +347,46 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) + railties (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.0.0) - rake (13.0.6) - ransack (2.4.2) - activerecord (>= 5.2.4) - activesupport (>= 5.2.4) + rake (13.1.0) + ransack (4.1.1) + activerecord (>= 6.1.5) + activesupport (>= 6.1.5) i18n - rb-fsevent (0.11.0) - rb-inotify (0.10.1) - ffi (~> 1.0) - redis (4.7.1) - redis-actionpack (5.2.0) - actionpack (>= 5, < 7) + redcarpet (3.6.0) + redis (4.8.1) + redis-actionpack (5.3.0) + actionpack (>= 5, < 8) redis-rack (>= 2.1.0, < 3) redis-store (>= 1.1.0, < 2) - redis-rack (2.1.2) + redis-rack (2.1.4) rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) - redis-store (1.9.0) - redis (>= 4, < 5) + redis-store (1.9.2) + redis (>= 4, < 6) regexp_parser (2.1.1) + reline (0.3.8) + io-console (~> 0.5) request_store (1.4.1) rack (>= 1.4) - require_all (1.5.0) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + require_all (3.0.0) + responders (3.1.1) + actionpack (>= 5.2) + railties (>= 5.2) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) retryable-rb (1.1.0) - rexml (3.2.5) + rexml (3.2.6) rollbar (3.4.0) rspec-core (3.10.1) rspec-support (~> 3.10.0) @@ -408,15 +421,8 @@ GEM rubocop-ast (>= 0.4.0) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) - rubyzip (2.3.0) + rubyzip (2.3.2) safe_yaml (1.0.4) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (6.0.0) - sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) @@ -425,15 +431,14 @@ GEM sprockets (> 3.0) sprockets-rails tilt - select2-rails (4.0.13) - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) - semantic_range (3.0.0) - sidekiq (6.5.1) - connection_pool (>= 2.2.2) + selenium-webdriver (4.11.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) + sidekiq (6.5.12) + connection_pool (>= 2.2.5, < 3) rack (~> 2.0) - redis (>= 4.2.0) + redis (>= 4.5.0, < 5) sidekiq-failures (1.0.1) sidekiq (>= 4.0.0) sidekiq-unique-jobs (7.1.25) @@ -441,24 +446,10 @@ GEM concurrent-ruby (~> 1.0, >= 1.0.5) sidekiq (>= 5.0, < 8.0) thor (>= 0.20, < 3.0) - simplecov (0.22.0) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov_json_formatter (~> 0.1) - simplecov-cobertura (2.1.0) - rexml - simplecov (~> 0.19) - simplecov-html (0.12.3) - simplecov_json_formatter (0.1.4) sixarm_ruby_unaccent (1.2.0) snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) - spring (2.0.2) - activesupport (>= 4.2) - spring-watcher-listen (2.0.1) - listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -471,11 +462,17 @@ GEM rubocop-performance (= 1.11.4) standardrb (1.0.0) standard - strip_attributes (1.11.0) - activemodel (>= 3.0, < 7.0) - thor (1.2.2) - tilt (2.0.10) + stimulus-rails (1.2.2) + railties (>= 6.0.0) + strip_attributes (1.13.0) + activemodel (>= 3.0, < 8.0) + thor (1.3.0) + tilt (2.2.0) timeout (0.4.0) + turbo-rails (1.4.0) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unf (0.1.4) @@ -484,7 +481,7 @@ GEM unicode-display_width (2.0.0) unicode_utils (1.4.0) uri (0.10.3) - version_gem (1.1.1) + version_gem (1.1.3) warden (1.2.9) rack (>= 2.0.9) web-console (4.1.0) @@ -492,19 +489,11 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (4.3.0) - nokogiri (~> 1.6) - rubyzip (>= 1.3.0) - selenium-webdriver (>= 3.0, < 4.0) webmock (3.4.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - webpacker (5.4.0) - activesupport (>= 5.2) - rack-proxy (>= 0.6.1) - railties (>= 5.2) - semantic_range (>= 2.3.0) + websocket (1.2.9) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -513,25 +502,24 @@ GEM rails (>= 3.2.16) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.11) + zeitwerk (2.6.12) PLATFORMS ruby DEPENDENCIES - active_admin_flat_skin activeadmin activeadmin_addons adobe-campaign (~> 0.2) awesome_print - bootsnap (>= 1.4.4) + bootsnap brakeman bundle-audit - byebug - capybara (>= 3.26) + capybara countries database_cleaner-active_record ddtrace (~> 1.4) + debug devise dogstatsd-ruby (~> 5.3) dotenv-rails @@ -539,8 +527,8 @@ DEPENDENCIES faker font-awesome-rails global_registry (~> 1.5) - jbuilder (~> 2.7) - listen (~> 3.3) + importmap-rails + jbuilder lograge loofah (>= 2.2.3) nokogiri (>= 1.8.5) @@ -549,29 +537,28 @@ DEPENDENCIES ougai (~> 1.7) pg pry-byebug - puma (~> 5.6) + puma (~> 5.0) rack-cors - rack-mini-profiler (~> 2.0) - rails (~> 6.1.3) + rails (~> 7.0.7) + redis (< 5.0) redis-actionpack rollbar rspec-rails - sass-rails (>= 6) + sassc-rails selenium-webdriver + sidekiq (~> 6.5.10) sidekiq-failures sidekiq-pro! sidekiq-unique-jobs - simplecov-cobertura - spring - spring-watcher-listen (~> 2.0.0) + sprockets-rails standardrb - strip_attributes (~> 1.11.0) + stimulus-rails + strip_attributes (~> 1.11) + turbo-rails tzinfo-data uri (~> 0.10.3) - web-console (>= 4.1.0) - webdrivers + web-console webmock - webpacker (~> 5.0) RUBY VERSION ruby 3.0.6p216 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 48e139d..957b4d3 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1 +1,3 @@ -//= link_directory ../javascripts .js +//= link_directory ../stylesheets .scss +//= link_tree ../../javascript .js +//= link_tree ../../../vendor/javascript .js diff --git a/app/assets/javascripts/active_admin.js b/app/assets/javascripts/active_admin.js deleted file mode 120000 index f2facb1..0000000 --- a/app/assets/javascripts/active_admin.js +++ /dev/null @@ -1 +0,0 @@ -../../javascript/active_admin_custom.js \ No newline at end of file diff --git a/app/assets/stylesheets/active_admin.scss b/app/assets/stylesheets/active_admin.scss index 611a25c..9d24842 100644 --- a/app/assets/stylesheets/active_admin.scss +++ b/app/assets/stylesheets/active_admin.scss @@ -12,7 +12,6 @@ $am-theme-primary: #342e48; @import 'activeadmin_addons/all'; @import "active_admin/mixins"; @import "active_admin/base"; -@import "active_admin_flat_skin"; @import "font-awesome"; // Overriding any non-variable SASS must be done after the fact. diff --git a/app/assets/stylesheets/print.scss b/app/assets/stylesheets/print.scss new file mode 100644 index 0000000..c99326d --- /dev/null +++ b/app/assets/stylesheets/print.scss @@ -0,0 +1,2 @@ +/* Active Admin Print Stylesheet */ +@import "print"; diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 0000000..6d1e000 --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,9 @@ +import 'jquery' +import 'jquery-ui' +import 'jquery-ujs' +import 'jquery-form' +import 'jquery-validation' +import '@activeadmin/activeadmin' + +import './custom/active_admin_custom' +import './custom/campaign-form' diff --git a/app/javascript/active_admin_custom.js b/app/javascript/custom/active_admin_custom.js similarity index 95% rename from app/javascript/active_admin_custom.js rename to app/javascript/custom/active_admin_custom.js index 7695466..479b6d1 100644 --- a/app/javascript/active_admin_custom.js +++ b/app/javascript/custom/active_admin_custom.js @@ -5,7 +5,6 @@ */ //= require active_admin/base //= require activeadmin_addons/all -//= require active_admin_flat_skin $(document).on('change', '.form_form_fields_select', function() { var options = $(this).parents('ol:first').find('.has_many_container.campaign_options'); @@ -21,4 +20,4 @@ $(document).on('ready page:load', function() { return $($(this).data('toggle')).toggle($(this).prop('checked')); }); return $('[data-field-type="campaign"]:selected').parents('ol:first').find('.has_many_container.campaign_options').show(); -}); \ No newline at end of file +}); diff --git a/app/javascript/campaign-form.js b/app/javascript/custom/campaign-form.js similarity index 100% rename from app/javascript/campaign-form.js rename to app/javascript/custom/campaign-form.js diff --git a/app/javascript/packs/active_admin.js b/app/javascript/packs/active_admin.js deleted file mode 100644 index d4c4a65..0000000 --- a/app/javascript/packs/active_admin.js +++ /dev/null @@ -1,6 +0,0 @@ -// Load Active Admin's styles into Webpacker, -// see `active_admin.scss` for customization. -import "../stylesheets/active_admin"; - -import "@activeadmin/activeadmin"; -require("active_admin_custom") diff --git a/app/javascript/packs/active_admin/print.scss b/app/javascript/packs/active_admin/print.scss deleted file mode 100644 index 79ac036..0000000 --- a/app/javascript/packs/active_admin/print.scss +++ /dev/null @@ -1,2 +0,0 @@ -/* Active Admin Print Stylesheet */ -@import "~@activeadmin/activeadmin/src/scss/print"; diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js deleted file mode 100644 index 6cfa414..0000000 --- a/app/javascript/packs/application.js +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically compiled by Webpack, along with any other files -// present in this directory. You're encouraged to place your actual application logic in -// a relevant structure within app/javascript and only use these pack files to reference -// that code so it'll be compiled. - -import Rails from "@rails/ujs" - -Rails.start() diff --git a/app/javascript/packs/campaign.js b/app/javascript/packs/campaign.js deleted file mode 100644 index a1c81d7..0000000 --- a/app/javascript/packs/campaign.js +++ /dev/null @@ -1,4 +0,0 @@ -require("jquery") -require("jquery-form") -require("jquery-validation") -require("campaign-form") diff --git a/app/javascript/stylesheets/active_admin.scss b/app/javascript/stylesheets/active_admin.scss deleted file mode 100644 index d1c7b3b..0000000 --- a/app/javascript/stylesheets/active_admin.scss +++ /dev/null @@ -1,17 +0,0 @@ -// SASS variable overrides must be declared before loading up Active Admin's styles. -// -// To view the variables that Active Admin provides, take a look at -// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the -// Active Admin source. -// -// For example, to change the sidebar width: -// $sidebar-width: 242px; - -// Active Admin's got SASS! -@import "~@activeadmin/activeadmin/src/scss/mixins"; -@import "~@activeadmin/activeadmin/src/scss/base"; - -// Overriding any non-variable SASS must be done after the fact. -// For example, to change the default status-tag color: -// -// .status_tag { background: #6090DB; } diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 71fbba5..08dc537 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base - self.abstract_class = true + primary_abstract_class end diff --git a/app/views/admin/forms/_form.html.erb b/app/views/admin/forms/_form.html.erb index 84517d9..60032e3 100644 --- a/app/views/admin/forms/_form.html.erb +++ b/app/views/admin/forms/_form.html.erb @@ -33,5 +33,4 @@ Terms of Service apply. -<%= javascript_pack_tag 'campaign' %> <% if form.use_recaptcha %><% end %> diff --git a/app/views/login/new.html.erb b/app/views/login/new.html.erb index a21e4ff..772ff57 100644 --- a/app/views/login/new.html.erb +++ b/app/views/login/new.html.erb @@ -1,7 +1,6 @@ - <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index 12f98da..0000000 --- a/babel.config.js +++ /dev/null @@ -1,72 +0,0 @@ -module.exports = function(api) { - var validEnv = ['development', 'test', 'production'] - var currentEnv = api.env() - var isDevelopmentEnv = api.env('development') - var isProductionEnv = api.env('production') - var isTestEnv = api.env('test') - - if (!validEnv.includes(currentEnv)) { - throw new Error( - 'Please specify a valid `NODE_ENV` or ' + - '`BABEL_ENV` environment variables. Valid values are "development", ' + - '"test", and "production". Instead, received: ' + - JSON.stringify(currentEnv) + - '.' - ) - } - - return { - presets: [ - isTestEnv && [ - '@babel/preset-env', - { - targets: { - node: 'current' - } - } - ], - (isProductionEnv || isDevelopmentEnv) && [ - '@babel/preset-env', - { - forceAllTransforms: true, - useBuiltIns: 'entry', - corejs: 3, - modules: false, - exclude: ['transform-typeof-symbol'] - } - ] - ].filter(Boolean), - plugins: [ - 'babel-plugin-macros', - '@babel/plugin-syntax-dynamic-import', - isTestEnv && 'babel-plugin-dynamic-import-node', - '@babel/plugin-transform-destructuring', - [ - '@babel/plugin-proposal-class-properties', - { - loose: true - } - ], - [ - '@babel/plugin-proposal-object-rest-spread', - { - useBuiltIns: true - } - ], - [ - '@babel/plugin-transform-runtime', - { - helpers: false, - regenerator: true, - corejs: false - } - ], - [ - '@babel/plugin-transform-regenerator', - { - async: false - } - ] - ].filter(Boolean) - } -} diff --git a/bin/importmap b/bin/importmap new file mode 100755 index 0000000..36502ab --- /dev/null +++ b/bin/importmap @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby + +require_relative "../config/application" +require "importmap/commands" diff --git a/bin/rails b/bin/rails index 21d3e02..efc0377 100755 --- a/bin/rails +++ b/bin/rails @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) -APP_PATH = File.expand_path('../config/application', __dir__) +APP_PATH = File.expand_path("../config/application", __dir__) require_relative "../config/boot" require "rails/commands" diff --git a/bin/rake b/bin/rake index 7327f47..4fbf10b 100755 --- a/bin/rake +++ b/bin/rake @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) require_relative "../config/boot" require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index 90700ac..ec47b79 100755 --- a/bin/setup +++ b/bin/setup @@ -2,7 +2,7 @@ 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 ==") @@ -13,24 +13,21 @@ FileUtils.chdir APP_ROOT do # 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') - - # Install JavaScript dependencies - system! 'bin/yarn' + 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') - # FileUtils.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:prepare' + 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 ef2b52a..361ff03 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,7 +22,7 @@ module CampaignForms class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.1 + config.load_defaults 7.0 # Configuration for the application, engines, and railties goes here. # diff --git a/config/environments/development.rb b/config/environments/development.rb index 9557b17..fb64abc 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -14,9 +14,12 @@ # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join("tmp", "caching-dev.txt").exist? + if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true @@ -43,16 +46,11 @@ config.active_support.disallowed_deprecation_warnings = [] # Raise an error on page load if there are pending migrations. - # config.active_record.migration_error = :page_load + config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = false - # Suppress logger output for asset requests. config.assets.quiet = true @@ -62,10 +60,6 @@ # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - config.file_watcher = ActiveSupport::EventedFileUpdateChecker - # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 916a31c..b43c6e9 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -31,19 +31,19 @@ config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.asset_host = 'http://assets.example.com' + # config.asset_host = "http://assets.example.com" # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # 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 # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil - # config.action_cable.url = 'wss://example.com/cable' - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # config.action_cable.url = "wss://example.com/cable" + # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. if ENV["AWS_EXECUTION_ENV"].present? @@ -79,21 +79,15 @@ # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Log disallowed deprecations. - config.active_support.disallowed_deprecation = :log - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] + # Don't log any deprecations. + config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. # config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new($stdout) @@ -104,26 +98,5 @@ # Do not dump schema after migrations. # config.active_record.dump_schema_after_migration = false - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session - config.action_controller.asset_host = ENV.fetch("SITE_URL") end diff --git a/config/environments/test.rb b/config/environments/test.rb index 91b8f1e..f443039 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -8,13 +8,13 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.cache_classes = false - config.action_view.cache_template_loading = true + # Turn false under Spring and add config.action_view.cache_template_loading = true. + config.cache_classes = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true diff --git a/config/importmap.rb b/config/importmap.rb new file mode 100644 index 0000000..bf3b4a7 --- /dev/null +++ b/config/importmap.rb @@ -0,0 +1,12 @@ +# Pin npm packages by running ./bin/importmap + +# The entrypoint +pin "application", preload: true + +# ActiveAdmin and dependencies +pin "@activeadmin/activeadmin", to: "https://cdn.jsdelivr.net/npm/@activeadmin/activeadmin@2.13.1/app/assets/javascripts/active_admin/base.min.js" +pin "jquery", to: "https://ga.jspm.io/npm:jquery@3.7.0/dist/jquery.js" +pin "jquery-ui", to: "https://cdn.jsdelivr.net/npm/jquery-ui@1.13.2/dist/jquery-ui.min.js" +pin "jquery-ujs", to: "https://cdn.jsdelivr.net/npm/jquery-ujs@1.2.3/src/rails.min.js" +pin "jquery-validation", to: "https://ga.jspm.io/npm:jquery-validation@1.19.5/dist/jquery.validate.js" +pin "jquery-form", to: "https://ga.jspm.io/npm:jquery-form@4.3.0/dist/jquery.form.min.js" diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index 171b962..9788e66 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -294,4 +294,23 @@ # You can inherit it with own class and inject it for all resources # # config.order_clause = MyOrderClause + + # clear previous asset for javascript to make the asset pipeline + # happy + config.clear_javascripts! +end + +# https://medium.com/@henrikbjorn/til-using-activeadmin-with-importmap-rails-289cde6f76b8 +module ActiveAdmin + module Views + module Head + def build_active_admin_head + within super do + text_node javascript_importmap_tags("application") + end + end + end + end end + +ActiveAdmin::Views::Pages::Base.send :prepend, ActiveAdmin::Views::Head diff --git a/config/initializers/activeadmin_addons.rb b/config/initializers/activeadmin_addons.rb index c332ffc..1fdef71 100644 --- a/config/initializers/activeadmin_addons.rb +++ b/config/initializers/activeadmin_addons.rb @@ -1,11 +1,9 @@ -# frozen_string_literal: true - ActiveadminAddons.setup do |config| # Change to "default" if you want to use ActiveAdmin's default select control. config.default_select = "default" # Set default options for DateTimePickerInput. The options you can provide are the same as in - # xdan's datetimepicker library (https://github.com/xdan/datetimepicker/tree/2.5.4). Yo need to + # xdan's datetimepicker library (https://github.com/xdan/datetimepicker/tree/2.5.4). You need to # pass a ruby hash, avoid camelCase keys. For example: use min_date instead of minDate key. # config.datetime_picker_default_options = {} diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb deleted file mode 100644 index 89d2efa..0000000 --- a/config/initializers/application_controller_renderer.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# ActiveSupport::Reloader.to_prepare do -# ApplicationController.renderer.defaults.merge!( -# http_host: 'example.org', -# https: false -# ) -# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index f8aa155..2eeef96 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. @@ -7,12 +5,8 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path -# Add Yarn node_modules folder to the asset load path. -Rails.application.config.assets.paths << Rails.root.join("node_modules") # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. - -# Disable asset digests -Rails.application.config.assets.digest = true +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 33699c3..0000000 --- a/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code -# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". -Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 35d0f26..54f47cf 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,30 +1,25 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https -# # If you are using webpack-dev-server then specify webpack-dev-server host -# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true # end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb deleted file mode 100644 index 5a6a32d..0000000 --- a/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 1cbe09b..8a8653e 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 80b941c..26ef9f0 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -3,6 +3,10 @@ # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| + # 4.9 changes + config.responder.error_status = :unprocessable_entity + config.responder.redirect_status = :see_other + # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmation, reset password and unlock tokens in the database. diff --git a/config/initializers/devise_sign_out_monkeypatch.rb b/config/initializers/devise_sign_out_monkeypatch.rb new file mode 100644 index 0000000..4c87267 --- /dev/null +++ b/config/initializers/devise_sign_out_monkeypatch.rb @@ -0,0 +1,14 @@ +# This monkey patch modifies the redirect to allow it to redirect to a different host on log out. + +Rails.application.config.to_prepare do + class Devise::SessionsController < DeviseController # rubocop:disable Lint/ConstantDefinitionInBlock + def respond_to_on_destroy + # We actually need to hardcode this as Rails default responder doesn't + # support returning empty response on GET request + respond_to do |format| + format.all { head :no_content } + format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name), status: Devise.responder.redirect_status, allow_other_host: true } + end + end + end +end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 856a2f2..adc6568 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,8 @@ # 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 +# 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, :password + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf..3860f65 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -4,13 +4,13 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb deleted file mode 100644 index dc18996..0000000 --- a/config/initializers/mime_types.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb deleted file mode 100644 index 9526b83..0000000 --- a/config/initializers/new_framework_defaults_6_1.rb +++ /dev/null @@ -1,67 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains migration options to ease your Rails 6.1 upgrade. -# -# Once upgraded flip defaults one by one to migrate to the new default. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. - -# Support for inversing belongs_to -> has_many Active Record associations. -# Rails.application.config.active_record.has_many_inversing = true - -# Track Active Storage variants in the database. -# Rails.application.config.active_storage.track_variants = true - -# Apply random variation to the delay when retrying failed jobs. -# Rails.application.config.active_job.retry_jitter = 0.15 - -# Stop executing `after_enqueue`/`after_perform` callbacks if -# `before_enqueue`/`before_perform` respectively halts with `throw :abort`. -# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true - -# Specify cookies SameSite protection level: either :none, :lax, or :strict. -# -# This change is not backwards compatible with earlier Rails versions. -# It's best enabled when your entire app is migrated and stable on 6.1. -# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax - -# Generate CSRF tokens that are encoded in URL-safe Base64. -# -# This change is not backwards compatible with earlier Rails versions. -# It's best enabled when your entire app is migrated and stable on 6.1. -# Rails.application.config.action_controller.urlsafe_csrf_tokens = true - -# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an -# UTC offset or a UTC time. -# ActiveSupport.utc_to_local_returns_utc_offset_times = true - -# Change the default HTTP status code to `308` when redirecting non-GET/HEAD -# requests to HTTPS in `ActionDispatch::SSL` middleware. -# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308 - -# Use new connection handling API. For most applications this won't have any -# effect. For applications using multiple databases, this new API provides -# support for granular connection swapping. -# Rails.application.config.active_record.legacy_connection_handling = false - -# Make `form_with` generate non-remote forms by default. -# Rails.application.config.action_view.form_with_generates_remote_forms = false - -# Set the default queue name for the analysis job to the queue adapter default. -# Rails.application.config.active_storage.queues.analysis = nil - -# Set the default queue name for the purge job to the queue adapter default. -# Rails.application.config.active_storage.queues.purge = nil - -# Set the default queue name for the incineration job to the queue adapter default. -# Rails.application.config.action_mailbox.queues.incineration = nil - -# Set the default queue name for the routing job to the queue adapter default. -# Rails.application.config.action_mailbox.queues.routing = nil - -# Set the default queue name for the mail deliver job to the queue adapter default. -# Rails.application.config.action_mailer.deliver_later_queue_name = nil - -# Generate a `Link` header that gives a hint to modern browsers about -# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`. -# Rails.application.config.action_view.preload_links_header = true 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..b2fc168 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -0,0 +1,141 @@ +# 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 `