Skip to content

Commit 1bd6c25

Browse files
committed
bin/rails app:update fully accepted changes
1 parent aff5178 commit 1bd6c25

File tree

10 files changed

+181
-39
lines changed

10 files changed

+181
-39
lines changed

bin/rubocop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env ruby
2+
require "rubygems"
3+
require "bundler/setup"
4+
5+
# explicit rubocop config increases performance slightly while avoiding config confusion.
6+
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
7+
8+
load Gem.bin_path("rubocop", "rubocop")

bin/setup

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env ruby
22
require "fileutils"
33

4-
# path to your application root.
54
APP_ROOT = File.expand_path("..", __dir__)
5+
APP_NAME = "timdex"
66

77
def system!(*args)
88
system(*args, exception: true)
@@ -30,4 +30,8 @@ FileUtils.chdir APP_ROOT do
3030

3131
puts "\n== Restarting application server =="
3232
system! "bin/rails restart"
33+
34+
# puts "\n== Configuring puma-dev =="
35+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
36+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
3337
end

config/initializers/assets.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
# Precompile additional assets.
1010
# application.js, application.css, and all non-JS/CSS in the app/assets
1111
# folder are already added.
12-
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
12+
# Rails.application.config.assets.precompile += %w[ admin.js admin.css ]

config/initializers/filter_parameter_logging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Use this to limit dissemination of sensitive information.
55
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
66
Rails.application.config.filter_parameters += [
7-
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
7+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
88
]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Be sure to restart your server when you modify this file.
2+
#
3+
# This file eases your Rails 7.2 framework defaults upgrade.
4+
#
5+
# Uncomment each configuration one by one to switch to the new default.
6+
# Once your application is ready to run with all new defaults, you can remove
7+
# this file and set the `config.load_defaults` to `7.2`.
8+
#
9+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
10+
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11+
12+
###
13+
# Controls whether Active Job's `#perform_later` and similar methods automatically defer
14+
# the job queuing to after the current Active Record transaction is committed.
15+
#
16+
# Example:
17+
# Topic.transaction do
18+
# topic = Topic.create(...)
19+
# NewTopicNotificationJob.perform_later(topic)
20+
# end
21+
#
22+
# In this example, if the configuration is set to `:never`, the job will
23+
# be enqueued immediately, even though the `Topic` hasn't been committed yet.
24+
# Because of this, if the job is picked up almost immediately, or if the
25+
# transaction doesn't succeed for some reason, the job will fail to find this
26+
# topic in the database.
27+
#
28+
# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter
29+
# will define the behaviour.
30+
#
31+
# Note: Active Job backends can disable this feature. This is generally done by
32+
# backends that use the same database as Active Record as a queue, hence they
33+
# don't need this feature.
34+
#++
35+
# Rails.application.config.active_job.enqueue_after_transaction_commit = :default
36+
37+
###
38+
# Adds image/webp to the list of content types Active Storage considers as an image
39+
# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png.
40+
# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support
41+
# WebP. Requires imagemagick/libvips built with WebP support.
42+
#++
43+
# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp]
44+
45+
###
46+
# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError
47+
# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp
48+
# associated with the current time. This is done to prevent forward-dating of migration files, which can
49+
# impact migration generation and other migration commands.
50+
#
51+
# Applications with existing timestamped migrations that do not adhere to the
52+
# expected format can disable validation by setting this config to `false`.
53+
#++
54+
# Rails.application.config.active_record.validate_migration_timestamps = true
55+
56+
###
57+
# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries.
58+
#
59+
# Example:
60+
# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date
61+
#
62+
# This query used to return a `String`.
63+
#++
64+
# Rails.application.config.active_record.postgresql_adapter_decode_dates = true
65+
66+
###
67+
# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are
68+
# deploying to a memory constrained environment you may want to set this to `false`.
69+
#++
70+
# Rails.application.config.yjit = true

config/puma.rb

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,34 @@
1-
# Puma can serve each request in a thread from an internal thread pool.
2-
# The `threads` method setting takes two numbers: a minimum and maximum.
3-
# Any libraries that use thread pools should be configured to match
4-
# the maximum value specified for Puma. Default is set to 5 threads for minimum
5-
# and maximum; this matches the default thread size of Active Record.
6-
#
7-
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8-
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9-
threads min_threads_count, max_threads_count
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.
104

