diff --git a/Gemfile.lock b/Gemfile.lock index f6987ae..ca1d309 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,61 +37,65 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.0.3.4) - actionpack (= 6.0.3.4) + actioncable (6.1.0) + actionpack (= 6.1.0) + activesupport (= 6.1.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.3.4) - actionpack (= 6.0.3.4) - activejob (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) + actionmailbox (6.1.0) + actionpack (= 6.1.0) + activejob (= 6.1.0) + activerecord (= 6.1.0) + activestorage (= 6.1.0) + activesupport (= 6.1.0) mail (>= 2.7.1) - actionmailer (6.0.3.4) - actionpack (= 6.0.3.4) - actionview (= 6.0.3.4) - activejob (= 6.0.3.4) + actionmailer (6.1.0) + actionpack (= 6.1.0) + actionview (= 6.1.0) + activejob (= 6.1.0) + activesupport (= 6.1.0) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.3.4) - actionview (= 6.0.3.4) - activesupport (= 6.0.3.4) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.0) + actionview (= 6.1.0) + activesupport (= 6.1.0) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.3.4) - actionpack (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) + actiontext (6.1.0) + actionpack (= 6.1.0) + activerecord (= 6.1.0) + activestorage (= 6.1.0) + activesupport (= 6.1.0) nokogiri (>= 1.8.5) - actionview (6.0.3.4) - activesupport (= 6.0.3.4) + actionview (6.1.0) + activesupport (= 6.1.0) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.3.4) - activesupport (= 6.0.3.4) + activejob (6.1.0) + activesupport (= 6.1.0) globalid (>= 0.3.6) - activemodel (6.0.3.4) - activesupport (= 6.0.3.4) - activerecord (6.0.3.4) - activemodel (= 6.0.3.4) - activesupport (= 6.0.3.4) - activestorage (6.0.3.4) - actionpack (= 6.0.3.4) - activejob (= 6.0.3.4) - activerecord (= 6.0.3.4) + activemodel (6.1.0) + activesupport (= 6.1.0) + activerecord (6.1.0) + activemodel (= 6.1.0) + activesupport (= 6.1.0) + activestorage (6.1.0) + actionpack (= 6.1.0) + activejob (= 6.1.0) + activerecord (= 6.1.0) + activesupport (= 6.1.0) marcel (~> 0.3.1) - activesupport (6.0.3.4) + mimemagic (~> 0.3.2) + activesupport (6.1.0) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) adhesiones-jekyll-theme (0.2.1) @@ -104,17 +108,17 @@ GEM jekyll-relative-urls (~> 0.0) jekyll-seo-tag (~> 2.1) ast (2.4.1) - autoprefixer-rails (10.0.1.0) + autoprefixer-rails (10.1.0.0) execjs bcrypt (3.1.16) - benchmark-ips (2.8.3) + benchmark-ips (2.8.4) bindex (0.8.1) - blazer (2.2.7) + blazer (2.4.0) activerecord (>= 5) chartkick (>= 3.2) railties (>= 5) safely_block (>= 0.1.1) - bootstrap (4.5.2) + bootstrap (4.5.3) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) @@ -127,7 +131,7 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - chartkick (3.4.1) + chartkick (3.4.2) childprocess (3.0.0) coderay (1.1.3) colorator (1.1.0) @@ -154,7 +158,7 @@ GEM warden (~> 1.2.3) devise-i18n (1.9.2) devise (>= 4.7.1) - devise_invitable (2.0.2) + devise_invitable (2.0.3) actionmailer (>= 5.0) devise (>= 4.6) dotenv (2.7.6) @@ -176,7 +180,7 @@ GEM em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) - email_address (0.1.18) + email_address (0.1.19) netaddr (>= 2.0.4, < 3) simpleidn errbase (0.2.0) @@ -193,16 +197,16 @@ GEM railties (>= 5.0.0) fast_blank (1.0.0) fast_jsonparser (0.5.0) - ffi (1.13.1) + ffi (1.14.2) flamegraph (0.9.5) forwardable-extended (2.6.0) - friendly_id (5.4.0) + friendly_id (5.4.1) activerecord (>= 4.0.0) get_process_mem (0.2.7) ffi (~> 1.0) globalid (0.4.2) activesupport (>= 4.2.0) - haml (5.2.0) + haml (5.2.1) temple (>= 0.8.0) tilt haml-lint (0.999.999) @@ -231,10 +235,10 @@ GEM icalendar (2.7.0) ice_cube (~> 0.16) ice_cube (0.16.3) - image_processing (1.12.0) + image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - inline_svg (1.7.1) + inline_svg (1.7.2) activesupport (>= 3.0) nokogiri (>= 1.6) jbuilder (2.10.1) @@ -255,17 +259,17 @@ GEM jekyll-liquify-alt (0.1.2) jekyll (~> 4) jekyll-locales (0.1.12) - jekyll-lunr (0.1.2) + jekyll-lunr (0.2.0) loofah (~> 2.4) jekyll-node-modules (0.1.0) jekyll (~> 4) jekyll-order (0.1.2) - jekyll-relative-urls (0.0.5) - jekyll (>= 3.8, < 5) + jekyll-relative-urls (0.0.6) + jekyll (~> 4) jekyll-sass-converter (2.1.0) sassc (> 2.0.1, < 3.0) - jekyll-seo-tag (2.6.1) - jekyll (>= 3.3, < 5.0) + jekyll-seo-tag (2.7.1) + jekyll (>= 3.8, < 5.0) jekyll-turbolinks (0.0.5) jekyll (~> 4) turbolinks-source (~> 5) @@ -286,13 +290,13 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - lockbox (0.4.9) + lockbox (0.6.1) lograge (0.11.2) actionpack (>= 4) activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.7.0) + loofah (2.8.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -304,7 +308,7 @@ GEM method_source (1.0.0) mimemagic (0.3.5) mini_histogram (0.3.1) - mini_magick (4.10.1) + mini_magick (4.11.0) mini_mime (1.0.2) mini_portile2 (2.4.0) minima (2.5.1) @@ -312,7 +316,7 @@ GEM jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.14.2) - mobility (0.8.13) + mobility (1.0.1) i18n (>= 0.6.10, < 2) request_store (~> 1.0) netaddr (2.0.4) @@ -320,32 +324,32 @@ GEM nokogiri (1.10.10) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) - parallel (1.19.2) + parallel (1.20.1) parser (2.7.2.0) ast (~> 2.4.1) pathutil (0.16.2) forwardable-extended (~> 2.6) pg (1.2.3) popper_js (1.16.0) - prometheus_exporter (0.5.3) + prometheus_exporter (0.6.0) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) public_suffix (4.0.6) - puma (5.0.2) + puma (5.1.1) nio4r (~> 2.0) pundit (2.1.0) activesupport (>= 3.0.0) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) - rack-mini-profiler (2.1.0) + rack-mini-profiler (2.2.1) rack (>= 1.2.0) rack-proxy (0.6.5) rack rack-test (1.1.0) rack (>= 1.0, < 3) - radios-comunitarias-jekyll-theme (0.1.3) + radios-comunitarias-jekyll-theme (0.1.4) jekyll (~> 4.0) jekyll-data (~> 1.1) jekyll-feed (~> 0.9) @@ -356,20 +360,20 @@ GEM jekyll-relative-urls (~> 0.0) jekyll-seo-tag (~> 2.1) jekyll-turbolinks (~> 0) - rails (6.0.3.4) - actioncable (= 6.0.3.4) - actionmailbox (= 6.0.3.4) - actionmailer (= 6.0.3.4) - actionpack (= 6.0.3.4) - actiontext (= 6.0.3.4) - actionview (= 6.0.3.4) - activejob (= 6.0.3.4) - activemodel (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) - bundler (>= 1.3.0) - railties (= 6.0.3.4) + rails (6.1.0) + actioncable (= 6.1.0) + actionmailbox (= 6.1.0) + actionmailer (= 6.1.0) + actionpack (= 6.1.0) + actiontext (= 6.1.0) + actionview (= 6.1.0) + activejob (= 6.1.0) + activemodel (= 6.1.0) + activerecord (= 6.1.0) + activestorage (= 6.1.0) + activesupport (= 6.1.0) + bundler (>= 1.15.0) + railties (= 6.1.0) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -381,18 +385,18 @@ GEM railties (>= 6.0.0, < 7) rails_warden (0.6.0) warden (>= 1.2.0) - railties (6.0.3.4) - actionpack (= 6.0.3.4) - activesupport (= 6.0.3.4) + railties (6.1.0) + actionpack (= 6.1.0) + activesupport (= 6.1.0) method_source rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + thor (~> 1.0) rainbow (3.0.0) - rake (13.0.1) + rake (13.0.3) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - recursero-jekyll-theme (0.1.1) + recursero-jekyll-theme (0.1.2) jekyll (~> 4.0) jekyll-data (~> 1.1) jekyll-feed (~> 0.9) @@ -409,7 +413,7 @@ GEM jekyll-unique-urls (~> 0.1) sutty-archives (~> 2.2) sutty-liquid (~> 0.1) - redis (4.2.2) + redis (4.2.5) redis-actionpack (5.2.0) actionpack (>= 5, < 7) redis-rack (>= 2.1.0, < 3) @@ -426,29 +430,29 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.9.0) redis (>= 4, < 5) - regexp_parser (1.8.1) + regexp_parser (2.0.1) request_store (1.5.0) rack (>= 1.4) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.4) - rouge (3.23.0) - rubocop (0.93.0) + rouge (3.26.0) + rubocop (1.6.1) parallel (~> 1.10) parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) + regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 0.6.0) + rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.7.1) + rubocop-ast (1.3.0) parser (>= 2.7.1.5) - rubocop-rails (2.8.1) + rubocop-rails (2.9.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.87.0) + rubocop (>= 0.90.0, < 2.0) ruby-enum (0.8.0) i18n ruby-filemagic (0.7.2) @@ -458,7 +462,7 @@ GEM ffi (~> 1.9) ruby_dep (1.5.0) rubyzip (2.3.0) - rugged (1.0.1) + rugged (1.1.0) safe_yaml (1.0.5) safely_block (0.3.0) errbase (>= 0.1.1) @@ -473,7 +477,7 @@ GEM selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - semantic_range (2.3.0) + semantic_range (2.3.1) share-to-fediverse-jekyll-theme (0.1.4) jekyll (~> 4.0) jekyll-data (~> 1.1) @@ -497,10 +501,10 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.4.2) - stackprof (0.2.15) + stackprof (0.2.16) sucker_punch (2.1.2) concurrent-ruby (~> 1.0) - sutty-archives (2.5.0) + sutty-archives (2.5.2) jekyll (>= 3.6, < 5.0) sutty-donaciones-jekyll-theme (0.1.2) jekyll (~> 4.0) @@ -519,7 +523,8 @@ GEM jekyll-include-cache (~> 0) jekyll-relative-urls (~> 0.0) jekyll-seo-tag (~> 2.1) - sutty-liquid (0.3.0) + sutty-liquid (0.6.2) + fast_blank (~> 1.0) jekyll (~> 4) sutty-minima (2.5.0) jekyll (>= 3.5, < 5.0) @@ -531,14 +536,13 @@ GEM terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thor (1.0.1) - thread_safe (0.3.6) tilt (2.0.10) - timecop (0.9.1) + timecop (0.9.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.8) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) @@ -550,7 +554,7 @@ GEM activesupport (>= 3.0) warden (1.2.9) rack (>= 2.0.9) - web-console (4.0.4) + web-console (4.1.0) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) @@ -565,7 +569,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.4.1) + zeitwerk (2.4.2) PLATFORMS ruby diff --git a/bin/rails b/bin/rails index 0739660..40b071e 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +load File.expand_path("spring", __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 1724048..a5c86fc 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,5 @@ #!/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 2dc500e..28090e5 100755 --- a/bin/setup +++ b/bin/setup @@ -21,7 +21,7 @@ FileUtils.chdir APP_ROOT do system('bundle check') || system!('bundle install') # Install JavaScript dependencies - # system('bin/yarn') + system! 'bin/yarn' # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') diff --git a/bin/spring b/bin/spring index 9bd27ec..3a402f5 100755 --- a/bin/spring +++ b/bin/spring @@ -1,18 +1,11 @@ #!/usr/bin/env ruby # frozen_string_literal: true - -# This file loads spring without using Bundler, in order to be fast. -# It gets overwritten when you run the `spring binstub` command. - -unless defined?(Spring) - require 'rubygems' - require 'bundler' - - lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) - spring = lockfile.specs.detect { |spec| spec.name == 'spring' } - if spring +if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) + # Load Spring without loading other gems in the Gemfile, for speed. + require "bundler" + Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring| Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path - gem 'spring', spring.version - require 'spring/binstub' + gem "spring", spring.version + require "spring/binstub" end end diff --git a/bin/yarn b/bin/yarn index 460dd56..241546e 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,9 +1,17 @@ #!/usr/bin/env ruby +require 'pathname' + APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT + executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path| + normalized_path = File.expand_path(path) + + normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn')) + end + + if executable_path + exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV + else $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1 diff --git a/config.ru b/config.ru index 842bccc..6dc8321 100644 --- a/config.ru +++ b/config.ru @@ -5,3 +5,4 @@ require_relative 'config/environment' run Rails.application +Rails.application.load_server diff --git a/config/application.rb b/config/application.rb index b2be99a..ef82167 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,7 +26,7 @@ module Sutty class Application < Rails::Application # Initialize configuration defaults for originally generated Rails # version. - config.load_defaults 6.0 + config.load_defaults 6.1 # Settings in config/environments/* take precedence over those # specified here. Application configuration can go into files in diff --git a/config/environments/development.rb b/config/environments/development.rb index ac601d4..8cca135 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'active_support/core_ext/integer/time' + Rails.application.configure do # Settings specified here will take precedence over those in # config/application.rb. @@ -18,8 +20,9 @@ Rails.application.configure do # 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 config.cache_store = :redis_cache_store, { url: ENV['REDIS_SERVER'] } config.public_file_server.headers = { @@ -43,6 +46,12 @@ Rails.application.configure do # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load @@ -58,12 +67,18 @@ Rails.application.configure do config.assets.quiet = true # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # 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 + config.action_mailer.default_options = { from: ENV['DEFAULT_FROM'] } config.action_mailer.perform_caching = false config.action_mailer.delivery_method = :letter_opener @@ -73,4 +88,11 @@ Rails.application.configure do Rails.application.routes.default_url_options[:host] = 'panel.sutty.local' Rails.application.routes.default_url_options[:port] = 3000 Rails.application.routes.default_url_options[:protocol] = 'https' + + config.middleware.use ExceptionNotification::Rack, + email: { + email_prefix: '[ERROR] ', + sender_address: ENV['DEFAULT_FROM'], + exception_recipients: ENV['EXCEPTION_TO'] + } end diff --git a/config/environments/production.rb b/config/environments/production.rb index 6b3db4a..e166241 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'active_support/core_ext/integer/time' + Rails.application.configure do # Settings specified here will take precedence over those in # config/application.rb. @@ -57,7 +59,7 @@ Rails.application.configure do config.log_level = :info # Prepend all log lines with the following tags. - config.log_tags = [:request_id] + config.log_tags = %i[request_id] # Use a different cache store in production. config.cache_store = :redis_cache_store, { url: ENV['REDIS_SERVER'] } @@ -81,6 +83,12 @@ Rails.application.configure do # 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 = [] + config.lograge.enabled = true # Use default logging formatter so that PID and timestamp are not # suppressed. @@ -100,9 +108,8 @@ 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 + # 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. # @@ -118,9 +125,10 @@ Rails.application.configure do # 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 = ActiveRecord::Middleware::DatabaseSelector::Resolver + # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session # config.active_record.database_resolver_context = # ActiveRecord::Middleware::DatabaseSelector::Resolver::Session diff --git a/config/environments/test.rb b/config/environments/test.rb index 2f5a5f1..f816982 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true -# +require 'active_support/core_ext/integer/time' + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped @@ -10,7 +11,8 @@ Rails.application.configure do # Settings specified here will take precedence over those in # config/application.rb. - config.cache_classes = true + config.cache_classes = false + config.action_view.cache_template_loading = 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 @@ -51,6 +53,15 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 4b63f28..d43cc1d 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -3,7 +3,8 @@ # 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| line =~ /my_noisy_library/ } +# 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. -# Rails.backtrace_cleaner.remove_silencers! +# 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/core_extensions.rb b/config/initializers/core_extensions.rb index 239f386..50370e0 100644 --- a/config/initializers/core_extensions.rb +++ b/config/initializers/core_extensions.rb @@ -22,10 +22,10 @@ module ActionDispatch # Post. Esto es para que las URLs no lleven un ?locale=XX # innecesario y además porque generan conflictos en la subida de # archivos de ActionText. - def generate(name, options, path_parameters, parameterize = nil) + def generate(name, options, path_parameters) options.delete(:locale) unless options[:controller] == 'posts' - generate_original(name, options, path_parameters, parameterize) + generate_original(name, options, path_parameters) end end end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 7a4f47b..9f68e0d 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -3,4 +3,6 @@ # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +Rails.application.config.filter_parameters += %i[ + password passw secret token _key crypt salt certificate otp ssn +] diff --git a/config/initializers/mobility.rb b/config/initializers/mobility.rb index 8176045..471b8c5 100644 --- a/config/initializers/mobility.rb +++ b/config/initializers/mobility.rb @@ -1,97 +1,109 @@ # frozen_string_literal: true Mobility.configure do |config| - # Sets the default backend to use in models. This can be overridden in - # models by passing +backend: ...+ to +translates+. - config.default_backend = :key_value + # PLUGINS + config.plugins do + # Backend + # + # Sets the default backend to use in models. This can be overridden in models + # by passing +backend: ...+ to +translates+. + # + # To default to a different backend globally, replace +:key_value+ by another + # backend name. + # + backend :key_value - # By default, Mobility uses the +translates+ class method in models to - # describe translated attributes, but you can configure this method to - # be whatever you like. This may be useful if using Mobility alongside - # another translation gem which uses the same method name. - config.accessor_method = :translates + # ActiveRecord + # + # Defines ActiveRecord as ORM, and enables ActiveRecord-specific plugins. + active_record - # To query on translated attributes, you need to append a scope to - # your model. The name of this scope is +i18n+ by default, but this - # can be changed to something else. - config.query_method = :i18n + # Accessors + # + # Define reader and writer methods for translated attributes. Remove either + # to disable globally, or pass +reader: false+ or +writer: false+ to + # +translates+ in any translated model. + # + reader + writer - # Uncomment and remove (or add) items to (from) this list to - # completely disable/enable plugins globally (so they cannot be used - # and are never even loaded). Note that if you remove an item from the - # list, you will not be able to use the plugin at all, and any options - # for the plugin will be ignored by models. (In most cases, you - # probably don't want to change this.) - # - # config.plugins = %i[ - # query - # cache - # dirty - # fallbacks - # presence - # default - # attribute_methods - # fallthrough_accessors - # locale_accessors - # ] + # Backend Reader + # + # Defines reader to access the backend for any attribute, of the form + # +_backend+. + # + backend_reader + # + # Or pass an interpolation string to define a different pattern: + # backend_reader "%s_translations" - # The translation cache is on by default, but you can turn it off by - # uncommenting this line. (This may be helpful in debugging.) - # - # config.default_options[:cache] = false + # Query + # + # Defines a scope on the model class which allows querying on + # translated attributes. The default scope is named +i18n+, pass a different + # name as default to change the global default, or to +translates+ in any + # model to change it for that model alone. + # + query - # Dirty tracking is disabled by default. Uncomment this line to enable - # it. If you enable this, you should also enable +locale_accessors+ - # by default (see below). - # - # config.default_options[:dirty] = true + # Cache + # + # Comment out to disable caching reads and writes. + # + cache - # No fallbacks are used by default. To define default fallbacks, - # uncomment and set the default fallback option value here. A "true" - # value will use whatever is defined by +I18n.fallbacks+ (if defined), - # or alternatively will fallback to your +I18n.default_locale+. - # - config.default_options[:fallbacks] = true + # Dirty + # + # Uncomment this line to include and enable globally: + dirty + # + # Or uncomment this line to include but disable by default, and only enable + # per model by passing +dirty: true+ to +translates+. + # dirty false - # The Presence plugin converts empty strings to nil when fetching and - # setting translations. By default it is on, uncomment this line to - # turn it off. - # - # config.default_options[:presence] = false + # Fallbacks + # + # Uncomment line below to enable fallbacks, using +I18n.fallbacks+. + fallbacks + # + # Or uncomment this line to enable fallbacks with a global default. + # fallbacks { :pt => :en } - # Set a default value to use if the translation is nil. By default - # this is off, uncomment and set a default to use it across all models - # (you probably don't want to do that). - # - # config.default_options[:default] = ... + # Presence + # + # Converts blank strings to nil on reads and writes. Comment out to + # disable. + # + presence - # Uncomment to enable locale_accessors by default on models. A true - # value will use the locales defined either in - # Rails.application.config.i18n.available_locales or - # I18n.available_locales. If you want something else, pass an array - # of locales instead. - # - # config.default_options[:locale_accessors] = true + # Default + # + # Set a default translation per attributes. When enabled, passing +default: + # 'foo'+ sets a default translation string to show in case no translation is + # present. Can also be passed a proc. + # + # default 'foo' - # Uncomment to enable fallthrough accessors by default on models. This - # will allow you to call any method with a suffix like _en or _pt_br, - # and Mobility will catch the suffix and convert it into a locale in - # +method_missing+. If you don't need this kind of open-ended - # fallthrough behavior, it's better to use locale_accessors instead - # (which define methods) since method_missing is very slow. (You can - # use both fallthrough and locale accessor plugins together without - # conflict.) - # - # Note: The dirty plugin enables fallthrough_accessors by default. - # - # config.default_options[:fallthrough_accessors] = true + # Fallthrough Accessors + # + # Uses method_missing to define locale-specific accessor methods like + # +title_en+, +title_en=+, +title_fr+, +title_fr=+ for each translated + # attribute. If you know what set of locales you want to support, it's + # generally better to use Locale Accessors (or both together) since + # +method_missing+ is very slow. (You can use both fallthrough and locale + # accessor plugins together without conflict.) + # + # fallthrough_accessors - # You can also include backend-specific default options. For example, - # if you want to default to using the text-type translation table with - # the KeyValue backend, you can set that as a default by uncommenting - # this line, or change it to :string to default to the string-type - # translation table instead. (For other backends, this option is - # ignored.) - # - # config.default_options[:type] = :text + # Locale Accessors + # + # Uses +def+ to define accessor methods for a set of locales. By default uses + # +I18n.available_locales+, but you can pass the set of locales with + # +translates+ and/or set a global default here. + # + locale_accessors + # + # Or define specific defaults by uncommenting line below + # locale_accessors [:en, :ja] + end end diff --git a/config/puma.rb b/config/puma.rb index e36b88d..2e5ea94 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -7,8 +7,14 @@ # minimum and maximum; this matches the default thread size of Active # Record. # -threads_count = ENV.fetch('RAILS_MAX_THREADS') { 1 } -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 `worker_timeout` threshold that Puma will use to wait before +# terminating a worker in development environments. +# +worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development' # Specifies the `port` that Puma will listen on to receive requests; # default is 3000. @@ -19,6 +25,9 @@ port ENV.fetch('PORT') { 3000 } # environment ENV.fetch('RAILS_ENV') { 'development' } +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' } + # Specifies the number of `workers` to boot in clustered mode. Workers # are forked webserver processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. @@ -37,8 +46,6 @@ preload_app! # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart -pidfile 'tmp/puma.pid' - # If you are preloading your application and using Active Record, it's # recommended that you close any connections to the database before workers # are forked to prevent connection leakage. @@ -59,7 +66,8 @@ on_worker_boot do if Rails.env.production? require 'prometheus_exporter/instrumentation' - PrometheusExporter::Instrumentation::ActiveRecord.start(custom_labels: { type: 'puma_worker' }, config_labels: %i[database host]) + PrometheusExporter::Instrumentation::ActiveRecord.start(custom_labels: { type: 'puma_worker' }, + config_labels: %i[database host]) PrometheusExporter::Instrumentation::Puma.start PrometheusExporter::Instrumentation::Process.start(type: 'web') end diff --git a/config/storage.yml b/config/storage.yml index b35ed15..c7ba918 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -1,5 +1,6 @@ local: service: Disk + public: true root: <%= Rails.root.join('_storage') %> test: