Description:
rails 6
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r819:60250a6ea113 - - 21 files changed: 305 inserted, 116 deleted

@@ -0,0 +1,14
1 + #!/usr/bin/env ruby
2 + if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
3 + gem "bundler"
4 + require "bundler"
5 +
6 + # Load Spring without loading other gems in the Gemfile, for speed.
7 + Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
8 + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
9 + gem "spring", spring.version
10 + require "spring/binstub"
11 + rescue Gem::LoadError
12 + # Ignore when Spring is not installed.
13 + end
14 + end
@@ -0,0 +1,67
1 + # Be sure to restart your server when you modify this file.
2 + #
3 + # This file contains migration options to ease your Rails 6.1 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 + # Support for inversing belongs_to -> has_many Active Record associations.
10 + # Rails.application.config.active_record.has_many_inversing = true
11 +
12 + # Track Active Storage variants in the database.
13 + # Rails.application.config.active_storage.track_variants = true
14 +
15 + # Apply random variation to the delay when retrying failed jobs.
16 + # Rails.application.config.active_job.retry_jitter = 0.15
17 +
18 + # Stop executing `after_enqueue`/`after_perform` callbacks if
19 + # `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
20 + # Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
21 +
22 + # Specify cookies SameSite protection level: either :none, :lax, or :strict.
23 + #
24 + # This change is not backwards compatible with earlier Rails versions.
25 + # It's best enabled when your entire app is migrated and stable on 6.1.
26 + # Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
27 +
28 + # Generate CSRF tokens that are encoded in URL-safe Base64.
29 + #
30 + # This change is not backwards compatible with earlier Rails versions.
31 + # It's best enabled when your entire app is migrated and stable on 6.1.
32 + # Rails.application.config.action_controller.urlsafe_csrf_tokens = true
33 +
34 + # Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
35 + # UTC offset or a UTC time.
36 + # ActiveSupport.utc_to_local_returns_utc_offset_times = true
37 +
38 + # Change the default HTTP status code to `308` when redirecting non-GET/HEAD
39 + # requests to HTTPS in `ActionDispatch::SSL` middleware.
40 + # Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
41 +
42 + # Use new connection handling API. For most applications this won't have any
43 + # effect. For applications using multiple databases, this new API provides
44 + # support for granular connection swapping.
45 + # Rails.application.config.active_record.legacy_connection_handling = false
46 +
47 + # Make `form_with` generate non-remote forms by default.
48 + # Rails.application.config.action_view.form_with_generates_remote_forms = false
49 +
50 + # Set the default queue name for the analysis job to the queue adapter default.
51 + # Rails.application.config.active_storage.queues.analysis = nil
52 +
53 + # Set the default queue name for the purge job to the queue adapter default.
54 + # Rails.application.config.active_storage.queues.purge = nil
55 +
56 + # Set the default queue name for the incineration job to the queue adapter default.
57 + # Rails.application.config.action_mailbox.queues.incineration = nil
58 +
59 + # Set the default queue name for the routing job to the queue adapter default.
60 + # Rails.application.config.action_mailbox.queues.routing = nil
61 +
62 + # Set the default queue name for the mail deliver job to the queue adapter default.
63 + # Rails.application.config.action_mailer.deliver_later_queue_name = nil
64 +
65 + # Generate a `Link` header that gives a hint to modern browsers about
66 + # preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
67 + # Rails.application.config.action_view.preload_links_header = true
@@ -0,0 +1,11
1 + # Define an application-wide HTTP permissions policy. For further
2 + # information see https://developers.google.com/web/updates/2018/06/feature-policy
3 + #
4 + # Rails.application.config.permissions_policy do |f|
5 + # f.camera :none
6 + # f.gyroscope :none
7 + # f.microphone :none
8 + # f.usb :none
9 + # f.fullscreen :self
10 + # f.payment :self, "https://secure.example.com"
11 + # end
@@ -1,17 +1,17
1 1 source 'https://rubygems.org'
2 2 git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3 3
4 4 #rails
5 - gem 'rails', '~>5.2'
5 + gem 'rails', '~>6.0'
6 6 gem 'activerecord-session_store'
7 7 gem 'puma'
8 8
9 9 # Reduces boot times through caching; required in config/boot.rb
10 10 gem 'bootsnap', '>= 1.1.0', require: false
11 11
12 12 # Bundle edge Rails instead:
13 13 # gem 'rails', :git => 'git://github.com/rails/rails.git'
14 14
15 15 #---------------- database ---------------------
16 16 #the database
17 17 gem 'mysql2'
@@ -1,70 +1,87
1 1 GEM
2 2 remote: https://rubygems.org/
3 3 specs:
4 4 RubyInline (3.12.5)
5 5 ZenTest (~> 4.3)
6 6 ZenTest (4.12.0)
7 7 ace-rails-ap (4.4)
8 - actioncable (5.2.6)
9 - actionpack (= 5.2.6)
8 + actioncable (6.1.4.4)
9 + actionpack (= 6.1.4.4)
10 + activesupport (= 6.1.4.4)
10 11 nio4r (~> 2.0)
11 12 websocket-driver (>= 0.6.1)
12 - actionmailer (5.2.6)
13 - actionpack (= 5.2.6)
14 - actionview (= 5.2.6)
15 - activejob (= 5.2.6)
13 + actionmailbox (6.1.4.4)
14 + actionpack (= 6.1.4.4)
15 + activejob (= 6.1.4.4)
16 + activerecord (= 6.1.4.4)
17 + activestorage (= 6.1.4.4)
18 + activesupport (= 6.1.4.4)
19 + mail (>= 2.7.1)
20 + actionmailer (6.1.4.4)
21 + actionpack (= 6.1.4.4)
22 + actionview (= 6.1.4.4)
23 + activejob (= 6.1.4.4)
24 + activesupport (= 6.1.4.4)
16 25 mail (~> 2.5, >= 2.5.4)
17 26 rails-dom-testing (~> 2.0)
18 - actionpack (5.2.6)
19 - actionview (= 5.2.6)
20 - activesupport (= 5.2.6)
21 - rack (~> 2.0, >= 2.0.8)
27 + actionpack (6.1.4.4)
28 + actionview (= 6.1.4.4)
29 + activesupport (= 6.1.4.4)
30 + rack (~> 2.0, >= 2.0.9)
22 31 rack-test (>= 0.6.3)
23 32 rails-dom-testing (~> 2.0)
24 - rails-html-sanitizer (~> 1.0, >= 1.0.2)
25 - actionview (5.2.6)
26 - activesupport (= 5.2.6)
33 + rails-html-sanitizer (~> 1.0, >= 1.2.0)
34 + actiontext (6.1.4.4)
35 + actionpack (= 6.1.4.4)
36 + activerecord (= 6.1.4.4)
37 + activestorage (= 6.1.4.4)
38 + activesupport (= 6.1.4.4)
39 + nokogiri (>= 1.8.5)
40 + actionview (6.1.4.4)
41 + activesupport (= 6.1.4.4)
27 42 builder (~> 3.1)
28 43 erubi (~> 1.4)
29 44 rails-dom-testing (~> 2.0)
30 - rails-html-sanitizer (~> 1.0, >= 1.0.3)
31 - activejob (5.2.6)
32 - activesupport (= 5.2.6)
45 + rails-html-sanitizer (~> 1.1, >= 1.2.0)
46 + activejob (6.1.4.4)
47 + activesupport (= 6.1.4.4)
33 48 globalid (>= 0.3.6)
34 - activemodel (5.2.6)
35 - activesupport (= 5.2.6)
36 - activerecord (5.2.6)
37 - activemodel (= 5.2.6)
38 - activesupport (= 5.2.6)
39 - arel (>= 9.0)
49 + activemodel (6.1.4.4)
50 + activesupport (= 6.1.4.4)
51 + activerecord (6.1.4.4)
52 + activemodel (= 6.1.4.4)
53 + activesupport (= 6.1.4.4)
40 54 activerecord-session_store (2.0.0)
41 55 actionpack (>= 5.2.4.1)
42 56 activerecord (>= 5.2.4.1)
43 57 multi_json (~> 1.11, >= 1.11.2)
44 58 rack (>= 2.0.8, < 3)
45 59 railties (>= 5.2.4.1)
46 - activestorage (5.2.6)
47 - actionpack (= 5.2.6)
48 - activerecord (= 5.2.6)
60 + activestorage (6.1.4.4)
61 + actionpack (= 6.1.4.4)
62 + activejob (= 6.1.4.4)
63 + activerecord (= 6.1.4.4)
64 + activesupport (= 6.1.4.4)
49 65 marcel (~> 1.0.0)
50 - activesupport (5.2.6)
66 + mini_mime (>= 1.1.0)
67 + activesupport (6.1.4.4)
51 68 concurrent-ruby (~> 1.0, >= 1.0.2)
52 - i18n (>= 0.7, < 2)
53 - minitest (~> 5.1)
54 - tzinfo (~> 1.1)
69 + i18n (>= 1.6, < 2)
70 + minitest (>= 5.1)
71 + tzinfo (~> 2.0)
72 + zeitwerk (~> 2.3)
55 73 addressable (2.8.0)
56 74 public_suffix (>= 2.0.2, < 5.0)
57 75 ansi (1.5.0)
58 - arel (9.0.0)
59 76 autoprefixer-rails (10.4.2.0)
60 77 execjs (~> 2)
61 78 best_in_place (3.0.3)
62 79 actionpack (>= 3.2)
63 80 railties (>= 3.2)
64 81 bindex (0.8.1)
65 82 bootsnap (1.9.4)
66 83 msgpack (~> 1.0)
67 84 bootstrap-sass (3.4.1)
68 85 autoprefixer-rails (>= 5.2.1)
69 86 sassc (>= 2.0.0)
70 87 bootstrap-switch-rails (3.3.5)
@@ -157,54 +174,56
157 174 mysql2 (0.5.3)
158 175 nio4r (2.5.8)
159 176 nokogiri (1.13.1)
160 177 mini_portile2 (~> 2.7.0)
161 178 racc (~> 1.4)
162 179 public_suffix (4.0.6)
163 180 puma (5.5.2)
164 181 nio4r (~> 2.0)
165 182 racc (1.6.0)
166 183 rack (2.2.3)
167 184 rack-test (1.1.0)
168 185 rack (>= 1.0, < 3)
169 - rails (5.2.6)
170 - actioncable (= 5.2.6)
171 - actionmailer (= 5.2.6)
172 - actionpack (= 5.2.6)
173 - actionview (= 5.2.6)
174 - activejob (= 5.2.6)
175 - activemodel (= 5.2.6)
176 - activerecord (= 5.2.6)
177 - activestorage (= 5.2.6)
178 - activesupport (= 5.2.6)
179 - bundler (>= 1.3.0)
180 - railties (= 5.2.6)
186 + rails (6.1.4.4)
187 + actioncable (= 6.1.4.4)
188 + actionmailbox (= 6.1.4.4)
189 + actionmailer (= 6.1.4.4)
190 + actionpack (= 6.1.4.4)
191 + actiontext (= 6.1.4.4)
192 + actionview (= 6.1.4.4)
193 + activejob (= 6.1.4.4)
194 + activemodel (= 6.1.4.4)
195 + activerecord (= 6.1.4.4)
196 + activestorage (= 6.1.4.4)
197 + activesupport (= 6.1.4.4)
198 + bundler (>= 1.15.0)
199 + railties (= 6.1.4.4)
181 200 sprockets-rails (>= 2.0.0)
182 201 rails-controller-testing (1.0.5)
183 202 actionpack (>= 5.0.1.rc1)
184 203 actionview (>= 5.0.1.rc1)
185 204 activesupport (>= 5.0.1.rc1)
186 205 rails-dom-testing (2.0.3)
187 206 activesupport (>= 4.2.0)
188 207 nokogiri (>= 1.6)
189 208 rails-html-sanitizer (1.4.2)
190 209 loofah (~> 2.3)
191 210 rails_bootstrap_sortable (2.0.7)
192 211 momentjs-rails (>= 2.8.3)
193 - railties (5.2.6)
194 - actionpack (= 5.2.6)
195 - activesupport (= 5.2.6)
212 + railties (6.1.4.4)
213 + actionpack (= 6.1.4.4)
214 + activesupport (= 6.1.4.4)
196 215 method_source
197 - rake (>= 0.8.7)
198 - thor (>= 0.19.0, < 2.0)
216 + rake (>= 0.13)
217 + thor (~> 1.0)
199 218 rake (13.0.6)
200 219 rb-fsevent (0.11.0)
201 220 rb-inotify (0.10.1)
202 221 ffi (~> 1.0)
203 222 rdiscount (2.2.0.2)
204 223 regexp_parser (2.2.0)
205 224 rexml (3.2.5)
206 225 rouge (3.27.0)
207 226 ruby-progressbar (1.11.0)
208 227 ruby_dep (1.5.0)
209 228 ruby_parser (3.18.1)
210 229 sexp_processor (~> 4.16)
@@ -231,44 +250,44
231 250 listen (>= 2.7, < 4.0)
232 251 spring (>= 1.2, < 3.0)
233 252 sprockets (4.0.2)
234 253 concurrent-ruby (~> 1.0)
235 254 rack (> 1, < 3)
236 255 sprockets-rails (3.4.2)
237 256 actionpack (>= 5.2)
238 257 activesupport (>= 5.2)
239 258 sprockets (>= 3.0.0)
240 259 sqlite3 (1.4.2)
241 260 temple (0.8.2)
242 261 thor (1.2.1)
243 - thread_safe (0.3.6)
244 262 tilt (2.0.10)
245 - tzinfo (1.2.9)
246 - thread_safe (~> 0.1)
263 + tzinfo (2.0.4)
264 + concurrent-ruby (~> 1.0)
247 265 uglifier (4.2.0)
248 266 execjs (>= 0.3.0, < 3)
249 - web-console (3.7.0)
250 - actionview (>= 5.0)
251 - activemodel (>= 5.0)
267 + web-console (4.2.0)
268 + actionview (>= 6.0.0)
269 + activemodel (>= 6.0.0)
252 270 bindex (>= 0.4.0)
253 - railties (>= 5.0)
271 + railties (>= 6.0.0)
254 272 webdriver (0.19.0)
255 273 websocket-driver (0.7.5)
256 274 websocket-extensions (>= 0.1.0)
257 275 websocket-extensions (0.1.5)
258 276 xpath (3.2.0)
259 277 nokogiri (~> 1.8)
260 278 yaml_db (0.7.0)
261 279 rails (>= 3.0)
262 280 rake (>= 0.8.7)
281 + zeitwerk (2.5.3)
263 282
264 283 PLATFORMS
265 284 ruby
266 285
267 286 DEPENDENCIES
268 287 ace-rails-ap
269 288 activerecord-session_store
270 289 autoprefixer-rails
271 290 best_in_place (~> 3.0.1)
272 291 bootsnap (>= 1.1.0)
273 292 bootstrap-sass (~> 3.4.1)
274 293 bootstrap-switch-rails
@@ -284,25 +303,25
284 303 in_place_editing
285 304 jbuilder (~> 2.5)
286 305 jquery-countdown-rails
287 306 jquery-rails
288 307 jquery-tablesorter
289 308 jquery-ui-rails
290 309 listen (>= 3.0.5, < 3.2)
291 310 mail
292 311 minitest-reporters
293 312 momentjs-rails (>= 2.9.0)
294 313 mysql2
295 314 puma
296 - rails (~> 5.2)
315 + rails (~> 6.0)
297 316 rails-controller-testing
298 317 rails_bootstrap_sortable
299 318 rdiscount
300 319 rouge
301 320 sassc-rails
302 321 select2-rails
303 322 selenium-webdriver
304 323 simple_form
305 324 spring
306 325 spring-watcher-listen (~> 2.0.0)
307 326 sqlite3
308 327 uglifier
@@ -1,4 +1,5
1 1 #!/usr/bin/env ruby
2 + load File.expand_path("spring", __dir__)
2 3 APP_PATH = File.expand_path('../config/application', __dir__)
3 - require_relative '../config/boot'
4 - require 'rails/commands'
4 + require_relative "../config/boot"
5 + require "rails/commands"
@@ -1,4 +1,5
1 1 #!/usr/bin/env ruby
2 - require_relative '../config/boot'
3 - require 'rake'
2 + load File.expand_path("spring", __dir__)
3 + require_relative "../config/boot"
4 + require "rake"
4 5 Rake.application.run
@@ -1,36 +1,36
1 1 #!/usr/bin/env ruby
2 - require 'fileutils'
3 - include FileUtils
2 + require "fileutils"
4 3
5 4 # path to your application root.
6 5 APP_ROOT = File.expand_path('..', __dir__)
7 6
8 7 def system!(*args)
9 8 system(*args) || abort("\n== Command #{args} failed ==")
10 9 end
11 10
12 - chdir APP_ROOT do
13 - # This script is a starting point to setup your application.
11 + FileUtils.chdir APP_ROOT do
12 + # This script is a way to set up or update your development environment automatically.
13 + # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14 14 # Add necessary setup steps to this file.
15 15
16 16 puts '== Installing dependencies =='
17 17 system! 'gem install bundler --conservative'
18 18 system('bundle check') || system!('bundle install')
19 19
20 - # Install JavaScript dependencies if using Yarn
21 - # system('bin/yarn')
20 + # Install JavaScript dependencies
21 + system! 'bin/yarn'
22 22
23 23 # puts "\n== Copying sample files =="
24 24 # unless File.exist?('config/database.yml')
25 - # cp 'config/database.yml.sample', 'config/database.yml'
25 + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26 26 # end
27 27
28 28 puts "\n== Preparing database =="
29 - system! 'bin/rails db:setup'
29 + system! 'bin/rails db:prepare'
30 30
31 31 puts "\n== Removing old logs and tempfiles =="
32 32 system! 'bin/rails log:clear tmp:clear'
33 33
34 34 puts "\n== Restarting application server =="
35 35 system! 'bin/rails restart'
36 36 end
@@ -1,11 +1,17
1 1 #!/usr/bin/env ruby
2 2 APP_ROOT = File.expand_path('..', __dir__)
3 3 Dir.chdir(APP_ROOT) do
4 - begin
5 - exec "yarnpkg", *ARGV
6 - rescue Errno::ENOENT
4 + yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
5 + select { |dir| File.expand_path(dir) != __dir__ }.
6 + product(["yarn", "yarn.cmd", "yarn.ps1"]).
7 + map { |dir, file| File.expand_path(file, dir) }.
8 + find { |file| File.executable?(file) }
9 +
10 + if yarn
11 + exec yarn, *ARGV
12 + else
7 13 $stderr.puts "Yarn executable was not detected in the system."
8 14 $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 15 exit 1
10 16 end
11 17 end
@@ -1,4 +1,6
1 1 # This file is used by Rack-based servers to start the application.
2 2
3 - require ::File.expand_path('../config/environment', __FILE__)
4 - run CafeGrader::Application
3 + require_relative "config/environment"
4 +
5 + run Rails.application
6 + Rails.application.load_server
@@ -1,4 +1,4
1 1 ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 2
3 - require 'bundler/setup' # Set up gems listed in the Gemfile.
4 - require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
3 + require "bundler/setup" # Set up gems listed in the Gemfile.
4 + require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -1,10 +1,10
1 1 development:
2 2 adapter: async
3 3
4 4 test:
5 - adapter: async
5 + adapter: test
6 6
7 7 production:
8 8 adapter: redis
9 9 url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 10 channel_prefix: cafe_grader_production
@@ -1,5 +1,5
1 1 # Load the Rails application.
2 - require_relative 'application'
2 + require_relative "application"
3 3
4 4 # Initialize the Rails application.
5 5 Rails.application.initialize!
@@ -1,61 +1,74
1 1 Rails.application.configure do
2 2 # Settings specified here will take precedence over those in config/application.rb.
3 3
4 - # In the development environment your application's code is reloaded on
5 - # every request. This slows down response time but is perfect for development
4 + # In the development environment your application's code is reloaded any time
5 + # it changes. This slows down response time but is perfect for development
6 6 # since you don't have to restart the web server when you make code changes.
7 7 config.cache_classes = false
8 8
9 9 # Do not eager load code on boot.
10 10 config.eager_load = false
11 11
12 12 # Show full error reports.
13 13 config.consider_all_requests_local = true
14 14
15 15 # Enable/disable caching. By default caching is disabled.
16 16 # Run rails dev:cache to toggle caching.
17 17 if Rails.root.join('tmp', 'caching-dev.txt').exist?
18 18 config.action_controller.perform_caching = true
19 + config.action_controller.enable_fragment_cache_logging = true
19 20
20 21 config.cache_store = :memory_store
21 22 config.public_file_server.headers = {
22 23 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23 24 }
24 25 else
25 26 config.action_controller.perform_caching = false
26 27
27 28 config.cache_store = :null_store
28 29 end
29 30
30 - # Store uploaded files on the local file system (see config/storage.yml for options)
31 + # Store uploaded files on the local file system (see config/storage.yml for options).
31 32 config.active_storage.service = :local
32 33
33 34 # Don't care if the mailer can't send.
34 35 config.action_mailer.raise_delivery_errors = false
35 36
36 37 config.action_mailer.perform_caching = false
37 38
38 39 # Print deprecation notices to the Rails logger.
39 40 config.active_support.deprecation = :log
40 41
42 + # Raise exceptions for disallowed deprecations.
43 + config.active_support.disallowed_deprecation = :raise
44 +
45 + # Tell Active Support which deprecation messages to disallow.
46 + config.active_support.disallowed_deprecation_warnings = []
47 +
41 48 # Raise an error on page load if there are pending migrations.
42 49 config.active_record.migration_error = :page_load
43 50
44 51 # Highlight code that triggered database queries in logs.
45 52 config.active_record.verbose_query_logs = true
46 53
47 54 # Debug mode disables concatenation and preprocessing of assets.
48 55 # This option may cause significant delays in view rendering with a large
49 56 # number of complex assets.
50 57 config.assets.debug = true
51 58
52 59 # Suppress logger output for asset requests.
53 60 config.assets.quiet = true
54 61
55 - # Raises error for missing translations
56 - # config.action_view.raise_on_missing_translations = true
62 + # Raises error for missing translations.
63 + # config.i18n.raise_on_missing_translations = true
64 +
65 + # Annotate rendered view with file names.
66 + # config.action_view.annotate_rendered_view_with_filenames = true
57 67
58 68 # Use an evented file watcher to asynchronously detect changes in source code,
59 69 # routes, locales, etc. This feature depends on the listen gem.
60 70 config.file_watcher = ActiveSupport::EventedFileUpdateChecker
71 +
72 + # Uncomment if you wish to allow Action Cable access from any origin.
73 + # config.action_cable.disable_request_forgery_protection = true
61 74 end
@@ -13,82 +13,106
13 13 # Full error reports are disabled and caching is turned on.
14 14 config.consider_all_requests_local = false
15 15 config.action_controller.perform_caching = true
16 16
17 17 # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18 18 # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19 19 # config.require_master_key = true
20 20
21 21 # Disable serving static files from the `/public` folder by default since
22 22 # Apache or NGINX already handles this.
23 23 config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24 24
25 - # Compress JavaScripts and CSS.
26 - config.assets.js_compressor = :uglifier
25 + # Compress CSS using a preprocessor.
27 26 # config.assets.css_compressor = :sass
28 27
29 28 # Do not fallback to assets pipeline if a precompiled asset is missed.
30 29 config.assets.compile = false
31 30
32 - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
33 -
34 31 # Enable serving of images, stylesheets, and JavaScripts from an asset server.
35 - # config.action_controller.asset_host = 'http://assets.example.com'
32 + # config.asset_host = 'http://assets.example.com'
36 33
37 34 # Specifies the header that your server uses for sending files.
38 35 # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
39 36 # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
40 37
41 - # Store uploaded files on the local file system (see config/storage.yml for options)
38 + # Store uploaded files on the local file system (see config/storage.yml for options).
42 39 config.active_storage.service = :local
43 40
44 - # Mount Action Cable outside main process or domain
41 + # Mount Action Cable outside main process or domain.
45 42 # config.action_cable.mount_path = nil
46 43 # config.action_cable.url = 'wss://example.com/cable'
47 44 # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
48 45
49 46 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
50 47 # config.force_ssl = true
51 48
52 - # Use the lowest log level to ensure availability of diagnostic information
53 - # when problems arise.
54 - config.log_level = :debug
49 + # Include generic and useful information about system operation, but avoid logging too much
50 + # information to avoid inadvertent exposure of personally identifiable information (PII).
51 + config.log_level = :info
55 52
56 53 # Prepend all log lines with the following tags.
57 54 config.log_tags = [ :request_id ]
58 55
59 56 # Use a different cache store in production.
60 57 # config.cache_store = :mem_cache_store
61 58
62 - # Use a real queuing backend for Active Job (and separate queues per environment)
59 + # Use a real queuing backend for Active Job (and separate queues per environment).
63 60 # config.active_job.queue_adapter = :resque
64 - # config.active_job.queue_name_prefix = "cafe_grader_#{Rails.env}"
61 + # config.active_job.queue_name_prefix = "cafe_grader_production"
65 62
66 63 config.action_mailer.perform_caching = false
67 64
68 65 # Ignore bad email addresses and do not raise email delivery errors.
69 66 # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70 67 # config.action_mailer.raise_delivery_errors = false
71 68
72 69 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73 70 # the I18n.default_locale when a translation cannot be found).
74 71 config.i18n.fallbacks = true
75 72
76 73 # Send deprecation notices to registered listeners.
77 74 config.active_support.deprecation = :notify
78 75
76 + # Log disallowed deprecations.
77 + config.active_support.disallowed_deprecation = :log
78 +
79 + # Tell Active Support which deprecation messages to disallow.
80 + config.active_support.disallowed_deprecation_warnings = []
81 +
79 82 # Use default logging formatter so that PID and timestamp are not suppressed.
80 83 config.log_formatter = ::Logger::Formatter.new
81 84
82 85 # Use a different logger for distributed setups.
83 86 # require 'syslog/logger'
84 87 # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
85 88
86 89 if ENV["RAILS_LOG_TO_STDOUT"].present?
87 90 logger = ActiveSupport::Logger.new(STDOUT)
88 91 logger.formatter = config.log_formatter
89 92 config.logger = ActiveSupport::TaggedLogging.new(logger)
90 93 end
91 94
92 95 # Do not dump schema after migrations.
93 96 config.active_record.dump_schema_after_migration = false
97 +
98 + # Inserts middleware to perform automatic connection switching.
99 + # The `database_selector` hash is used to pass options to the DatabaseSelector
100 + # middleware. The `delay` is used to determine how long to wait after a write
101 + # to send a subsequent read to the primary.
102 + #
103 + # The `database_resolver` class is used by the middleware to determine which
104 + # database is appropriate to use based on the time delay.
105 + #
106 + # The `database_resolver_context` class is used by the middleware to set
107 + # timestamps for the last write to the primary. The resolver uses the context
108 + # class timestamps to determine how long to wait before reading from the
109 + # replica.
110 + #
111 + # By default Rails will store a last write timestamp in the session. The
112 + # DatabaseSelector middleware is designed as such you can define your own
113 + # strategy for connection switching and pass that into the middleware through
114 + # these configuration options.
115 + # config.active_record.database_selector = { delay: 2.seconds }
116 + # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
117 + # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
94 118 end
@@ -1,46 +1,60
1 + require "active_support/core_ext/integer/time"
2 +
3 + # The test environment is used exclusively to run your application's
4 + # test suite. You never need to work with it otherwise. Remember that
5 + # your test database is "scratch space" for the test suite and is wiped
6 + # and recreated between test runs. Don't rely on the data there!
7 +
1 8 Rails.application.configure do
2 9 # Settings specified here will take precedence over those in config/application.rb.
3 10
4 - # The test environment is used exclusively to run your application's
5 - # test suite. You never need to work with it otherwise. Remember that
6 - # your test database is "scratch space" for the test suite and is wiped
7 - # and recreated between test runs. Don't rely on the data there!
8 - config.cache_classes = true
11 + config.cache_classes = false
12 + config.action_view.cache_template_loading = true
9 13
10 14 # Do not eager load code on boot. This avoids loading your whole application
11 15 # just for the purpose of running a single test. If you are using a tool that
12 16 # preloads Rails for running tests, you may have to set it to true.
13 17 config.eager_load = false
14 18
15 19 # Configure public file server for tests with Cache-Control for performance.
16 20 config.public_file_server.enabled = true
17 21 config.public_file_server.headers = {
18 22 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19 23 }
20 24
21 25 # Show full error reports and disable caching.
22 26 config.consider_all_requests_local = true
23 27 config.action_controller.perform_caching = false
28 + config.cache_store = :null_store
24 29
25 30 # Raise exceptions instead of rendering exception templates.
26 31 config.action_dispatch.show_exceptions = false
27 32
28 33 # Disable request forgery protection in test environment.
29 34 config.action_controller.allow_forgery_protection = false
30 35
31 - # Store uploaded files on the local file system in a temporary directory
36 + # Store uploaded files on the local file system in a temporary directory.
32 37 config.active_storage.service = :test
33 38
34 39 config.action_mailer.perform_caching = false
35 40
36 41 # Tell Action Mailer not to deliver emails to the real world.
37 42 # The :test delivery method accumulates sent emails in the
38 43 # ActionMailer::Base.deliveries array.
39 44 config.action_mailer.delivery_method = :test
40 45
41 46 # Print deprecation notices to the stderr.
42 47 config.active_support.deprecation = :stderr
43 48
44 - # Raises error for missing translations
45 - # config.action_view.raise_on_missing_translations = true
49 + # Raise exceptions for disallowed deprecations.
50 + config.active_support.disallowed_deprecation = :raise
51 +
52 + # Tell Active Support which deprecation messages to disallow.
53 + config.active_support.disallowed_deprecation_warnings = []
54 +
55 + # Raises error for missing translations.
56 + # config.i18n.raise_on_missing_translations = true
57 +
58 + # Annotate rendered view with file names.
59 + # config.action_view.annotate_rendered_view_with_filenames = true
46 60 end
@@ -1,7 +1,8
1 1 # Be sure to restart your server when you modify this file.
2 2
3 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/ }
4 + # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
5 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!
6 + # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
7 + # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
8 + Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
@@ -2,24 +2,29
2 2
3 3 # Define an application-wide content security policy
4 4 # For further information see the following documentation
5 5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6 6
7 7 # Rails.application.config.content_security_policy do |policy|
8 8 # policy.default_src :self, :https
9 9 # policy.font_src :self, :https, :data
10 10 # policy.img_src :self, :https, :data
11 11 # policy.object_src :none
12 12 # policy.script_src :self, :https
13 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?
14 16
15 17 # # Specify URI for violation reports
16 18 # # policy.report_uri "/csp-violation-report-endpoint"
17 19 # end
18 20
19 21 # If you are using UJS then enable automatic nonce generation
20 22 # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21 23
24 + # Set the nonce only to specific directives
25 + # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
26 +
22 27 # Report CSP violations to a specified URI
23 28 # For further information see the following documentation:
24 29 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25 30 # Rails.application.config.content_security_policy_report_only = true
@@ -1,4 +1,6
1 1 # Be sure to restart your server when you modify this file.
2 2
3 3 # Configure sensitive parameters which will be filtered from the log file.
4 - Rails.application.config.filter_parameters += [:password]
4 + Rails.application.config.filter_parameters += [
5 + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
6 + ]
@@ -1,31 +1,40
1 1 # Puma can serve each request in a thread from an internal thread pool.
2 2 # The `threads` method setting takes two numbers: a minimum and maximum.
3 3 # Any libraries that use thread pools should be configured to match
4 4 # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 5 # and maximum; this matches the default thread size of Active Record.
6 6 #
7 - threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 - threads threads_count, threads_count
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
10 +
11 + # Specifies the `worker_timeout` threshold that Puma will use to wait before
12 + # terminating a worker in development environments.
13 + #
14 + worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
9 15
10 16 # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11 17 #
12 - port ENV.fetch("PORT") { 3000 }
18 + port ENV.fetch("PORT") { 3000 }
13 19
14 20 # Specifies the `environment` that Puma will run in.
15 21 #
16 22 environment ENV.fetch("RAILS_ENV") { "development" }
17 23
24 + # Specifies the `pidfile` that Puma will use.
25 + pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
26 +
18 27 # Specifies the number of `workers` to boot in clustered mode.
19 - # Workers are forked webserver processes. If using threads and workers together
28 + # Workers are forked web server processes. If using threads and workers together
20 29 # the concurrency of the application would be max `threads` * `workers`.
21 30 # Workers do not work on JRuby or Windows (both of which do not support
22 31 # processes).
23 32 #
24 33 # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 34
26 35 # Use the `preload_app!` method when specifying a `workers` number.
27 36 # This directive tells Puma to first boot the application and load code
28 37 # before forking the application. This takes advantage of Copy On Write
29 38 # process behavior so workers use less memory.
30 39 #
31 40 # preload_app!
@@ -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 + )
You need to be logged in to leave comments. Login now