From 50507f2d3b8e014c857e5e53df6208f4c50d2f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Sat, 2 Mar 2019 20:10:46 +0100 Subject: [PATCH] trying to upgrade to Rails 6.0.0.beta2 --- .gitignore | 3 - Gemfile | 17 ++- Gemfile.lock | 105 +++++++++-------- app/assets/config/manifest.js | 1 + app/javascript/channels/application.js | 9 ++ app/javascript/channels/consummer.js | 6 + app/javascript/channels/index.js | 5 + app/jobs/application_job.rb | 6 + bin/bundle | 106 +++++++++++++++++- bin/setup | 7 +- bin/update | 11 +- bin/webpack | 6 +- bin/webpack-dev-server | 6 +- config/application.rb | 2 +- config/environments/development.rb | 5 +- config/environments/production.rb | 30 ++++- config/environments/test.rb | 5 +- .../initializers/content_security_policy.rb | 2 + config/puma.rb | 7 +- config/routes.rb | 4 +- config/spring.rb | 12 +- package.json | 4 +- 22 files changed, 261 insertions(+), 98 deletions(-) create mode 100644 app/javascript/channels/application.js create mode 100644 app/javascript/channels/consummer.js create mode 100644 app/javascript/channels/index.js mode change 100755 => 100644 bin/bundle diff --git a/.gitignore b/.gitignore index 0bfdc6a..88e174f 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,6 @@ # Ignore uploaded files in development /storage/* -/node_modules -/yarn-error.log - /public/assets .byebug_history diff --git a/Gemfile b/Gemfile index 5dc2167..314707e 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '>= 2.3.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.2.0' +gem 'rails', '6.0.0.beta2' gem 'rails-i18n', '~> 5.1' # Use mysql as the database for Active Record gem 'mysql2', '>= 0.4.4', '< 0.6.0' @@ -18,23 +18,20 @@ gem 'pundit', '~> 1.1' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' -# Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' -gem 'webpacker', '~> 3.5' +# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker +gem 'webpacker', '>= 4.0.0.rc.3' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'mini_racer', platforms: :ruby -# Use CoffeeScript for .coffee assets and views -# gem 'coffee-rails', '~> 4.2' # 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.5' -# Use ActiveModel has_secure_password +# Use Active Model has_secure_password gem 'bcrypt', '~> 3.1.7' -# Use ActiveStorage variant -# gem 'mini_magick', '~> 4.8' +# Use Active Storage variant +# gem 'image_processing', '~> 1.2' gem 'rack-contrib' @@ -51,7 +48,7 @@ gem 'has_scope' gem 'logging' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.1.0', require: false +gem 'bootsnap', '>= 1.4.1', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index a8da6cc..43699fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,47 +1,60 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.2) - actionpack (= 5.2.2) + actioncable (6.0.0.beta2) + actionpack (= 6.0.0.beta2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) + actionmailbox (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activejob (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) + activestorage (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) + mail (>= 2.7.1) + actionmailer (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + actionview (= 6.0.0.beta2) + activejob (= 6.0.0.beta2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.2) - actionview (= 5.2.2) - activesupport (= 5.2.2) + actionpack (6.0.0.beta2) + actionview (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.2) - activesupport (= 5.2.2) + actiontext (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) + activestorage (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) + nokogiri (>= 1.8.5) + actionview (6.0.0.beta2) + activesupport (= 6.0.0.beta2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.2) - activesupport (= 5.2.2) + activejob (6.0.0.beta2) + activesupport (= 6.0.0.beta2) globalid (>= 0.3.6) - activemodel (5.2.2) - activesupport (= 5.2.2) - activerecord (5.2.2) - activemodel (= 5.2.2) - activesupport (= 5.2.2) - arel (>= 9.0) - activestorage (5.2.2) - actionpack (= 5.2.2) - activerecord (= 5.2.2) + activemodel (6.0.0.beta2) + activesupport (= 6.0.0.beta2) + activerecord (6.0.0.beta2) + activemodel (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) + activestorage (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) marcel (~> 0.3.1) - activesupport (5.2.2) + activesupport (6.0.0.beta2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 1.3, >= 1.3.1) addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) airbrussh (1.3.1) @@ -51,7 +64,6 @@ GEM rake (>= 10.4, < 13.0) archive-zip (0.12.0) io-like (~> 0.3.0) - arel (9.0.0) ast (2.4.0) bcrypt (3.1.12) bcrypt_pbkdf (1.0.0) @@ -108,7 +120,6 @@ GEM devise (>= 4.6) docile (1.3.1) erubi (1.8.0) - execjs (2.7.0) factory_bot (5.0.2) activesupport (>= 4.2.0) factory_bot_rails (5.0.1) @@ -224,18 +235,20 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.2) - actioncable (= 5.2.2) - actionmailer (= 5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) - activemodel (= 5.2.2) - activerecord (= 5.2.2) - activestorage (= 5.2.2) - activesupport (= 5.2.2) + rails (6.0.0.beta2) + actioncable (= 6.0.0.beta2) + actionmailbox (= 6.0.0.beta2) + actionmailer (= 6.0.0.beta2) + actionpack (= 6.0.0.beta2) + actiontext (= 6.0.0.beta2) + actionview (= 6.0.0.beta2) + activejob (= 6.0.0.beta2) + activemodel (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) + activestorage (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) bundler (>= 1.3.0) - railties (= 5.2.2) + railties (= 6.0.0.beta2) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -245,12 +258,12 @@ GEM rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.2) - actionpack (= 5.2.2) - activesupport (= 5.2.2) + railties (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.0.0) rake (12.3.2) rb-fsevent (0.10.3) @@ -318,8 +331,6 @@ GEM turbolinks-source (5.2.0) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.20) - execjs (>= 0.3.0, < 3) unicode-display_width (1.4.1) warden (1.2.8) rack (>= 2.0.6) @@ -328,7 +339,7 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - webpacker (3.5.5) + webpacker (4.0.0.rc.7) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) @@ -339,6 +350,7 @@ GEM chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (1.3.1) PLATFORMS ruby @@ -348,7 +360,7 @@ DEPENDENCIES bcrypt (~> 3.1.7) bcrypt_pbkdf (>= 1.0, < 2.0) binding_of_caller - bootsnap (>= 1.1.0) + bootsnap (>= 1.4.1) capistrano (~> 3.10) capistrano-rails (~> 1.4) capistrano-rbenv @@ -378,7 +390,7 @@ DEPENDENCIES puma (~> 3.11) pundit (~> 1.1) rack-contrib - rails (~> 5.2.0) + rails (= 6.0.0.beta2) rails-i18n (~> 5.1) rbnacl (>= 3.2, < 5.0) rubocop (~> 0.56.0) @@ -390,9 +402,8 @@ DEPENDENCIES spring-watcher-listen (~> 2.0.0) turbolinks (~> 5) tzinfo-data - uglifier (>= 1.3.0) web-console (>= 3.3.0) - webpacker (~> 3.5) + webpacker (>= 4.0.0.rc.3) whenever RUBY VERSION diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index ac907b3..5918193 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1 +1,2 @@ //= link_tree ../images +//= link_directory ../stylesheets .css diff --git a/app/javascript/channels/application.js b/app/javascript/channels/application.js new file mode 100644 index 0000000..9334135 --- /dev/null +++ b/app/javascript/channels/application.js @@ -0,0 +1,9 @@ +// 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. + +require("@rails/ujs").start() +require("turbolinks").start() +require("@rails/activestorage").start() +require("channels") diff --git a/app/javascript/channels/consummer.js b/app/javascript/channels/consummer.js new file mode 100644 index 0000000..0eceb59 --- /dev/null +++ b/app/javascript/channels/consummer.js @@ -0,0 +1,6 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the `rails generate channel` command. + +import { createConsumer } from "@rails/actioncable" + +export default createConsumer() diff --git a/app/javascript/channels/index.js b/app/javascript/channels/index.js new file mode 100644 index 0000000..0cfcf74 --- /dev/null +++ b/app/javascript/channels/index.js @@ -0,0 +1,5 @@ +// Load all the channels within this directory and all subdirectories. +// Channel files must be named *_channel.js. + +const channels = require.context('.', true, /_channel\.js$/) +channels.keys().forEach(channels) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index ce4acc2..5a34298 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,4 +1,10 @@ class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError + # from http://api.rubyonrails.org/classes/ActiveJob/Core.html attr_writer :attempt_number diff --git a/bin/bundle b/bin/bundle old mode 100755 new mode 100644 index f19acf5..524dfd3 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,105 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -load Gem.bin_path('bundler', 'bundle') +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 || ">= 0.a" + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../../Gemfile", __FILE__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_version + @bundler_version ||= begin + env_var_version || cli_arg_version || + lockfile_version || "#{Gem::Requirement.default}.a" + end + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + # must dup string for RG < 1.8 compatibility + activate_bundler(bundler_version.dup) + end + + def activate_bundler(bundler_version) + if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0") + bundler_version = "< 2" + end + gem_error = activation_error_handling do + gem "bundler", bundler_version + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/bin/setup b/bin/setup index 94fd4d7..81b81ba 100755 --- a/bin/setup +++ b/bin/setup @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,7 +8,7 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do +FileUtils.chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. @@ -17,12 +16,12 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn + # Install JavaScript dependencies # system('bin/yarn') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" diff --git a/bin/update b/bin/update index 58bfaed..fe92711 100755 --- a/bin/update +++ b/bin/update @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,7 +8,7 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do +FileUtils.chdir APP_ROOT do # This script is a way to update your development environment automatically. # Add necessary update steps to this file. @@ -17,15 +16,15 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn + # Install JavaScript dependencies # system('bin/yarn') puts "\n== Updating database ==" - system! 'bin/rails db:migrate' + system! 'rails db:migrate' puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! 'rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! 'rails restart' end diff --git a/bin/webpack b/bin/webpack index 4658327..008ecb2 100755 --- a/bin/webpack +++ b/bin/webpack @@ -12,4 +12,8 @@ require "bundler/setup" require "webpacker" require "webpacker/webpack_runner" -Webpacker::WebpackRunner.run(ARGV) + +APP_ROOT = File.expand_path("..", __dir__) +Dir.chdir(APP_ROOT) do + Webpacker::WebpackRunner.run(ARGV) +end diff --git a/bin/webpack-dev-server b/bin/webpack-dev-server index faa69f0..a931a9b 100755 --- a/bin/webpack-dev-server +++ b/bin/webpack-dev-server @@ -12,4 +12,8 @@ require "bundler/setup" require "webpacker" require "webpacker/dev_server_runner" -Webpacker::DevServerRunner.run(ARGV) + +APP_ROOT = File.expand_path("..", __dir__) +Dir.chdir(APP_ROOT) do + Webpacker::DevServerRunner.run(ARGV) +end diff --git a/config/application.rb b/config/application.rb index 9f5c3df..1868578 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,7 +20,7 @@ Bundler.require(*Rails.groups) module Chexpire class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.2 + config.load_defaults 6.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers diff --git a/config/environments/development.rb b/config/environments/development.rb index 080cd98..c435365 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -20,6 +20,7 @@ Rails.application.configure do # 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 = { @@ -31,7 +32,7 @@ Rails.application.configure do config.cache_store = :null_store end - # Store uploaded files on the local file system (see config/storage.yml for options) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local config.action_mailer.delivery_method = :letter_opener_web @@ -65,7 +66,7 @@ Rails.application.configure do # Suppress logger output for asset requests. config.assets.quiet = true - # Raises error for missing translations + # 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, diff --git a/config/environments/production.rb b/config/environments/production.rb index 45a7f1e..9f3f646 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -24,15 +24,12 @@ Rails.application.configure do # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' @@ -40,7 +37,7 @@ Rails.application.configure do # 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) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. @@ -56,7 +53,7 @@ Rails.application.configure do # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment) + # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "chexpire_#{Rails.env}" @@ -93,4 +90,25 @@ Rails.application.configure do # 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 end diff --git a/config/environments/test.rb b/config/environments/test.rb index c3e00d2..e5fd425 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -23,6 +23,7 @@ Rails.application.configure do # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false + config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false @@ -30,7 +31,7 @@ Rails.application.configure do # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory + # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test config.action_mailer.perform_caching = false @@ -45,6 +46,6 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Raises error for missing translations + # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true end diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index d83ffdf..da594b4 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -11,6 +11,8 @@ Rails.application.config.content_security_policy do |policy| 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" diff --git a/config/puma.rb b/config/puma.rb index a5eccf8..649253a 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -4,8 +4,9 @@ # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -threads threads_count, threads_count +max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +threads min_threads_count, max_threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. # @@ -16,7 +17,7 @@ port ENV.fetch("PORT") { 3000 } environment ENV.fetch("RAILS_ENV") { "development" } # Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together +# Workers are forked web server processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. # Workers do not work on JRuby or Windows (both of which do not support # processes). diff --git a/config/routes.rb b/config/routes.rb index 8baaa3a..352ecaa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ # In order to update the route map below, # run `bundle exec annotate -r` after modifying this file Rails.application.routes.draw do - # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html resources :checks, except: [:show] do collection do @@ -63,7 +63,7 @@ end # rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show # update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update # rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create -# +# # Routes for LetterOpenerWeb::Engine: # clear_letters DELETE /clear(.:format) letter_opener_web/letters#clear # delete_letter DELETE /:id(.:format) letter_opener_web/letters#destroy diff --git a/config/spring.rb b/config/spring.rb index 9fa7863..db5bf13 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,6 +1,6 @@ -%w[ - .ruby-version - .rbenv-vars - tmp/restart.txt - tmp/caching-dev.txt -].each { |path| Spring.watch(path) } +Spring.watch( + ".ruby-version", + ".rbenv-vars", + "tmp/restart.txt", + "tmp/caching-dev.txt" +) diff --git a/package.json b/package.json index e00de19..935295d 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "exports-loader": "^0.7.0", "jquery": "^3.3.1", "popper.js": "^1.14.3", - "rails-ujs": "^5.2.0", - "turbolinks": "^5.1.1" + "@rails/ujs": "^6.0.0-alpha", + "turbolinks": "^5.2.0" }, "devDependencies": { "webpack-dev-server": "2.11.2"