Skip to content

Commit dcc7b01

Browse files
committed
Rails app:update
1 parent 0702203 commit dcc7b01

File tree

11 files changed

+116
-24
lines changed

11 files changed

+116
-24
lines changed

bin/setup

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
#!/usr/bin/env ruby
2-
require 'pathname'
32
require 'fileutils'
4-
include FileUtils # rubocop:disable Style/MixinUsage
53

64
# path to your application root.
7-
APP_ROOT = Pathname.new File.expand_path('..', __dir__)
5+
APP_ROOT = File.expand_path('..', __dir__)
86

97
def system!(*args)
108
system(*args) || abort("\n== Command #{args} failed ==")
119
end
1210

13-
chdir APP_ROOT do
14-
# This script is a starting point to setup your application.
11+
FileUtils.chdir APP_ROOT do
12+
# This script is a way to setup or update your development environment automatically.
13+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
1514
# Add necessary setup steps to this file.
1615

1716
puts '== Installing dependencies =='
1817
system! 'gem install bundler --conservative'
1918
system('bundle check') || system!('bundle install')
2019

21-
# Install JavaScript dependencies if using Yarn
20+
# Install JavaScript dependencies
2221
# system('bin/yarn')
2322

24-
2523
# puts "\n== Copying sample files =="
2624
# unless File.exist?('config/database.yml')
27-
# cp 'config/database.yml.sample', 'config/database.yml'
25+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
2826
# end
2927

3028
puts "\n== Preparing database =="
31-
system! 'bin/rails db:setup'
29+
system! 'bin/rails db:prepare'
3230

3331
puts "\n== Removing old logs and tempfiles =="
3432
system! 'bin/rails log:clear tmp:clear'

bin/yarn

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env ruby
2-
VENDOR_PATH = File.expand_path('..', __dir__)
3-
Dir.chdir(VENDOR_PATH) do
2+
APP_ROOT = File.expand_path('..', __dir__)
3+
Dir.chdir(APP_ROOT) do
44
begin
5-
exec "yarnpkg #{ARGV.join(' ')}"
5+
exec "yarnpkg", *ARGV
66
rescue Errno::ENOENT
7-
warn "Yarn executable was not detected in the system."
8-
warn "Download Yarn at https://yarnpkg.com/en/docs/install"
7+
$stderr.puts "Yarn executable was not detected in the system."
8+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
99
exit 1
1010
end
1111
end

config/boot.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
1+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
22

3-
require "bundler/setup" # Set up gems listed in the Gemfile.
3+
require 'bundler/setup' # Set up gems listed in the Gemfile.

config/environment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Load the Rails application.
2-
require_relative "application"
2+
require_relative 'application'
33

44
# Initialize the Rails application.
55
Rails.application.initialize!
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
# ActiveSupport::Reloader.to_prepare do
4+
# ApplicationController.renderer.defaults.merge!(
5+
# http_host: 'example.org',
6+
# https: false
7+
# )
8+
# end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5+
6+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7+
# Rails.backtrace_cleaner.remove_silencers!
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
# Define an application-wide content security policy
4+
# For further information see the following documentation
5+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6+
7+
# Rails.application.config.content_security_policy do |policy|
8+
# policy.default_src :self, :https
9+
# policy.font_src :self, :https, :data
10+
# policy.img_src :self, :https, :data
11+
# policy.object_src :none
12+
# policy.script_src :self, :https
13+
# policy.style_src :self, :https
14+
# # If you are using webpack-dev-server then specify webpack-dev-server host
15+
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
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+
# Set the nonce only to specific directives
25+
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
26+
27+
# Report CSP violations to a specified URI
28+
# For further information see the following documentation:
29+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
30+
# Rails.application.config.content_security_policy_report_only = true

config/initializers/mime_types.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
# Add new mime types for use in respond_to blocks:
4+
# Mime::Type.register "text/richtext", :rtf
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Be sure to restart your server when you modify this file.
2+
#
3+
# This file contains migration options to ease your Rails 6.0 upgrade.
4+
#
5+
# Once upgraded flip defaults one by one to migrate to the new default.
6+
#
7+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
8+
9+
# Don't force requests from old versions of IE to be UTF-8 encoded.
10+
# Rails.application.config.action_view.default_enforce_utf8 = false
11+
12+
# Embed purpose and expiry metadata inside signed and encrypted
13+
# cookies for increased security.
14+
#
15+
# This option is not backwards compatible with earlier Rails versions.
16+
# It's best enabled when your entire app is migrated and stable on 6.0.
17+
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
18+
19+
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
20+
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
21+
22+
# Return false instead of self when enqueuing is aborted from a callback.
23+
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
24+
25+
# Send Active Storage analysis and purge jobs to dedicated queues.
26+
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
27+
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
28+
29+
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
30+
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
31+
# Rails.application.config.active_storage.replace_on_assign_to_many = true
32+
33+
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
34+
#
35+
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
36+
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
37+
# If you send mail in the background, job workers need to have a copy of
38+
# MailDeliveryJob to ensure all delivery jobs are processed properly.
39+
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
40+
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
41+
42+
# Enable the same cache key to be reused when the object being cached of type
43+
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
44+
# of the relation's cache key into the cache version to support recycling cache key.
45+
# Rails.application.config.active_record.collection_cache_versioning = true

config/locales/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# 'true': 'foo'
2828
#
2929
# To learn more, please read the Rails Internationalization guide
30-
# available at http://guides.rubyonrails.org/i18n.html.
30+
# available at https://guides.rubyonrails.org/i18n.html.
3131

3232
en:
3333
hello: "Hello world"

config/spring.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
%w(
2-
.ruby-version
3-
.rbenv-vars
4-
tmp/restart.txt
5-
tmp/caching-dev.txt
6-
).each { |path| Spring.watch(path) }
1+
Spring.watch(
2+
".ruby-version",
3+
".rbenv-vars",
4+
"tmp/restart.txt",
5+
"tmp/caching-dev.txt"
6+
)

0 commit comments

Comments
 (0)