11-
# Specifies the `worker_timeout` threshold that Puma will use to wait before
12-
# terminating a worker in development environments.
5+
# Puma starts a configurable number of processes (workers) and each process
6+
# serves each request in a thread from an internal thread pool.
137
#
14-
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
15-
16-
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
8+
# The ideal number of threads per worker depends both on how much time the
9+
# application spends waiting for IO operations and on how much you wish to
10+
# to prioritize throughput over latency.
1711
#
18-
port ENV.fetch("PORT") { 3000 }
19-
20-
# Specifies the `environment` that Puma will run in.
12+
# As a rule of thumb, increasing the number of threads will increase how much
13+
# traffic a given process can handle (throughput), but due to CRuby's
14+
# Global VM Lock (GVL) it has diminishing returns and will degrade the
15+
# response time (latency) of the application.
2116
#
22-
environment ENV.fetch("RAILS_ENV") { "development" }
23-
24-
# Specifies the `pidfile` that Puma will use.
25-
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
26-
27-
# Specifies the number of `workers` to boot in clustered mode.
28-
# Workers are forked web server processes. If using threads and workers together
29-
# the concurrency of the application would be max `threads` * `workers`.
30-
# Workers do not work on JRuby or Windows (both of which do not support
31-
# processes).
17+
# The default is set to 3 threads as it's deemed a decent compromise between
18+
# throughput and latency for the average Rails application.
3219
#
33-
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
20+
# Any libraries that use a connection pool or another resource pool should
21+
# be configured to provide at least as many connections as the number of
22+
# threads. This includes Active Record's `pool` parameter in `database.yml`.
23+
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
24+
threads threads_count, threads_count
3425

35-
# Use the `preload_app!` method when specifying a `workers` number.
36-
# This directive tells Puma to first boot the application and load code
37-
# before forking the application. This takes advantage of Copy On Write
38-
# process behavior so workers use less memory.
39-
#
40-
# preload_app!
26+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
27+
port ENV.fetch("PORT", 3000)
4128

42-
# Allow puma to be restarted by `rails restart` command.
29+
# Allow puma to be restarted by `bin/rails restart` command.
4330
plugin :tmp_restart
31+
32+
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
33+
# In other environments, only set the PID file if requested.
34+
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Your browser is not supported (406)</title>
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<style>
7+
.rails-default-error-page {
8+
background-color: #EFEFEF;
9+
color: #2E2F30;
10+
text-align: center;
11+
font-family: arial, sans-serif;
12+
margin: 0;
13+
}
14+
15+
.rails-default-error-page div.dialog {
16+
width: 95%;
17+
max-width: 33em;
18+
margin: 4em auto 0;
19+
}
20+
21+
.rails-default-error-page div.dialog > div {
22+
border: 1px solid #CCC;
23+
border-right-color: #999;
24+
border-left-color: #999;
25+
border-bottom-color: #BBB;
26+
border-top: #B00100 solid 4px;
27+
border-top-left-radius: 9px;
28+
border-top-right-radius: 9px;
29+
background-color: white;
30+
padding: 7px 12% 0;
31+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32+
}
33+
34+
.rails-default-error-page h1 {
35+
font-size: 100%;
36+
color: #730E15;
37+
line-height: 1.5em;
38+
}
39+
40+
.rails-default-error-page div.dialog > p {
41+
margin: 0 0 1em;
42+
padding: 1em;
43+
background-color: #F7F7F7;
44+
border: 1px solid #CCC;
45+
border-right-color: #999;
46+
border-left-color: #999;
47+
border-bottom-color: #999;
48+
border-bottom-left-radius: 4px;
49+
border-bottom-right-radius: 4px;
50+
border-top-color: #DADADA;
51+
color: #666;
52+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53+
}
54+
</style>
55+
</head>
56+
57+
<body class="rails-default-error-page">
58+
<!-- This file lives in public/406-unsupported-browser.html -->
59+
<div class="dialog">
60+
<div>
61+
<h1>Your browser is not supported.</h1>
62+
<p>Please upgrade your browser to continue.</p>
63+
</div>
64+
</div>
65+
</body>
66+
</html>

public/icon.png

5.47 KB
Loading

public/icon.svg

Lines changed: 3 additions & 0 deletions
Loading

public/robots.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
1+
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file

0 commit comments

Comments
 (0)