morty 0.0.1 → 0.1.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.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +12 -0
- data/.github/workflows/ci.yml +107 -0
- data/.gitignore +17 -3
- data/.rubocop.yml +20 -0
- data/Appraisals +24 -0
- data/Gemfile +28 -1
- data/LICENSE +21 -0
- data/README.md +37 -7
- data/Rakefile +37 -0
- data/app/models/morty/account.rb +37 -0
- data/app/models/morty/account_type.rb +7 -0
- data/app/models/morty/activity.rb +147 -0
- data/app/models/morty/activity_type.rb +7 -0
- data/app/models/morty/application_record.rb +6 -0
- data/app/models/morty/entry.rb +24 -0
- data/app/models/morty/entry_type.rb +23 -0
- data/app/models/morty/ledger.rb +8 -0
- data/config/routes.rb +2 -0
- data/config.ru +7 -0
- data/cucumber.yml +2 -0
- data/db/migrate/20260224063053_create_morty_schema.rb +17 -0
- data/db/seeds.rb +18 -0
- data/db/sql/create_morty_schema.sql +479 -0
- data/features/accountant.feature +47 -0
- data/features/adjustment.feature +79 -0
- data/features/cancel.feature +130 -0
- data/features/daily.feature +42 -0
- data/features/default.feature +33 -0
- data/features/ledger.feature +57 -0
- data/features/retroactive.feature +92 -0
- data/features/return.feature +112 -0
- data/features/reversal.feature +57 -0
- data/features/simulation.feature +128 -0
- data/features/support/accountants/adjusting_accountant.rb +34 -0
- data/features/support/accountants/daily_accountant.rb +13 -0
- data/features/support/accountants/default_accountant.rb +2 -0
- data/features/support/accountants/defaulting_accountant.rb +32 -0
- data/features/support/accountants/multiple_ledgers_accountant.rb +51 -0
- data/features/support/accountants/simulating_accountant.rb +36 -0
- data/features/support/accountants/sourceless_accountant.rb +2 -0
- data/features/support/accountants/waterfalling_accountant.rb +15 -0
- data/features/support/env.rb +17 -0
- data/features/waterfall.feature +34 -0
- data/gemfiles/rails_7.0.gemfile +30 -0
- data/gemfiles/rails_7.0.gemfile.lock +494 -0
- data/gemfiles/rails_7.1.gemfile +30 -0
- data/gemfiles/rails_7.1.gemfile.lock +543 -0
- data/gemfiles/rails_7.2.gemfile +30 -0
- data/gemfiles/rails_7.2.gemfile.lock +539 -0
- data/gemfiles/rails_8.0.gemfile +30 -0
- data/gemfiles/rails_8.0.gemfile.lock +536 -0
- data/gemfiles/rails_8.1.gemfile +30 -0
- data/gemfiles/rails_8.1.gemfile.lock +538 -0
- data/lib/morty/accountant.rb +332 -0
- data/lib/morty/adjustment.rb +64 -0
- data/lib/morty/book.rb +54 -0
- data/lib/morty/context/activity.rb +52 -0
- data/lib/morty/context/daily.rb +23 -0
- data/lib/morty/context/simulation.rb +26 -0
- data/lib/morty/cucumber/helpers.rb +27 -0
- data/lib/morty/cucumber/steps.rb +191 -0
- data/lib/morty/diff.rb +71 -0
- data/lib/morty/dsl.rb +86 -0
- data/lib/morty/engine.rb +21 -0
- data/lib/morty/error.rb +3 -0
- data/lib/morty/event.rb +27 -0
- data/lib/morty/list/activity.rb +57 -0
- data/lib/morty/rate.rb +59 -0
- data/lib/morty/schedule.rb +36 -0
- data/lib/morty/seed.rb +60 -0
- data/lib/morty/source.rb +19 -0
- data/lib/morty/tasks/morty_tasks.rake +4 -0
- data/lib/morty/version.rb +1 -1
- data/lib/morty.rb +27 -1
- data/morty.gemspec +22 -19
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +28 -0
- data/spec/dummy/app/views/pwa/manifest.json.erb +22 -0
- data/spec/dummy/app/views/pwa/service-worker.js +26 -0
- data/spec/dummy/bin/ci +6 -0
- data/spec/dummy/bin/dev +2 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +35 -0
- data/spec/dummy/config/application.rb +48 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/ci.rb +15 -0
- data/spec/dummy/config/database.yml +15 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +47 -0
- data/spec/dummy/config/environments/test.rb +53 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +29 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/locales/en.yml +31 -0
- data/spec/dummy/config/puma.rb +39 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/storage.yml +27 -0
- data/spec/dummy/config.ru +6 -0
- data/spec/dummy/db/seeds.rb +52 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/400.html +135 -0
- data/spec/dummy/public/404.html +135 -0
- data/spec/dummy/public/406-unsupported-browser.html +135 -0
- data/spec/dummy/public/422.html +135 -0
- data/spec/dummy/public/500.html +135 -0
- data/spec/dummy/public/icon.png +0 -0
- data/spec/dummy/public/icon.svg +3 -0
- data/spec/lib/accountant_spec.rb +236 -0
- data/spec/lib/book_spec.rb +91 -0
- data/spec/lib/diff_spec.rb +102 -0
- data/spec/lib/event_spec.rb +53 -0
- data/spec/lib/list/activity_spec.rb +117 -0
- data/spec/lib/schedule_spec.rb +106 -0
- data/spec/lib/source_spec.rb +31 -0
- data/spec/models/account_spec.rb +48 -0
- data/spec/models/activity_spec.rb +139 -0
- data/spec/models/entry_spec.rb +41 -0
- data/spec/models/entry_type_spec.rb +43 -0
- data/spec/rate_spec.rb +83 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/support/test_helpers.rb +25 -0
- metadata +193 -16
- data/LICENSE.txt +0 -22
data/morty.gemspec
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'morty/version'
|
|
1
|
+
require_relative "lib/morty/version"
|
|
5
2
|
|
|
6
|
-
Gem::Specification.new do |
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = "morty"
|
|
5
|
+
s.version = Morty::VERSION
|
|
6
|
+
s.authors = ["Erik Peterson"]
|
|
7
|
+
s.email = ["thecompanygardener@gmail.com"]
|
|
8
|
+
s.summary = %q{Morty is an accountant}
|
|
9
|
+
s.description = %q{}
|
|
10
|
+
s.homepage = "https://github.com/companygardener/morty"
|
|
11
|
+
s.license = "MIT"
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
spec.require_paths = ["lib"]
|
|
13
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?("bin/") }
|
|
14
|
+
s.executables = []
|
|
15
|
+
s.require_paths = ["lib"]
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
s.metadata["homepage_uri"] = s.homepage
|
|
18
|
+
s.metadata["source_code_uri"] = "https://github.com/companygardener/morty"
|
|
19
|
+
s.add_dependency "railties", ">= 7.0"
|
|
20
|
+
s.add_dependency "activerecord", ">= 7.0"
|
|
21
|
+
s.add_dependency "lookup_by"
|
|
22
|
+
s.add_dependency "colorize"
|
|
23
|
+
|
|
24
|
+
s.add_development_dependency "bundler", "~> 4.0"
|
|
25
|
+
s.add_development_dependency "rake" , "> 10.0"
|
|
23
26
|
end
|
data/spec/dummy/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
|
4
|
+
|
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
|
7
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title><%= content_for(:title) || "Dummy" %></title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
+
<meta name="application-name" content="Dummy">
|
|
8
|
+
<meta name="mobile-web-app-capable" content="yes">
|
|
9
|
+
<%= csrf_meta_tags %>
|
|
10
|
+
<%= csp_meta_tag %>
|
|
11
|
+
|
|
12
|
+
<%= yield :head %>
|
|
13
|
+
|
|
14
|
+
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
15
|
+
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
16
|
+
|
|
17
|
+
<link rel="icon" href="/icon.png" type="image/png">
|
|
18
|
+
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
|
19
|
+
<link rel="apple-touch-icon" href="/icon.png">
|
|
20
|
+
|
|
21
|
+
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
|
22
|
+
<%= stylesheet_link_tag :app %>
|
|
23
|
+
</head>
|
|
24
|
+
|
|
25
|
+
<body>
|
|
26
|
+
<%= yield %>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Dummy",
|
|
3
|
+
"icons": [
|
|
4
|
+
{
|
|
5
|
+
"src": "/icon.png",
|
|
6
|
+
"type": "image/png",
|
|
7
|
+
"sizes": "512x512"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"src": "/icon.png",
|
|
11
|
+
"type": "image/png",
|
|
12
|
+
"sizes": "512x512",
|
|
13
|
+
"purpose": "maskable"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"start_url": "/",
|
|
17
|
+
"display": "standalone",
|
|
18
|
+
"scope": "/",
|
|
19
|
+
"description": "Dummy.",
|
|
20
|
+
"theme_color": "red",
|
|
21
|
+
"background_color": "red"
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Add a service worker for processing Web Push notifications:
|
|
2
|
+
//
|
|
3
|
+
// self.addEventListener("push", async (event) => {
|
|
4
|
+
// const { title, options } = await event.data.json()
|
|
5
|
+
// event.waitUntil(self.registration.showNotification(title, options))
|
|
6
|
+
// })
|
|
7
|
+
//
|
|
8
|
+
// self.addEventListener("notificationclick", function(event) {
|
|
9
|
+
// event.notification.close()
|
|
10
|
+
// event.waitUntil(
|
|
11
|
+
// clients.matchAll({ type: "window" }).then((clientList) => {
|
|
12
|
+
// for (let i = 0; i < clientList.length; i++) {
|
|
13
|
+
// let client = clientList[i]
|
|
14
|
+
// let clientPath = (new URL(client.url)).pathname
|
|
15
|
+
//
|
|
16
|
+
// if (clientPath == event.notification.data.path && "focus" in client) {
|
|
17
|
+
// return client.focus()
|
|
18
|
+
// }
|
|
19
|
+
// }
|
|
20
|
+
//
|
|
21
|
+
// if (clients.openWindow) {
|
|
22
|
+
// return clients.openWindow(event.notification.data.path)
|
|
23
|
+
// }
|
|
24
|
+
// })
|
|
25
|
+
// )
|
|
26
|
+
// })
|
data/spec/dummy/bin/ci
ADDED
data/spec/dummy/bin/dev
ADDED
data/spec/dummy/bin/rake
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require "fileutils"
|
|
3
|
+
|
|
4
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
|
5
|
+
|
|
6
|
+
def system!(*args)
|
|
7
|
+
system(*args, exception: true)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
FileUtils.chdir APP_ROOT do
|
|
11
|
+
# This script is a way to set up or update your development environment automatically.
|
|
12
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
|
13
|
+
# Add necessary setup steps to this file.
|
|
14
|
+
|
|
15
|
+
puts "== Installing dependencies =="
|
|
16
|
+
system("bundle check") || system!("bundle install")
|
|
17
|
+
|
|
18
|
+
# puts "\n== Copying sample files =="
|
|
19
|
+
# unless File.exist?("config/database.yml")
|
|
20
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
|
21
|
+
# end
|
|
22
|
+
|
|
23
|
+
puts "\n== Preparing database =="
|
|
24
|
+
system! "bin/rails db:prepare"
|
|
25
|
+
system! "bin/rails db:reset" if ARGV.include?("--reset")
|
|
26
|
+
|
|
27
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
28
|
+
system! "bin/rails log:clear tmp:clear"
|
|
29
|
+
|
|
30
|
+
unless ARGV.include?("--skip-server")
|
|
31
|
+
puts "\n== Starting development server =="
|
|
32
|
+
STDOUT.flush # flush the output before exec(2) so that it displays
|
|
33
|
+
exec "bin/dev"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require_relative "boot"
|
|
2
|
+
|
|
3
|
+
require "rails"
|
|
4
|
+
|
|
5
|
+
# Pick the frameworks you want:
|
|
6
|
+
require "active_model/railtie"
|
|
7
|
+
require "active_record/railtie"
|
|
8
|
+
require "active_job/railtie"
|
|
9
|
+
# require "active_storage/engine"
|
|
10
|
+
require "action_controller/railtie"
|
|
11
|
+
# require "action_mailer/railtie"
|
|
12
|
+
# require "action_mailbox/engine"
|
|
13
|
+
# require "action_text/engine"
|
|
14
|
+
# require "action_view/railtie"
|
|
15
|
+
# require "action_cable/engine"
|
|
16
|
+
# require "rails/test_unit/railtie"
|
|
17
|
+
|
|
18
|
+
# Require the gems listed in Gemfile, including any gems
|
|
19
|
+
# you've limited to :test, :development, or :production.
|
|
20
|
+
Bundler.require(*Rails.groups)
|
|
21
|
+
require "morty"
|
|
22
|
+
|
|
23
|
+
module Dummy
|
|
24
|
+
class Application < Rails::Application
|
|
25
|
+
config.load_defaults Rails::VERSION::STRING.to_f
|
|
26
|
+
|
|
27
|
+
# For compatibility with applications that use this config
|
|
28
|
+
config.action_controller.include_all_helpers = false
|
|
29
|
+
|
|
30
|
+
config.autoload_lib(ignore: %w[assets tasks]) if config.respond_to?(:autoload_lib)
|
|
31
|
+
|
|
32
|
+
# Configuration for the application, engines, and railties goes here.
|
|
33
|
+
#
|
|
34
|
+
# These settings can be overridden in specific environments using the files
|
|
35
|
+
# in config/environments, which are processed later.
|
|
36
|
+
#
|
|
37
|
+
# config.time_zone = "Central Time (US & Canada)"
|
|
38
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
|
39
|
+
|
|
40
|
+
# Don't generate system test files.
|
|
41
|
+
config.generators.system_tests = nil
|
|
42
|
+
|
|
43
|
+
# Use SQL format for schema dumps (required for PostgreSQL schemas, triggers, functions)
|
|
44
|
+
config.active_record.schema_format = :sql
|
|
45
|
+
config.active_record.dump_schemas = "morty,morty_archive"
|
|
46
|
+
config.active_record.dump_schema_after_migration = false
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Run using bin/ci
|
|
2
|
+
|
|
3
|
+
CI.run do
|
|
4
|
+
step "Setup", "bin/setup --skip-server"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Optional: set a green GitHub commit status to unblock PR merge.
|
|
9
|
+
# Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
|
|
10
|
+
# if success?
|
|
11
|
+
# step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
|
|
12
|
+
# else
|
|
13
|
+
# failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
|
|
14
|
+
# end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
default: &default
|
|
2
|
+
adapter: postgresql
|
|
3
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5) %>
|
|
4
|
+
schema_search_path: morty,morty_archive,public
|
|
5
|
+
host: <%= ENV.fetch("PGHOST", "localhost") %>
|
|
6
|
+
username: <%= ENV.fetch("PGUSER", ENV["USER"]) %>
|
|
7
|
+
password: <%= ENV.fetch("PGPASSWORD", "") %>
|
|
8
|
+
|
|
9
|
+
development:
|
|
10
|
+
<<: *default
|
|
11
|
+
database: morty_development
|
|
12
|
+
|
|
13
|
+
test:
|
|
14
|
+
<<: *default
|
|
15
|
+
database: morty_test
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
|
2
|
+
|
|
3
|
+
Rails.application.configure do
|
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
|
+
|
|
6
|
+
# Make code changes take effect immediately without server restart.
|
|
7
|
+
config.enable_reloading = true
|
|
8
|
+
|
|
9
|
+
# Do not eager load code on boot.
|
|
10
|
+
config.eager_load = false
|
|
11
|
+
|
|
12
|
+
# Show full error reports.
|
|
13
|
+
config.consider_all_requests_local = true
|
|
14
|
+
|
|
15
|
+
# Enable server timing.
|
|
16
|
+
config.server_timing = true
|
|
17
|
+
|
|
18
|
+
# Change to :null_store to avoid any caching.
|
|
19
|
+
config.cache_store = :memory_store
|
|
20
|
+
|
|
21
|
+
# Print deprecation notices to the Rails logger.
|
|
22
|
+
config.active_support.deprecation = :log
|
|
23
|
+
|
|
24
|
+
# Raise an error on page load if there are pending migrations.
|
|
25
|
+
config.active_record.migration_error = :page_load
|
|
26
|
+
|
|
27
|
+
# Highlight code that triggered database queries in logs.
|
|
28
|
+
config.active_record.verbose_query_logs = true
|
|
29
|
+
|
|
30
|
+
# Append comments with runtime information tags to SQL queries in logs.
|
|
31
|
+
config.active_record.query_log_tags_enabled = true
|
|
32
|
+
|
|
33
|
+
# Highlight code that enqueued background job in logs.
|
|
34
|
+
# config.active_job.verbose_enqueue_logs = true
|
|
35
|
+
|
|
36
|
+
# Highlight code that triggered redirect in logs.
|
|
37
|
+
config.action_dispatch.verbose_redirect_logs = true
|
|
38
|
+
|
|
39
|
+
# Raises error for missing translations.
|
|
40
|
+
# config.i18n.raise_on_missing_translations = true
|
|
41
|
+
|
|
42
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
|
43
|
+
# config.action_cable.disable_request_forgery_protection = true
|
|
44
|
+
|
|
45
|
+
# Raise error when a before_action's only/except options reference missing actions (Rails 7.1+).
|
|
46
|
+
config.action_controller.raise_on_missing_callback_actions = true if Rails::VERSION::MAJOR >= 8 || (Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR >= 1)
|
|
47
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# The test environment is used exclusively to run your application's
|
|
2
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
3
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
4
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
5
|
+
|
|
6
|
+
Rails.application.configure do
|
|
7
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
8
|
+
|
|
9
|
+
# While tests run files are not watched, reloading is not necessary.
|
|
10
|
+
config.enable_reloading = false
|
|
11
|
+
|
|
12
|
+
# Eager loading loads your entire application. When running a single test locally,
|
|
13
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
|
14
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
|
15
|
+
# loading is working properly before deploying your code.
|
|
16
|
+
config.eager_load = ENV["CI"].present?
|
|
17
|
+
|
|
18
|
+
# Configure public file server for tests with cache-control for performance.
|
|
19
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
|
20
|
+
|
|
21
|
+
# Show full error reports.
|
|
22
|
+
config.consider_all_requests_local = true
|
|
23
|
+
config.cache_store = :null_store
|
|
24
|
+
|
|
25
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
|
26
|
+
config.action_dispatch.show_exceptions = :rescuable
|
|
27
|
+
|
|
28
|
+
# Disable request forgery protection in test environment.
|
|
29
|
+
config.action_controller.allow_forgery_protection = false
|
|
30
|
+
|
|
31
|
+
# # Store uploaded files on the local file system in a temporary directory.
|
|
32
|
+
# config.active_storage.service = :test
|
|
33
|
+
|
|
34
|
+
# # Tell Action Mailer not to deliver emails to the real world.
|
|
35
|
+
# # The :test delivery method accumulates sent emails in the
|
|
36
|
+
# # ActionMailer::Base.deliveries array.
|
|
37
|
+
# config.action_mailer.delivery_method = :test
|
|
38
|
+
|
|
39
|
+
# # Set host to be used by links generated in mailer templates.
|
|
40
|
+
# config.action_mailer.default_url_options = { host: "example.com" }
|
|
41
|
+
|
|
42
|
+
# Print deprecation notices to the stderr.
|
|
43
|
+
config.active_support.deprecation = :stderr
|
|
44
|
+
|
|
45
|
+
# Raises error for missing translations.
|
|
46
|
+
# config.i18n.raise_on_missing_translations = true
|
|
47
|
+
|
|
48
|
+
# Annotate rendered view with file names.
|
|
49
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
50
|
+
|
|
51
|
+
# Raise error when a before_action's only/except options reference missing actions (Rails 7.1+).
|
|
52
|
+
config.action_controller.raise_on_missing_callback_actions = true if Rails::VERSION::MAJOR >= 8 || (Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR >= 1)
|
|
53
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Define an application-wide content security policy.
|
|
4
|
+
# See the Securing Rails Applications Guide for more information:
|
|
5
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
|
6
|
+
|
|
7
|
+
# Rails.application.configure do
|
|
8
|
+
# config.content_security_policy do |policy|
|
|
9
|
+
# policy.default_src :self, :https
|
|
10
|
+
# policy.font_src :self, :https, :data
|
|
11
|
+
# policy.img_src :self, :https, :data
|
|
12
|
+
# policy.object_src :none
|
|
13
|
+
# policy.script_src :self, :https
|
|
14
|
+
# policy.style_src :self, :https
|
|
15
|
+
# # Specify URI for violation reports
|
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
|
20
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
|
22
|
+
#
|
|
23
|
+
# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
|
|
24
|
+
# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
|
|
25
|
+
# # config.content_security_policy_nonce_auto = true
|
|
26
|
+
#
|
|
27
|
+
# # Report violations without enforcing the policy.
|
|
28
|
+
# # config.content_security_policy_report_only = true
|
|
29
|
+
# end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
|
4
|
+
# Use this to limit dissemination of sensitive information.
|
|
5
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
|
6
|
+
Rails.application.config.filter_parameters += [
|
|
7
|
+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
|
8
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
|
4
|
+
# are locale specific, and you may define rules for as many different
|
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
7
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
|
8
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
|
9
|
+
# inflect.irregular "person", "people"
|
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
15
|
+
# inflect.acronym "RESTful"
|
|
16
|
+
# end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Files in the config/locales directory are used for internationalization and
|
|
2
|
+
# are automatically loaded by Rails. If you want to use locales other than
|
|
3
|
+
# English, add the necessary files in this directory.
|
|
4
|
+
#
|
|
5
|
+
# To use the locales, use `I18n.t`:
|
|
6
|
+
#
|
|
7
|
+
# I18n.t "hello"
|
|
8
|
+
#
|
|
9
|
+
# In views, this is aliased to just `t`:
|
|
10
|
+
#
|
|
11
|
+
# <%= t("hello") %>
|
|
12
|
+
#
|
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
|
14
|
+
#
|
|
15
|
+
# I18n.locale = :es
|
|
16
|
+
#
|
|
17
|
+
# This would use the information in config/locales/es.yml.
|
|
18
|
+
#
|
|
19
|
+
# To learn more about the API, please read the Rails Internationalization guide
|
|
20
|
+
# at https://guides.rubyonrails.org/i18n.html.
|
|
21
|
+
#
|
|
22
|
+
# Be aware that YAML interprets the following case-insensitive strings as
|
|
23
|
+
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
|
24
|
+
# must be quoted to be interpreted as strings. For example:
|
|
25
|
+
#
|
|
26
|
+
# en:
|
|
27
|
+
# "yes": yup
|
|
28
|
+
# enabled: "ON"
|
|
29
|
+
|
|
30
|
+
en:
|
|
31
|
+
hello: "Hello world"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# This configuration file will be evaluated by Puma. The top-level methods that
|
|
2
|
+
# are invoked here are part of Puma's configuration DSL. For more information
|
|
3
|
+
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
|
4
|
+
#
|
|
5
|
+
# Puma starts a configurable number of processes (workers) and each process
|
|
6
|
+
# serves each request in a thread from an internal thread pool.
|
|
7
|
+
#
|
|
8
|
+
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
|
9
|
+
# should only set this value when you want to run 2 or more workers. The
|
|
10
|
+
# default is already 1. You can set it to `auto` to automatically start a worker
|
|
11
|
+
# for each available processor.
|
|
12
|
+
#
|
|
13
|
+
# The ideal number of threads per worker depends both on how much time the
|
|
14
|
+
# application spends waiting for IO operations and on how much you wish to
|
|
15
|
+
# prioritize throughput over latency.
|
|
16
|
+
#
|
|
17
|
+
# As a rule of thumb, increasing the number of threads will increase how much
|
|
18
|
+
# traffic a given process can handle (throughput), but due to CRuby's
|
|
19
|
+
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
|
20
|
+
# response time (latency) of the application.
|
|
21
|
+
#
|
|
22
|
+
# The default is set to 3 threads as it's deemed a decent compromise between
|
|
23
|
+
# throughput and latency for the average Rails application.
|
|
24
|
+
#
|
|
25
|
+
# Any libraries that use a connection pool or another resource pool should
|
|
26
|
+
# be configured to provide at least as many connections as the number of
|
|
27
|
+
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
|
28
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
|
29
|
+
threads threads_count, threads_count
|
|
30
|
+
|
|
31
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
|
32
|
+
port ENV.fetch("PORT", 3000)
|
|
33
|
+
|
|
34
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
|
35
|
+
plugin :tmp_restart
|
|
36
|
+
|
|
37
|
+
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
|
38
|
+
# In other environments, only set the PID file if requested.
|
|
39
|
+
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
test:
|
|
2
|
+
service: Disk
|
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
|
4
|
+
|
|
5
|
+
local:
|
|
6
|
+
service: Disk
|
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
|
8
|
+
|
|
9
|
+
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
|
10
|
+
# amazon:
|
|
11
|
+
# service: S3
|
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
|
14
|
+
# region: us-east-1
|
|
15
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
|
16
|
+
|
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
|
18
|
+
# google:
|
|
19
|
+
# service: GCS
|
|
20
|
+
# project: your_project
|
|
21
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
|
22
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
|
23
|
+
|
|
24
|
+
# mirror:
|
|
25
|
+
# service: Mirror
|
|
26
|
+
# primary: local
|
|
27
|
+
# mirrors: [ amazon, google, microsoft ]
|