From 252e782fcf1f805e00e3eed009e58d4ab5704039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 3 Jun 2020 16:06:07 +0300 Subject: [PATCH 1/7] Pump coffee-rails from 4.2 to 5.0 --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 79ec63020..f6c8a6397 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem 'nokogiri' # style gem 'bootstrap-sass', '~> 3.4' -gem 'coffee-rails', '~> 4.2' +gem 'coffee-rails', '>= 5.0' gem 'jquery-rails' gem 'selectize-rails', '0.12.1' # include selectize.js for select gem 'kaminari' diff --git a/Gemfile.lock b/Gemfile.lock index 0aef76674..fcaf23fd9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -157,9 +157,9 @@ GEM childprocess (3.0.0) chronic (0.10.2) coderay (1.1.0) - coffee-rails (4.2.2) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs @@ -498,7 +498,7 @@ DEPENDENCIES cancancan capybara coderay (= 1.1.0) - coffee-rails (~> 4.2) + coffee-rails (>= 5.0) company_register! countries daemons-rails (= 1.2.1) From cab9c304ad2711c243651644d8aa860708437d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 3 Jun 2020 16:39:03 +0300 Subject: [PATCH 2/7] Preload assets via manifest.js Sass-rails v6.0 and sprockets v4.0.0 decline to work properly, if trying to load assets both via manifest.js and config preload path --- config/initializers/assets.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index ba78ea325..0794e55a4 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -6,13 +6,4 @@ Rails.application.configure do # Add additional assets to the asset load path config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts', 'node_modules') - - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - config.assets.precompile += %w[login.css registrar-manifest.css shared/pdf.css] - config.assets.precompile += %w(*.svg *.eot *.woff *.ttf) - config.assets.precompile += %w(admin-manifest.css admin-manifest.js) - config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js) - config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js) - config.assets.precompile += %w( admin.js admin.css ) end From fbaf439dc27758303f11f818987bc275ee810e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 4 Jun 2020 12:15:39 +0300 Subject: [PATCH 3/7] Allow any host in development --- config/environments/development.rb | 66 ----------------------- config/environments/development.rb.sample | 3 ++ 2 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 config/environments/development.rb diff --git a/config/environments/development.rb b/config/environments/development.rb deleted file mode 100644 index e02996d30..000000000 --- a/config/environments/development.rb +++ /dev/null @@ -1,66 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - config.autoload = :classic - - # Do not eager load code on boot. - config.eager_load = false - - # Show full error reports. - config.consider_all_requests_local = 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? - config.action_controller.perform_caching = true - config.action_controller.enable_fragment_cache_logging = true - - config.cache_store = :memory_store - config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" - } - else - config.action_controller.perform_caching = false - - config.cache_store = :null_store - end - - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local - - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false - - config.action_mailer.perform_caching = false - - # Print deprecation notices to the Rails logger. - config.active_support.deprecation = :log - - # Raise an error on page load if there are pending migrations. - 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 = true - - # Suppress logger output for asset requests. - config.assets.quiet = true - - # Allow any host to access development - config.hosts.clear - - # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = 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 -end diff --git a/config/environments/development.rb.sample b/config/environments/development.rb.sample index f5ed70e06..d052f69c0 100644 --- a/config/environments/development.rb.sample +++ b/config/environments/development.rb.sample @@ -32,6 +32,9 @@ Rails.application.configure do config.assets.raise_runtime_errors = true config.action_view.raise_on_missing_translations = true + + # Allow any host to access development + config.hosts.clear end # In this mode, any jobs you queue will be run in the same thread, synchronously From 96b5eb881a1a68121fb8e1fe99ffa064f19ffb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 4 Jun 2020 12:36:17 +0300 Subject: [PATCH 4/7] Determine CPU count for parallelizing tests --- test/test_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 3ab1e721d..fab712feb 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -43,7 +43,8 @@ EInvoice.provider = EInvoice::Providers::TestProvider.new class ActiveSupport::TestCase # Run tests in parallel with specified workers - parallelize(workers: :number_of_processors) + cpu_count = ENV['PARALLEL_WORKERS'] || Concurrent.physical_processor_count || 1 + parallelize(workers: cpu_count) ActiveRecord::Migration.check_pending! fixtures :all From 19a543e184c7871dabb18e6233beed3d1dc1240c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 4 Jun 2020 13:13:31 +0300 Subject: [PATCH 5/7] Do not check for Authenticity token in EPP --- app/controllers/epp/base_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/epp/base_controller.rb b/app/controllers/epp/base_controller.rb index 4c099730f..b8d73f8da 100644 --- a/app/controllers/epp/base_controller.rb +++ b/app/controllers/epp/base_controller.rb @@ -1,7 +1,7 @@ module Epp class BaseController < ActionController::Base class AuthorizationError < StandardError; end - + skip_before_action :verify_authenticity_token check_authorization layout false From 4173639049518206882092ab80527f7b4925108c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 4 Jun 2020 13:38:16 +0300 Subject: [PATCH 6/7] Do not use parallel testing --- test/test_helper.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index fab712feb..bee6fdcf9 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -42,10 +42,6 @@ CompanyRegister::Client = CompanyRegisterClientStub EInvoice.provider = EInvoice::Providers::TestProvider.new class ActiveSupport::TestCase - # Run tests in parallel with specified workers - cpu_count = ENV['PARALLEL_WORKERS'] || Concurrent.physical_processor_count || 1 - parallelize(workers: cpu_count) - ActiveRecord::Migration.check_pending! fixtures :all From 429314888777a333d3cf692173254feb59fe4d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 4 Jun 2020 16:46:19 +0300 Subject: [PATCH 7/7] Remove useless paper_trail initializer Association Tracking for PaperTrail has been extracted to a separate gem anyways --- config/initializers/paper_trail.rb | 1 - 1 file changed, 1 deletion(-) delete mode 100644 config/initializers/paper_trail.rb diff --git a/config/initializers/paper_trail.rb b/config/initializers/paper_trail.rb deleted file mode 100644 index 39a667917..000000000 --- a/config/initializers/paper_trail.rb +++ /dev/null @@ -1 +0,0 @@ -PaperTrail.config.track_associations = false