Skip to content

Commit 2775858

Browse files
committed
rails app:update
1 parent 392c8c7 commit 2775858

File tree

17 files changed

+261
-47
lines changed

17 files changed

+261
-47
lines changed

bin/bundler-audit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env ruby
2+
require_relative "../config/boot"
3+
require "bundler/audit/cli"
4+
5+
ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check")
6+
Bundler::Audit::CLI.start

bin/ci

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env ruby
2+
require_relative "../config/boot"
3+
require "active_support/continuous_integration"
4+
5+
CI = ActiveSupport::ContinuousIntegration
6+
require_relative "../config/ci.rb"

bin/dev

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,2 @@
1-
#!/usr/bin/env sh
2-
3-
if ! gem list foreman -i --silent; then
4-
echo "Installing foreman..."
5-
gem install foreman
6-
fi
7-
8-
# Default to port 3000 if not specified
9-
export PORT="${PORT:-3000}"
10-
11-
# Let the debug gem allow remote connections,
12-
# but avoid loading until `debugger` is called
13-
export RUBY_DEBUG_OPEN="true"
14-
export RUBY_DEBUG_LAZY="true"
15-
16-
exec foreman start -f Procfile.dev "$@"
1+
#!/usr/bin/env ruby
2+
exec "./bin/rails", "server", *ARGV

bin/rubocop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require "rubygems"
33
require "bundler/setup"
44

5-
# explicit rubocop config increases performance slightly while avoiding config confusion.
5+
# Explicit RuboCop config increases performance slightly while avoiding config confusion.
66
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
77

88
load Gem.bin_path("rubocop", "rubocop")

bin/setup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FileUtils.chdir APP_ROOT do
2222

2323
puts "\n== Preparing database =="
2424
system! "bin/rails db:prepare"
25+
system! "bin/rails db:reset" if ARGV.include?("--reset")
2526

2627
puts "\n== Removing old logs and tempfiles =="
2728
system! "bin/rails log:clear tmp:clear"

config/bundler-audit.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Audit all gems listed in the Gemfile for known security problems by running bin/bundler-audit.
2+
# CVEs that are not relevant to the application can be enumerated on the ignore list below.
3+
4+
ignore:
5+
- CVE-THAT-DOES-NOT-APPLY

config/ci.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Run using bin/ci
2+
3+
CI.run do
4+
step "Setup", "bin/setup --skip-server"
5+
6+
step "Style: Ruby", "bin/rubocop"
7+
8+
step "Security: Gem audit", "bin/bundler-audit"
9+
step "Security: Importmap vulnerability audit", "bin/importmap audit"
10+
step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
11+
12+
step "Tests: Rails", "bin/rails test"
13+
step "Tests: System", "bin/rails test:system"
14+
step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
15+
16+
# Optional: set a green GitHub commit status to unblock PR merge.
17+
# Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
18+
# if success?
19+
# step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
20+
# else
21+
# failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
22+
# end
23+
end

config/environments/development.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
# Highlight code that enqueued background job in logs.
5656
config.active_job.verbose_enqueue_logs = true
5757

58+
# Highlight code that triggered redirect in logs.
59+
config.action_dispatch.verbose_redirect_logs = true
60+
5861
# Raises error for missing translations.
5962
# config.i18n.raise_on_missing_translations = true
6063

config/environments/production.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
config.log_tags = [ :request_id ]
3838
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
3939

40-
# Change to "debug" to log everything (including potentially personally-identifiable information!)
40+
# Change to "debug" to log everything (including potentially personally-identifiable information!).
4141
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
4242

4343
# Prevent health checks from clogging up the logs.
@@ -59,7 +59,7 @@
5959
# Set host to be used by links generated in mailer templates.
6060
config.action_mailer.default_url_options = { host: "example.com" }
6161

62-
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
62+
# Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
6363
# config.action_mailer.smtp_settings = {
6464
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
6565
# password: Rails.application.credentials.dig(:smtp, :password),

config/initializers/content_security_policy.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
2121
# config.content_security_policy_nonce_directives = %w(script-src style-src)
2222
#
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+
#
2327
# # Report violations without enforcing the policy.
2428
# # config.content_security_policy_report_only = true
2529
# end

0 commit comments

Comments
 (0)