Skip to content

Commit

Permalink
Rails app:update changes
Browse files Browse the repository at this point in the history
  • Loading branch information
minhngocd committed Sep 16, 2024
1 parent 87fcbaa commit 444210c
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 50 deletions.
6 changes: 5 additions & 1 deletion bin/setup
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
require "fileutils"

# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
APP_NAME = "contacts"

def system!(*args)
system(*args, exception: true)
Expand Down Expand Up @@ -30,4 +30,8 @@ FileUtils.chdir APP_ROOT do

puts "\n== Restarting application server =="
system! "bin/rails restart"

# puts "\n== Configuring puma-dev =="
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
end
13 changes: 2 additions & 11 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1

# Once this application is fully deployed to Rails 7.1 and you have no plans to rollback
# replace the line below with config.active_support.cache_format_version = 7.1
# This will mean that we can revert back to rails 7.0 if there is an issue
config.active_support.cache_format_version = 7.0

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
Expand Down Expand Up @@ -61,17 +56,13 @@ class Application < Rails::Application
# https://github.com/alphagov/govuk-frontend/issues/1350
config.assets.css_compressor = nil

config.i18n.enforce_available_locales = true

# Compiled assets are written to the location specified in config.assets.prefix.
config.assets.prefix = "/assets/contacts-admin"

# Generators
config.generators do |g|
g.orm :active_record
g.template_engine :erb
g.test_framework :rspec, fixture: false
g.fixture_replacement :factory_bot, dir: "spec/factories"
g.test_framework :rspec, fixture: false
g.factory_bot dir: "spec/factories"
end
end
end
13 changes: 7 additions & 6 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Allow requests for all domains e.g. <app>.dev.gov.uk
config.hosts.clear

# Enable server timing
# Enable server timing.
config.server_timing = true

# Enable/disable caching. By default caching is disabled.
Expand All @@ -29,9 +29,7 @@
config.action_controller.enable_fragment_cache_logging = true

config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}",
}
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
else
config.action_controller.perform_caching = false

Expand Down Expand Up @@ -63,8 +61,11 @@
config.i18n.raise_on_missing_translations = true

# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
config.action_view.annotate_rendered_view_with_filenames = true

# Raise error when a before_action's only/except options reference missing actions
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true

# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
# config.generators.apply_rubocop_autocorrect_after_generate!
end
7 changes: 5 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
# Do not fall back to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
Expand All @@ -48,7 +48,10 @@
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

# Info include generic and useful information about system operation, but avoids logging too much
# Skip http-to-https redirect for the default health check endpoint.
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }

# "info" includes generic and useful information about system operation, but avoids logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
# want to log everything, set the level to "debug".
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
Expand Down
7 changes: 2 additions & 5 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
config.eager_load = ENV["CI"].present?

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}",
}
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }

# Show full error reports and disable caching.
config.consider_all_requests_local = true
Expand Down Expand Up @@ -57,6 +54,6 @@
PaperTrail.enabled = false
end

# Raise error when a before_action's only/except options reference missing actions
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true
end
2 changes: 1 addition & 1 deletion config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
# Rails.application.config.assets.precompile += %w[ admin.js admin.css ]
2 changes: 1 addition & 1 deletion config/initializers/filter_parameter_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += %i[
passw secret token _key crypt salt certificate otp ssn
passw email secret token _key crypt salt certificate otp ssn
]
12 changes: 6 additions & 6 deletions public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
<title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}

div.dialog {
.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}

div.dialog > div {
.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
Expand All @@ -31,13 +31,13 @@
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}

h1 {
.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}

div.dialog > p {
.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
Expand All @@ -54,7 +54,7 @@
</style>
</head>

<body>
<body class="rails-default-error-page">
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
Expand Down
12 changes: 6 additions & 6 deletions public/422.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
<title>The change you wanted was rejected (422)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}

div.dialog {
.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}

div.dialog > div {
.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
Expand All @@ -31,13 +31,13 @@
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}

h1 {
.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}

div.dialog > p {
.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
Expand All @@ -54,7 +54,7 @@
</style>
</head>

<body>
<body class="rails-default-error-page">
<!-- This file lives in public/422.html -->
<div class="dialog">
<div>
Expand Down
12 changes: 6 additions & 6 deletions public/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}

div.dialog {
.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}

div.dialog > div {
.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
Expand All @@ -31,13 +31,13 @@
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}

h1 {
.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}

div.dialog > p {
.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
Expand All @@ -54,7 +54,7 @@
</style>
</head>

<body>
<body class="rails-default-error-page">
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
Expand Down
6 changes: 1 addition & 5 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file

0 comments on commit 444210c

Please sign in to comment.