mercy 1.5.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +89 -9
  3. data/.claude/agents/architect.md +48 -0
  4. data/.claude/agents/infra.md +36 -0
  5. data/.claude/agents/ruby.md +45 -0
  6. data/.claude/configuration/arcanum-repo-config.json +3 -0
  7. data/.claude/scripts/check_infra.sh +6 -0
  8. data/.claude/scripts/check_ruby.sh +7 -0
  9. data/.claude/settings.json +10 -0
  10. data/.github/commit_message_template-2.0.md +32 -0
  11. data/.github/commit_message_template.md +10 -0
  12. data/.github/copilot-instructions.md +1 -0
  13. data/.github/pull_request_template.md +17 -0
  14. data/.gitignore +8 -0
  15. data/.rubocop.yml +39 -0
  16. data/.rubocop_todo.yml +60 -0
  17. data/AGENTS.md +58 -0
  18. data/CLAUDE.md +1 -0
  19. data/Dockerfile +21 -0
  20. data/Gemfile +26 -1
  21. data/README.md +13 -4
  22. data/Rakefile +11 -3
  23. data/config/check_specs.yml +7 -0
  24. data/config/rubycritc.rb +12 -0
  25. data/config/yardstick.rb +13 -0
  26. data/config/yardstick.yml +41 -0
  27. data/docker-compose.yml +14 -9
  28. data/docs/agents/arcanum-split-issue.md +9 -0
  29. data/docs/agents/architecture.md +61 -0
  30. data/docs/agents/contributing.md +195 -0
  31. data/docs/agents/flow.md +5 -0
  32. data/docs/agents/folder-structure.md +26 -0
  33. data/docs/agents/issue-enhancement.md +10 -0
  34. data/docs/agents/issues/.gitkeep +1 -0
  35. data/docs/agents/plans/.gitkeep +1 -0
  36. data/lib/arstotzka/type_cast_ext.rb +52 -2
  37. data/lib/mercy/class_methods.rb +77 -7
  38. data/lib/mercy/concern.rb +105 -1
  39. data/lib/mercy/period_parser.rb +46 -3
  40. data/lib/mercy/report/active_record.rb +20 -16
  41. data/lib/mercy/report/error.rb +6 -4
  42. data/lib/mercy/report/multiple.rb +26 -22
  43. data/lib/mercy/report/range.rb +6 -4
  44. data/lib/mercy/report.rb +38 -7
  45. data/lib/mercy/report_builder.rb +2 -0
  46. data/lib/mercy/report_config.rb +5 -0
  47. data/lib/mercy/status.rb +7 -1
  48. data/lib/mercy/status_builder.rb +2 -0
  49. data/lib/mercy/version.rb +3 -1
  50. data/lib/mercy.rb +2 -0
  51. data/mercy.gemspec +19 -25
  52. data/scripts/bump_version.sh +62 -0
  53. data/scripts/check_readme.sh +6 -0
  54. data/scripts/rubycritic.sh +10 -0
  55. data/spec/dummy/.ruby-version +1 -0
  56. data/spec/dummy/Rakefile +10 -0
  57. data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
  58. data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
  59. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  60. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  61. data/spec/dummy/app/controllers/document_report_controller.rb +34 -0
  62. data/spec/dummy/app/controllers/example_report_controller.rb +27 -0
  63. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  64. data/spec/dummy/app/jobs/application_job.rb +4 -0
  65. data/spec/dummy/app/mailers/application_mailer.rb +6 -0
  66. data/spec/dummy/app/models/application_record.rb +5 -0
  67. data/spec/dummy/app/models/concerns/.keep +0 -0
  68. data/spec/dummy/app/models/document.rb +9 -0
  69. data/spec/dummy/app/models/dummy_report.rb +6 -0
  70. data/spec/dummy/app/models/mercy/report/doc_type_error.rb +20 -0
  71. data/spec/dummy/app/models/mercy/report/dummy1.rb +19 -0
  72. data/spec/dummy/app/models/mercy/report/dummy_report.rb +11 -0
  73. data/spec/dummy/app/models/mercy/report/multiple/dummy.rb +28 -0
  74. data/spec/dummy/app/models/mercy/report/multiple/successes.rb +28 -0
  75. data/spec/dummy/app/models/mercy/report/success.rb +18 -0
  76. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  77. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  78. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  79. data/spec/dummy/bin/bundle +5 -0
  80. data/spec/dummy/bin/rails +6 -0
  81. data/spec/dummy/bin/rake +6 -0
  82. data/spec/dummy/bin/setup +38 -0
  83. data/spec/dummy/bin/update +33 -0
  84. data/spec/dummy/bin/yarn +11 -0
  85. data/spec/dummy/config/application.rb +24 -0
  86. data/spec/dummy/config/boot.rb +7 -0
  87. data/spec/dummy/config/cable.yml +10 -0
  88. data/spec/dummy/config/database.yml +20 -0
  89. data/spec/dummy/config/environment.rb +7 -0
  90. data/spec/dummy/config/environments/development.rb +55 -0
  91. data/spec/dummy/config/environments/production.rb +95 -0
  92. data/spec/dummy/config/environments/test.rb +52 -0
  93. data/spec/dummy/config/initializers/application_controller_renderer.rb +10 -0
  94. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
  95. data/spec/dummy/config/initializers/content_security_policy.rb +27 -0
  96. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  97. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  98. data/spec/dummy/config/initializers/inflections.rb +18 -0
  99. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  100. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  101. data/spec/dummy/config/locales/en.yml +33 -0
  102. data/spec/dummy/config/puma.rb +36 -0
  103. data/spec/dummy/config/routes.rb +16 -0
  104. data/spec/dummy/config/spring.rb +8 -0
  105. data/spec/dummy/config/storage.yml +34 -0
  106. data/spec/dummy/config.ru +7 -0
  107. data/spec/dummy/db/migrate/20190508170435_create_documents.rb +13 -0
  108. data/spec/dummy/db/schema.rb +27 -0
  109. data/spec/dummy/log/.keep +0 -0
  110. data/spec/dummy/package.json +5 -0
  111. data/spec/dummy/public/404.html +67 -0
  112. data/spec/dummy/public/422.html +67 -0
  113. data/spec/dummy/public/500.html +66 -0
  114. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  115. data/spec/dummy/public/apple-touch-icon.png +0 -0
  116. data/spec/dummy/public/favicon.ico +0 -0
  117. data/spec/dummy/storage/.keep +0 -0
  118. data/spec/dummy/tmp/.keep +0 -0
  119. data/spec/dummy/tmp/storage/.keep +0 -0
  120. data/spec/integration/controller/error_report_controller_spec.rb +196 -0
  121. data/spec/integration/controller/multiple_report_spec.rb +86 -0
  122. data/spec/integration/controller/range_report_spec.rb +194 -0
  123. data/spec/integration/yard/arstotzka/type_cast_spec.rb +43 -0
  124. data/spec/integration/yard/controller/example_report_controller_spec.rb +95 -0
  125. data/spec/integration/yard/mercy/period_parser_spec.rb +21 -0
  126. data/spec/lib/arstotzka/type_cast_spec.rb +10 -9
  127. data/spec/lib/mercy/period_parser_spec.rb +10 -9
  128. data/spec/lib/mercy/report/error_spec.rb +93 -70
  129. data/spec/lib/mercy/report/multiple_spec.rb +9 -57
  130. data/spec/lib/mercy/report/range_spec.rb +70 -41
  131. data/spec/lib/mercy/report_builder_spec.rb +34 -17
  132. data/spec/lib/mercy/report_config_spec.rb +48 -0
  133. data/spec/lib/mercy/report_spec.rb +5 -15
  134. data/spec/lib/mercy/status_builder_spec.rb +33 -22
  135. data/spec/lib/mercy/status_spec.rb +69 -49
  136. data/spec/spec_helper.rb +18 -7
  137. data/spec/support/fixture_helpers.rb +4 -2
  138. data/spec/support/models/arstotzka/type_cast/dummy.rb +9 -0
  139. data/spec/support/shared_contexts/document_setup.rb +31 -0
  140. data/spec/support/shared_examples/time_parser.rb +2 -0
  141. metadata +123 -109
  142. data/spec/lib/mercy/report/report_config_spec.rb +0 -39
  143. data/spec/support/models/document.rb +0 -6
  144. data/spec/support/report/dummy.rb +0 -15
  145. data/spec/support/schema.rb +0 -11
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mercy
4
+ class Report
5
+ class DocTypeError < Mercy::Report::Error
6
+ ALLOWED_PARAMETERS = %i[period threshold].freeze
7
+ DEFAULT_OPTION = {
8
+ threshold: 0.25,
9
+ clazz: Document,
10
+ external_key: :external_id
11
+ }.freeze
12
+
13
+ expose :doc_type, case: :snake
14
+
15
+ def base
16
+ super.where(doc_type: doc_type)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mercy
4
+ class Report
5
+ class Dummy1 < Mercy::Report
6
+ DEFAULT_OPTION = {
7
+ option_value: 1,
8
+ other_option: 10
9
+ }.freeze
10
+ expose :option_value, :other_option, case: :snake
11
+ end
12
+
13
+ class Dummy2 < Dummy1; end
14
+
15
+ class Dummy3 < Dummy1
16
+ DEFAULT_OPTION = { option_value: 5 }.freeze
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mercy
4
+ class Report
5
+ class DummyReport < Report
6
+ ALLOWED_PARAMETERS = %i[period threshold].freeze
7
+ def initialize(options) # rubocop:disable Lint/MissingSuper
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mercy
4
+ class Report
5
+ module Multiple
6
+ class Dummy < Mercy::Report
7
+ include Mercy::Report::Multiple
8
+
9
+ DEFAULT_OPTION = {
10
+ doc_type: %i[a b]
11
+ }.freeze
12
+ expose :doc_type, case: :snake
13
+
14
+ def reports_ids
15
+ [doc_type].flatten
16
+ end
17
+
18
+ def sub_report_class
19
+ Mercy::Report::DocTypeError
20
+ end
21
+
22
+ def key
23
+ :doc_type
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mercy
4
+ class Report
5
+ module Multiple
6
+ class Successes < Mercy::Report
7
+ include Mercy::Report::Multiple
8
+
9
+ DEFAULT_OPTION = {
10
+ doc_type: %i[a b]
11
+ }.freeze
12
+ expose :doc_type, case: :snake
13
+
14
+ def reports_ids
15
+ [doc_type].flatten
16
+ end
17
+
18
+ def sub_report_class
19
+ Mercy::Report::Success
20
+ end
21
+
22
+ def key
23
+ :doc_type
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mercy
4
+ class Report
5
+ class Success < Mercy::Report::Range
6
+ ALLOWED_PARAMETERS = %i[period minimum maximum].freeze
7
+ DEFAULT_OPTION = {
8
+ clazz: Document
9
+ }.freeze
10
+
11
+ expose :doc_type, case: :snake
12
+
13
+ def base
14
+ super.with_success.where(doc_type: doc_type)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
+ <%= javascript_include_tag 'application' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ APP_PATH = File.expand_path('../config/application', __dir__)
5
+ require_relative '../config/boot'
6
+ require 'rails/commands'
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../config/boot'
5
+ require 'rake'
6
+ Rake.application.run
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fileutils'
5
+ include FileUtils
6
+
7
+ # path to your application root.
8
+ APP_ROOT = File.expand_path('..', __dir__)
9
+
10
+ def system!(*args)
11
+ system(*args) || abort("\n== Command #{args} failed ==")
12
+ end
13
+
14
+ chdir APP_ROOT do
15
+ # This script is a starting point to setup your application.
16
+ # Add necessary setup steps to this file.
17
+
18
+ puts '== Installing dependencies =='
19
+ system! 'gem install bundler --conservative'
20
+ system('bundle check') || system!('bundle install')
21
+
22
+ # Install JavaScript dependencies if using Yarn
23
+ # system('bin/yarn')
24
+
25
+ # puts "\n== Copying sample files =="
26
+ # unless File.exist?('config/database.yml')
27
+ # cp 'config/database.yml.sample', 'config/database.yml'
28
+ # end
29
+
30
+ puts "\n== Preparing database =="
31
+ system! 'bin/rails db:setup'
32
+
33
+ puts "\n== Removing old logs and tempfiles =="
34
+ system! 'bin/rails log:clear tmp:clear'
35
+
36
+ puts "\n== Restarting application server =="
37
+ system! 'bin/rails restart'
38
+ end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fileutils'
5
+ include FileUtils
6
+
7
+ # path to your application root.
8
+ APP_ROOT = File.expand_path('..', __dir__)
9
+
10
+ def system!(*args)
11
+ system(*args) || abort("\n== Command #{args} failed ==")
12
+ end
13
+
14
+ chdir APP_ROOT do
15
+ # This script is a way to update your development environment automatically.
16
+ # Add necessary update steps to this file.
17
+
18
+ puts '== Installing dependencies =='
19
+ system! 'gem install bundler --conservative'
20
+ system('bundle check') || system!('bundle install')
21
+
22
+ # Install JavaScript dependencies if using Yarn
23
+ # system('bin/yarn')
24
+
25
+ puts "\n== Updating database =="
26
+ system! 'bin/rails db:migrate'
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! 'bin/rails log:clear tmp:clear'
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! 'bin/rails restart'
33
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ APP_ROOT = File.expand_path('..', __dir__)
5
+ Dir.chdir(APP_ROOT) do
6
+ exec 'yarnpkg', *ARGV
7
+ rescue Errno::ENOENT
8
+ warn 'Yarn executable was not detected in the system.'
9
+ warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
10
+ exit 1
11
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails/all'
6
+
7
+ Bundler.require(*Rails.groups)
8
+ require 'mercy'
9
+
10
+ module Dummy
11
+ class Application < Rails::Application
12
+ # Initialize configuration defaults for originally
13
+ # generated Rails version.
14
+ config.load_defaults 7.2
15
+
16
+ # Settings in config/environments/* take precedence over
17
+ # those specified here.
18
+ # Application configuration can go into files in
19
+ # config/initializers
20
+ # -- all .rb files in that directory are automatically
21
+ # loaded after loading
22
+ # the framework and any gems in your application.
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
5
+
6
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
7
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: dummy_production
@@ -0,0 +1,20 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+ database: ':memory:'
12
+
13
+ development:
14
+ <<: *default
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded on
7
+ # every request. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.enable_reloading = true
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ # Run rails dev:cache to toggle caching.
19
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
20
+ config.action_controller.perform_caching = true
21
+
22
+ config.cache_store = :memory_store
23
+ config.public_file_server.headers = {
24
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
25
+ }
26
+ else
27
+ config.action_controller.perform_caching = false
28
+
29
+ config.cache_store = :null_store
30
+ end
31
+
32
+ # Store uploaded files on the local file system (see config/storage.yml for options)
33
+ config.active_storage.service = :local
34
+
35
+ # Don't care if the mailer can't send.
36
+ config.action_mailer.raise_delivery_errors = false
37
+
38
+ config.action_mailer.perform_caching = false
39
+
40
+ # Print deprecation notices to the Rails logger.
41
+ config.active_support.deprecation = :log
42
+
43
+ # Raise an error on page load if there are pending migrations.
44
+ config.active_record.migration_error = :page_load
45
+
46
+ # Highlight code that triggered database queries in logs.
47
+ config.active_record.verbose_query_logs = true
48
+
49
+ # Raises error for missing translations
50
+ # config.action_view.raise_on_missing_translations = true
51
+
52
+ # Use an evented file watcher to asynchronously detect changes in source code,
53
+ # routes, locales, etc. This feature depends on the listen gem.
54
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
55
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over
5
+ # those in config/application.rb.
6
+
7
+ # Code is not reloaded between requests.
8
+ config.enable_reloading = false
9
+
10
+ # Eager load code on boot. This eager loads most of Rails and
11
+ # your application in memory, allowing both threaded web servers
12
+ # and those relying on copy on write to perform better.
13
+ # Rake tasks automatically ignore this option for performance.
14
+ config.eager_load = true
15
+
16
+ # Full error reports are disabled and caching is turned on.
17
+ config.consider_all_requests_local = false
18
+ config.action_controller.perform_caching = true
19
+
20
+ # Ensures that a master key has been made available in
21
+ # either ENV["RAILS_MASTER_KEY"] or in config/master.key.
22
+ # This key is used to decrypt credentials (and other encrypted files).
23
+ # config.require_master_key = true
24
+
25
+ # Disable serving static files from the `/public` folder by default since
26
+ # Apache or NGINX already handles this.
27
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
+
29
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
30
+ # config.action_controller.asset_host = 'http://assets.example.com'
31
+
32
+ # Specifies the header that your server uses for sending files.
33
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
34
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
35
+
36
+ # Store uploaded files on the local file system
37
+ # (see config/storage.yml for options)
38
+ config.active_storage.service = :local
39
+
40
+ # Mount Action Cable outside main process or domain
41
+ # config.action_cable.mount_path = nil
42
+ # config.action_cable.url = 'wss://example.com/cable'
43
+ # config.action_cable.allowed_request_origins = [
44
+ # 'http://example.com', /http:\/\/example.*/
45
+ # ]
46
+
47
+ # Force all access to the app over SSL, use
48
+ # Strict-Transport-Security, and use secure cookies.
49
+ # config.force_ssl = true
50
+
51
+ # Use the lowest log level to ensure availability of diagnostic information
52
+ # when problems arise.
53
+ config.log_level = :debug
54
+
55
+ # Prepend all log lines with the following tags.
56
+ config.log_tags = [:request_id]
57
+
58
+ # Use a different cache store in production.
59
+ # config.cache_store = :mem_cache_store
60
+
61
+ # Use a real queuing backend for Active Job
62
+ # (and separate queues per environment)
63
+ # config.active_job.queue_adapter = :resque
64
+ # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
65
+
66
+ config.action_mailer.perform_caching = false
67
+
68
+ # Ignore bad email addresses and do not raise email delivery errors.
69
+ # Set this to true and configure the email server for
70
+ # immediate delivery to raise delivery errors.
71
+ # config.action_mailer.raise_delivery_errors = false
72
+
73
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
74
+ # the I18n.default_locale when a translation cannot be found).
75
+ config.i18n.fallbacks = true
76
+
77
+ # Send deprecation notices to registered listeners.
78
+ config.active_support.deprecation = :notify
79
+
80
+ # Use default logging formatter so that PID and timestamp are not suppressed.
81
+ config.log_formatter = Logger::Formatter.new
82
+
83
+ # Use a different logger for distributed setups.
84
+ # require 'syslog/logger'
85
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
86
+
87
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
88
+ logger = ActiveSupport::Logger.new($stdout)
89
+ logger.formatter = config.log_formatter
90
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
91
+ end
92
+
93
+ # Do not dump schema after migrations.
94
+ config.active_record.dump_schema_after_migration = false
95
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over
5
+ # those in config/application.rb.
6
+
7
+ # The test environment is used exclusively to run your application's
8
+ # test suite. You never need to work with it otherwise. Remember that
9
+ # your test database is "scratch space" for the test suite and is wiped
10
+ # and recreated between test runs. Don't rely on the data there!
11
+ config.enable_reloading = false
12
+
13
+ # Do not eager load code on boot. This avoids loading
14
+ # your whole application
15
+ # just for the purpose of running a single test. If
16
+ # you are using a tool that
17
+ # preloads Rails for running tests, you may have to
18
+ # set it to true.
19
+ config.eager_load = false
20
+
21
+ # Configure public file server for tests with Cache-Control for performance.
22
+ config.public_file_server.enabled = true
23
+ config.public_file_server.headers = {
24
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
25
+ }
26
+
27
+ # Show full error reports and disable caching.
28
+ config.consider_all_requests_local = true
29
+ config.action_controller.perform_caching = false
30
+
31
+ # Raise exceptions instead of rendering exception templates.
32
+ config.action_dispatch.show_exceptions = :none
33
+
34
+ # Disable request forgery protection in test environment.
35
+ config.action_controller.allow_forgery_protection = false
36
+
37
+ # Store uploaded files on the local file system in a temporary directory
38
+ config.active_storage.service = :test
39
+
40
+ config.action_mailer.perform_caching = false
41
+
42
+ # Tell Action Mailer not to deliver emails to the real world.
43
+ # The :test delivery method accumulates sent emails in the
44
+ # ActionMailer::Base.deliveries array.
45
+ config.action_mailer.delivery_method = :test
46
+
47
+ # Print deprecation notices to the stderr.
48
+ config.active_support.deprecation = :stderr
49
+
50
+ # Raises error for missing translations
51
+ # config.action_view.raise_on_missing_translations = true
52
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # ActiveSupport::Reloader.to_prepare do
6
+ # ApplicationController.renderer.defaults.merge!(
7
+ # http_host: 'example.org',
8
+ # https: false
9
+ # )
10
+ # end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
7
+
8
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
9
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Define an application-wide content security policy
6
+ # For further information see the following documentation
7
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
8
+
9
+ # Rails.application.config.content_security_policy do |policy|
10
+ # policy.default_src :self, :https
11
+ # policy.font_src :self, :https, :data
12
+ # policy.img_src :self, :https, :data
13
+ # policy.object_src :none
14
+ # policy.script_src :self, :https
15
+ # policy.style_src :self, :https
16
+
17
+ # # Specify URI for violation reports
18
+ # # policy.report_uri "/csp-violation-report-endpoint"
19
+ # end
20
+
21
+ # If you are using UJS then enable automatic nonce generation
22
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
23
+
24
+ # Report CSP violations to a specified URI
25
+ # For further information see the following documentation:
26
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
27
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Specify a serializer for the signed and encrypted cookie jars.
6
+ # Valid options are :json, :marshal, and :hybrid.
7
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Configure sensitive parameters which will be filtered from the log file.
6
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Add new inflection rules using the following format. Inflections
6
+ # are locale specific, and you may define rules for as many different
7
+ # locales as you wish. All of these examples are active by default:
8
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
9
+ # inflect.plural /^(ox)$/i, '\1en'
10
+ # inflect.singular /^(ox)en/i, '\1'
11
+ # inflect.irregular 'person', 'people'
12
+ # inflect.uncountable %w( fish sheep )
13
+ # end
14
+
15
+ # These inflection rules are supported but not enabled by default:
16
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
17
+ # inflect.acronym 'RESTful'
18
+ # end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Add new mime types for use in respond_to blocks:
6
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # This file contains settings for ActionController::ParamsWrapper which
6
+ # is enabled by default.
7
+
8
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9
+ ActiveSupport.on_load(:action_controller) do
10
+ wrap_parameters format: [:json]
11
+ end
12
+
13
+ # To enable root element in JSON for ActiveRecord objects.
14
+ # ActiveSupport.on_load(:active_record) do
15
+ # self.include_root_in_json = true
16
+ # end