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: 301 inserted, 112 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,11 +1,11
1 source 'https://rubygems.org'
1 source 'https://rubygems.org'
2 git_source(:github) { |repo| "https://github.com/#{repo}.git" }
2 git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
4 #rails
4 #rails
5 - gem 'rails', '~>5.2'
5 + gem 'rails', '~>6.0'
6 gem 'activerecord-session_store'
6 gem 'activerecord-session_store'
7 gem 'puma'
7 gem 'puma'
8
8
9 # Reduces boot times through caching; required in config/boot.rb
9 # Reduces boot times through caching; required in config/boot.rb
10 gem 'bootsnap', '>= 1.1.0', require: false
10 gem 'bootsnap', '>= 1.1.0', require: false
11
11
@@ -2,63 +2,80
2 remote: https://rubygems.org/
2 remote: https://rubygems.org/
3 specs:
3 specs:
4 RubyInline (3.12.5)
4 RubyInline (3.12.5)
5 ZenTest (~> 4.3)
5 ZenTest (~> 4.3)
6 ZenTest (4.12.0)
6 ZenTest (4.12.0)
7 ace-rails-ap (4.4)
7 ace-rails-ap (4.4)
8 - actioncable (5.2.6)
8 + actioncable (6.1.4.4)
9 - actionpack (= 5.2.6)
9 + actionpack (= 6.1.4.4)
10 + activesupport (= 6.1.4.4)
10 nio4r (~> 2.0)
11 nio4r (~> 2.0)
11 websocket-driver (>= 0.6.1)
12 websocket-driver (>= 0.6.1)
12 - actionmailer (5.2.6)
13 + actionmailbox (6.1.4.4)
13 - actionpack (= 5.2.6)
14 + actionpack (= 6.1.4.4)
14 - actionview (= 5.2.6)
15 + activejob (= 6.1.4.4)
15 - activejob (= 5.2.6)
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 mail (~> 2.5, >= 2.5.4)
25 mail (~> 2.5, >= 2.5.4)
17 rails-dom-testing (~> 2.0)
26 rails-dom-testing (~> 2.0)
18 - actionpack (5.2.6)
27 + actionpack (6.1.4.4)
19 - actionview (= 5.2.6)
28 + actionview (= 6.1.4.4)
20 - activesupport (= 5.2.6)
29 + activesupport (= 6.1.4.4)
21 - rack (~> 2.0, >= 2.0.8)
30 + rack (~> 2.0, >= 2.0.9)
22 rack-test (>= 0.6.3)
31 rack-test (>= 0.6.3)
23 rails-dom-testing (~> 2.0)
32 rails-dom-testing (~> 2.0)
24 - rails-html-sanitizer (~> 1.0, >= 1.0.2)
33 + rails-html-sanitizer (~> 1.0, >= 1.2.0)
25 - actionview (5.2.6)
34 + actiontext (6.1.4.4)
26 - activesupport (= 5.2.6)
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 builder (~> 3.1)
42 builder (~> 3.1)
28 erubi (~> 1.4)
43 erubi (~> 1.4)
29 rails-dom-testing (~> 2.0)
44 rails-dom-testing (~> 2.0)
30 - rails-html-sanitizer (~> 1.0, >= 1.0.3)
45 + rails-html-sanitizer (~> 1.1, >= 1.2.0)
31 - activejob (5.2.6)
46 + activejob (6.1.4.4)
32 - activesupport (= 5.2.6)
47 + activesupport (= 6.1.4.4)
33 globalid (>= 0.3.6)
48 globalid (>= 0.3.6)
34 - activemodel (5.2.6)
49 + activemodel (6.1.4.4)
35 - activesupport (= 5.2.6)
50 + activesupport (= 6.1.4.4)
36 - activerecord (5.2.6)
51 + activerecord (6.1.4.4)
37 - activemodel (= 5.2.6)
52 + activemodel (= 6.1.4.4)
38 - activesupport (= 5.2.6)
53 + activesupport (= 6.1.4.4)
39 - arel (>= 9.0)
40 activerecord-session_store (2.0.0)
54 activerecord-session_store (2.0.0)
41 actionpack (>= 5.2.4.1)
55 actionpack (>= 5.2.4.1)
42 activerecord (>= 5.2.4.1)
56 activerecord (>= 5.2.4.1)
43 multi_json (~> 1.11, >= 1.11.2)
57 multi_json (~> 1.11, >= 1.11.2)
44 rack (>= 2.0.8, < 3)
58 rack (>= 2.0.8, < 3)
45 railties (>= 5.2.4.1)
59 railties (>= 5.2.4.1)
46 - activestorage (5.2.6)
60 + activestorage (6.1.4.4)
47 - actionpack (= 5.2.6)
61 + actionpack (= 6.1.4.4)
48 - activerecord (= 5.2.6)
62 + activejob (= 6.1.4.4)
63 + activerecord (= 6.1.4.4)
64 + activesupport (= 6.1.4.4)
49 marcel (~> 1.0.0)
65 marcel (~> 1.0.0)
50 - activesupport (5.2.6)
66 + mini_mime (>= 1.1.0)
67 + activesupport (6.1.4.4)
51 concurrent-ruby (~> 1.0, >= 1.0.2)
68 concurrent-ruby (~> 1.0, >= 1.0.2)
52 - i18n (>= 0.7, < 2)
69 + i18n (>= 1.6, < 2)
53 - minitest (~> 5.1)
70 + minitest (>= 5.1)
54 - tzinfo (~> 1.1)
71 + tzinfo (~> 2.0)
72 + zeitwerk (~> 2.3)
55 addressable (2.8.0)
73 addressable (2.8.0)
56 public_suffix (>= 2.0.2, < 5.0)
74 public_suffix (>= 2.0.2, < 5.0)
57 ansi (1.5.0)
75 ansi (1.5.0)
58 - arel (9.0.0)
59 autoprefixer-rails (10.4.2.0)
76 autoprefixer-rails (10.4.2.0)
60 execjs (~> 2)
77 execjs (~> 2)
61 best_in_place (3.0.3)
78 best_in_place (3.0.3)
62 actionpack (>= 3.2)
79 actionpack (>= 3.2)
63 railties (>= 3.2)
80 railties (>= 3.2)
64 bindex (0.8.1)
81 bindex (0.8.1)
@@ -163,42 +180,44
163 puma (5.5.2)
180 puma (5.5.2)
164 nio4r (~> 2.0)
181 nio4r (~> 2.0)
165 racc (1.6.0)
182 racc (1.6.0)
166 rack (2.2.3)
183 rack (2.2.3)
167 rack-test (1.1.0)
184 rack-test (1.1.0)
168 rack (>= 1.0, < 3)
185 rack (>= 1.0, < 3)
169 - rails (5.2.6)
186 + rails (6.1.4.4)
170 - actioncable (= 5.2.6)
187 + actioncable (= 6.1.4.4)
171 - actionmailer (= 5.2.6)
188 + actionmailbox (= 6.1.4.4)
172 - actionpack (= 5.2.6)
189 + actionmailer (= 6.1.4.4)
173 - actionview (= 5.2.6)
190 + actionpack (= 6.1.4.4)
174 - activejob (= 5.2.6)
191 + actiontext (= 6.1.4.4)
175 - activemodel (= 5.2.6)
192 + actionview (= 6.1.4.4)
176 - activerecord (= 5.2.6)
193 + activejob (= 6.1.4.4)
177 - activestorage (= 5.2.6)
194 + activemodel (= 6.1.4.4)
178 - activesupport (= 5.2.6)
195 + activerecord (= 6.1.4.4)
179 - bundler (>= 1.3.0)
196 + activestorage (= 6.1.4.4)
180 - railties (= 5.2.6)
197 + activesupport (= 6.1.4.4)
198 + bundler (>= 1.15.0)
199 + railties (= 6.1.4.4)
181 sprockets-rails (>= 2.0.0)
200 sprockets-rails (>= 2.0.0)
182 rails-controller-testing (1.0.5)
201 rails-controller-testing (1.0.5)
183 actionpack (>= 5.0.1.rc1)
202 actionpack (>= 5.0.1.rc1)
184 actionview (>= 5.0.1.rc1)
203 actionview (>= 5.0.1.rc1)
185 activesupport (>= 5.0.1.rc1)
204 activesupport (>= 5.0.1.rc1)
186 rails-dom-testing (2.0.3)
205 rails-dom-testing (2.0.3)
187 activesupport (>= 4.2.0)
206 activesupport (>= 4.2.0)
188 nokogiri (>= 1.6)
207 nokogiri (>= 1.6)
189 rails-html-sanitizer (1.4.2)
208 rails-html-sanitizer (1.4.2)
190 loofah (~> 2.3)
209 loofah (~> 2.3)
191 rails_bootstrap_sortable (2.0.7)
210 rails_bootstrap_sortable (2.0.7)
192 momentjs-rails (>= 2.8.3)
211 momentjs-rails (>= 2.8.3)
193 - railties (5.2.6)
212 + railties (6.1.4.4)
194 - actionpack (= 5.2.6)
213 + actionpack (= 6.1.4.4)
195 - activesupport (= 5.2.6)
214 + activesupport (= 6.1.4.4)
196 method_source
215 method_source
197 - rake (>= 0.8.7)
216 + rake (>= 0.13)
198 - thor (>= 0.19.0, < 2.0)
217 + thor (~> 1.0)
199 rake (13.0.6)
218 rake (13.0.6)
200 rb-fsevent (0.11.0)
219 rb-fsevent (0.11.0)
201 rb-inotify (0.10.1)
220 rb-inotify (0.10.1)
202 ffi (~> 1.0)
221 ffi (~> 1.0)
203 rdiscount (2.2.0.2)
222 rdiscount (2.2.0.2)
204 regexp_parser (2.2.0)
223 regexp_parser (2.2.0)
@@ -237,32 +256,32
237 actionpack (>= 5.2)
256 actionpack (>= 5.2)
238 activesupport (>= 5.2)
257 activesupport (>= 5.2)
239 sprockets (>= 3.0.0)
258 sprockets (>= 3.0.0)
240 sqlite3 (1.4.2)
259 sqlite3 (1.4.2)
241 temple (0.8.2)
260 temple (0.8.2)
242 thor (1.2.1)
261 thor (1.2.1)
243 - thread_safe (0.3.6)
244 tilt (2.0.10)
262 tilt (2.0.10)
245 - tzinfo (1.2.9)
263 + tzinfo (2.0.4)
246 - thread_safe (~> 0.1)
264 + concurrent-ruby (~> 1.0)
247 uglifier (4.2.0)
265 uglifier (4.2.0)
248 execjs (>= 0.3.0, < 3)
266 execjs (>= 0.3.0, < 3)
249 - web-console (3.7.0)
267 + web-console (4.2.0)
250 - actionview (>= 5.0)
268 + actionview (>= 6.0.0)
251 - activemodel (>= 5.0)
269 + activemodel (>= 6.0.0)
252 bindex (>= 0.4.0)
270 bindex (>= 0.4.0)
253 - railties (>= 5.0)
271 + railties (>= 6.0.0)
254 webdriver (0.19.0)
272 webdriver (0.19.0)
255 websocket-driver (0.7.5)
273 websocket-driver (0.7.5)
256 websocket-extensions (>= 0.1.0)
274 websocket-extensions (>= 0.1.0)
257 websocket-extensions (0.1.5)
275 websocket-extensions (0.1.5)
258 xpath (3.2.0)
276 xpath (3.2.0)
259 nokogiri (~> 1.8)
277 nokogiri (~> 1.8)
260 yaml_db (0.7.0)
278 yaml_db (0.7.0)
261 rails (>= 3.0)
279 rails (>= 3.0)
262 rake (>= 0.8.7)
280 rake (>= 0.8.7)
281 + zeitwerk (2.5.3)
263
282
264 PLATFORMS
283 PLATFORMS
265 ruby
284 ruby
266
285
267 DEPENDENCIES
286 DEPENDENCIES
268 ace-rails-ap
287 ace-rails-ap
@@ -290,13 +309,13
290 listen (>= 3.0.5, < 3.2)
309 listen (>= 3.0.5, < 3.2)
291 mail
310 mail
292 minitest-reporters
311 minitest-reporters
293 momentjs-rails (>= 2.9.0)
312 momentjs-rails (>= 2.9.0)
294 mysql2
313 mysql2
295 puma
314 puma
296 - rails (~> 5.2)
315 + rails (~> 6.0)
297 rails-controller-testing
316 rails-controller-testing
298 rails_bootstrap_sortable
317 rails_bootstrap_sortable
299 rdiscount
318 rdiscount
300 rouge
319 rouge
301 sassc-rails
320 sassc-rails
302 select2-rails
321 select2-rails
@@ -1,4 +1,5
1 #!/usr/bin/env ruby
1 #!/usr/bin/env ruby
2 + load File.expand_path("spring", __dir__)
2 APP_PATH = File.expand_path('../config/application', __dir__)
3 APP_PATH = File.expand_path('../config/application', __dir__)
3 - require_relative '../config/boot'
4 + require_relative "../config/boot"
4 - require 'rails/commands'
5 + require "rails/commands"
@@ -1,4 +1,5
1 #!/usr/bin/env ruby
1 #!/usr/bin/env ruby
2 - require_relative '../config/boot'
2 + load File.expand_path("spring", __dir__)
3 - require 'rake'
3 + require_relative "../config/boot"
4 + require "rake"
4 Rake.application.run
5 Rake.application.run
@@ -1,35 +1,35
1 #!/usr/bin/env ruby
1 #!/usr/bin/env ruby
2 - require 'fileutils'
2 + require "fileutils"
3 - include FileUtils
4
3
5 # path to your application root.
4 # path to your application root.
6 APP_ROOT = File.expand_path('..', __dir__)
5 APP_ROOT = File.expand_path('..', __dir__)
7
6
8 def system!(*args)
7 def system!(*args)
9 system(*args) || abort("\n== Command #{args} failed ==")
8 system(*args) || abort("\n== Command #{args} failed ==")
10 end
9 end
11
10
12 - chdir APP_ROOT do
11 + FileUtils.chdir APP_ROOT do
13 - # This script is a starting point to setup your application.
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 # Add necessary setup steps to this file.
14 # Add necessary setup steps to this file.
15
15
16 puts '== Installing dependencies =='
16 puts '== Installing dependencies =='
17 system! 'gem install bundler --conservative'
17 system! 'gem install bundler --conservative'
18 system('bundle check') || system!('bundle install')
18 system('bundle check') || system!('bundle install')
19
19
20 - # Install JavaScript dependencies if using Yarn
20 + # Install JavaScript dependencies
21 - # system('bin/yarn')
21 + system! 'bin/yarn'
22
22
23 # puts "\n== Copying sample files =="
23 # puts "\n== Copying sample files =="
24 # unless File.exist?('config/database.yml')
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 # end
26 # end
27
27
28 puts "\n== Preparing database =="
28 puts "\n== Preparing database =="
29 - system! 'bin/rails db:setup'
29 + system! 'bin/rails db:prepare'
30
30
31 puts "\n== Removing old logs and tempfiles =="
31 puts "\n== Removing old logs and tempfiles =="
32 system! 'bin/rails log:clear tmp:clear'
32 system! 'bin/rails log:clear tmp:clear'
33
33
34 puts "\n== Restarting application server =="
34 puts "\n== Restarting application server =="
35 system! 'bin/rails restart'
35 system! 'bin/rails restart'
@@ -1,11 +1,17
1 #!/usr/bin/env ruby
1 #!/usr/bin/env ruby
2 APP_ROOT = File.expand_path('..', __dir__)
2 APP_ROOT = File.expand_path('..', __dir__)
3 Dir.chdir(APP_ROOT) do
3 Dir.chdir(APP_ROOT) do
4 - begin
4 + yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
5 - exec "yarnpkg", *ARGV
5 + select { |dir| File.expand_path(dir) != __dir__ }.
6 - rescue Errno::ENOENT
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 $stderr.puts "Yarn executable was not detected in the system."
13 $stderr.puts "Yarn executable was not detected in the system."
8 $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
14 $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 exit 1
15 exit 1
10 end
16 end
11 end
17 end
@@ -1,4 +1,6
1 # This file is used by Rack-based servers to start the application.
1 # This file is used by Rack-based servers to start the application.
2
2
3 - require ::File.expand_path('../config/environment', __FILE__)
3 + require_relative "config/environment"
4 - run CafeGrader::Application
4 +
5 + run Rails.application
6 + Rails.application.load_server
@@ -1,4 +1,4
1 ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
1 ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
2
3 - require 'bundler/setup' # Set up gems listed in the Gemfile.
3 + require "bundler/setup" # Set up gems listed in the Gemfile.
4 - require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
4 + require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -1,10 +1,10
1 development:
1 development:
2 adapter: async
2 adapter: async
3
3
4 test:
4 test:
5 - adapter: async
5 + adapter: test
6
6
7 production:
7 production:
8 adapter: redis
8 adapter: redis
9 url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
9 url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 channel_prefix: cafe_grader_production
10 channel_prefix: cafe_grader_production
@@ -1,5 +1,5
1 # Load the Rails application.
1 # Load the Rails application.
2 - require_relative 'application'
2 + require_relative "application"
3
3
4 # Initialize the Rails application.
4 # Initialize the Rails application.
5 Rails.application.initialize!
5 Rails.application.initialize!
@@ -1,11 +1,11
1 Rails.application.configure do
1 Rails.application.configure do
2 # Settings specified here will take precedence over those in config/application.rb.
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
4 + # In the development environment your application's code is reloaded any time
5 - # every request. This slows down response time but is perfect for development
5 + # it changes. This slows down response time but is perfect for development
6 # since you don't have to restart the web server when you make code changes.
6 # since you don't have to restart the web server when you make code changes.
7 config.cache_classes = false
7 config.cache_classes = false
8
8
9 # Do not eager load code on boot.
9 # Do not eager load code on boot.
10 config.eager_load = false
10 config.eager_load = false
11
11
@@ -13,34 +13,41
13 config.consider_all_requests_local = true
13 config.consider_all_requests_local = true
14
14
15 # Enable/disable caching. By default caching is disabled.
15 # Enable/disable caching. By default caching is disabled.
16 # Run rails dev:cache to toggle caching.
16 # Run rails dev:cache to toggle caching.
17 if Rails.root.join('tmp', 'caching-dev.txt').exist?
17 if Rails.root.join('tmp', 'caching-dev.txt').exist?
18 config.action_controller.perform_caching = true
18 config.action_controller.perform_caching = true
19 + config.action_controller.enable_fragment_cache_logging = true
19
20
20 config.cache_store = :memory_store
21 config.cache_store = :memory_store
21 config.public_file_server.headers = {
22 config.public_file_server.headers = {
22 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23 }
24 }
24 else
25 else
25 config.action_controller.perform_caching = false
26 config.action_controller.perform_caching = false
26
27
27 config.cache_store = :null_store
28 config.cache_store = :null_store
28 end
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 config.active_storage.service = :local
32 config.active_storage.service = :local
32
33
33 # Don't care if the mailer can't send.
34 # Don't care if the mailer can't send.
34 config.action_mailer.raise_delivery_errors = false
35 config.action_mailer.raise_delivery_errors = false
35
36
36 config.action_mailer.perform_caching = false
37 config.action_mailer.perform_caching = false
37
38
38 # Print deprecation notices to the Rails logger.
39 # Print deprecation notices to the Rails logger.
39 config.active_support.deprecation = :log
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 # Raise an error on page load if there are pending migrations.
48 # Raise an error on page load if there are pending migrations.
42 config.active_record.migration_error = :page_load
49 config.active_record.migration_error = :page_load
43
50
44 # Highlight code that triggered database queries in logs.
51 # Highlight code that triggered database queries in logs.
45 config.active_record.verbose_query_logs = true
52 config.active_record.verbose_query_logs = true
46
53
@@ -49,13 +56,19
49 # number of complex assets.
56 # number of complex assets.
50 config.assets.debug = true
57 config.assets.debug = true
51
58
52 # Suppress logger output for asset requests.
59 # Suppress logger output for asset requests.
53 config.assets.quiet = true
60 config.assets.quiet = true
54
61
55 - # Raises error for missing translations
62 + # Raises error for missing translations.
56 - # config.action_view.raise_on_missing_translations = true
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 # Use an evented file watcher to asynchronously detect changes in source code,
68 # Use an evented file watcher to asynchronously detect changes in source code,
59 # routes, locales, etc. This feature depends on the listen gem.
69 # routes, locales, etc. This feature depends on the listen gem.
60 config.file_watcher = ActiveSupport::EventedFileUpdateChecker
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 end
74 end
@@ -19,52 +19,49
19 # config.require_master_key = true
19 # config.require_master_key = true
20
20
21 # Disable serving static files from the `/public` folder by default since
21 # Disable serving static files from the `/public` folder by default since
22 # Apache or NGINX already handles this.
22 # Apache or NGINX already handles this.
23 config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
23 config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
24
25 - # Compress JavaScripts and CSS.
25 + # Compress CSS using a preprocessor.
26 - config.assets.js_compressor = :uglifier
27 # config.assets.css_compressor = :sass
26 # config.assets.css_compressor = :sass
28
27
29 # Do not fallback to assets pipeline if a precompiled asset is missed.
28 # Do not fallback to assets pipeline if a precompiled asset is missed.
30 config.assets.compile = false
29 config.assets.compile = false
31
30
32 - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
33 -
34 # Enable serving of images, stylesheets, and JavaScripts from an asset server.
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 # Specifies the header that your server uses for sending files.
34 # Specifies the header that your server uses for sending files.
38 # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
35 # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
39 # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
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 config.active_storage.service = :local
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 # config.action_cable.mount_path = nil
42 # config.action_cable.mount_path = nil
46 # config.action_cable.url = 'wss://example.com/cable'
43 # config.action_cable.url = 'wss://example.com/cable'
47 # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
44 # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
48
45
49 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
46 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
50 # config.force_ssl = true
47 # config.force_ssl = true
51
48
52 - # Use the lowest log level to ensure availability of diagnostic information
49 + # Include generic and useful information about system operation, but avoid logging too much
53 - # when problems arise.
50 + # information to avoid inadvertent exposure of personally identifiable information (PII).
54 - config.log_level = :debug
51 + config.log_level = :info
55
52
56 # Prepend all log lines with the following tags.
53 # Prepend all log lines with the following tags.
57 config.log_tags = [ :request_id ]
54 config.log_tags = [ :request_id ]
58
55
59 # Use a different cache store in production.
56 # Use a different cache store in production.
60 # config.cache_store = :mem_cache_store
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 # config.active_job.queue_adapter = :resque
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 config.action_mailer.perform_caching = false
63 config.action_mailer.perform_caching = false
67
64
68 # Ignore bad email addresses and do not raise email delivery errors.
65 # Ignore bad email addresses and do not raise email delivery errors.
69 # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66 # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70 # config.action_mailer.raise_delivery_errors = false
67 # config.action_mailer.raise_delivery_errors = false
@@ -73,12 +70,18
73 # the I18n.default_locale when a translation cannot be found).
70 # the I18n.default_locale when a translation cannot be found).
74 config.i18n.fallbacks = true
71 config.i18n.fallbacks = true
75
72
76 # Send deprecation notices to registered listeners.
73 # Send deprecation notices to registered listeners.
77 config.active_support.deprecation = :notify
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 # Use default logging formatter so that PID and timestamp are not suppressed.
82 # Use default logging formatter so that PID and timestamp are not suppressed.
80 config.log_formatter = ::Logger::Formatter.new
83 config.log_formatter = ::Logger::Formatter.new
81
84
82 # Use a different logger for distributed setups.
85 # Use a different logger for distributed setups.
83 # require 'syslog/logger'
86 # require 'syslog/logger'
84 # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
87 # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
@@ -88,7 +91,28
88 logger.formatter = config.log_formatter
91 logger.formatter = config.log_formatter
89 config.logger = ActiveSupport::TaggedLogging.new(logger)
92 config.logger = ActiveSupport::TaggedLogging.new(logger)
90 end
93 end
91
94
92 # Do not dump schema after migrations.
95 # Do not dump schema after migrations.
93 config.active_record.dump_schema_after_migration = false
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 end
118 end
@@ -1,14 +1,18
1 - Rails.application.configure do
1 + require "active_support/core_ext/integer/time"
2 - # Settings specified here will take precedence over those in config/application.rb.
3
2
4 # The test environment is used exclusively to run your application's
3 # The test environment is used exclusively to run your application's
5 # test suite. You never need to work with it otherwise. Remember that
4 # 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
5 # 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!
6 # and recreated between test runs. Don't rely on the data there!
8 - config.cache_classes = true
7 +
8 + Rails.application.configure do
9 + # Settings specified here will take precedence over those in config/application.rb.
10 +
11 + config.cache_classes = false
12 + config.action_view.cache_template_loading = true
9
13
10 # Do not eager load code on boot. This avoids loading your whole application
14 # Do not eager load code on boot. This avoids loading your whole application
11 # just for the purpose of running a single test. If you are using a tool that
15 # just for the purpose of running a single test. If you are using a tool that
12 # preloads Rails for running tests, you may have to set it to true.
16 # preloads Rails for running tests, you may have to set it to true.
13 config.eager_load = false
17 config.eager_load = false
14
18
@@ -18,29 +22,39
18 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
22 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19 }
23 }
20
24
21 # Show full error reports and disable caching.
25 # Show full error reports and disable caching.
22 config.consider_all_requests_local = true
26 config.consider_all_requests_local = true
23 config.action_controller.perform_caching = false
27 config.action_controller.perform_caching = false
28 + config.cache_store = :null_store
24
29
25 # Raise exceptions instead of rendering exception templates.
30 # Raise exceptions instead of rendering exception templates.
26 config.action_dispatch.show_exceptions = false
31 config.action_dispatch.show_exceptions = false
27
32
28 # Disable request forgery protection in test environment.
33 # Disable request forgery protection in test environment.
29 config.action_controller.allow_forgery_protection = false
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 config.active_storage.service = :test
37 config.active_storage.service = :test
33
38
34 config.action_mailer.perform_caching = false
39 config.action_mailer.perform_caching = false
35
40
36 # Tell Action Mailer not to deliver emails to the real world.
41 # Tell Action Mailer not to deliver emails to the real world.
37 # The :test delivery method accumulates sent emails in the
42 # The :test delivery method accumulates sent emails in the
38 # ActionMailer::Base.deliveries array.
43 # ActionMailer::Base.deliveries array.
39 config.action_mailer.delivery_method = :test
44 config.action_mailer.delivery_method = :test
40
45
41 # Print deprecation notices to the stderr.
46 # Print deprecation notices to the stderr.
42 config.active_support.deprecation = :stderr
47 config.active_support.deprecation = :stderr
43
48
44 - # Raises error for missing translations
49 + # Raise exceptions for disallowed deprecations.
45 - # config.action_view.raise_on_missing_translations = true
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 end
60 end
@@ -1,7 +1,8
1 # Be sure to restart your server when you modify this file.
1 # Be sure to restart your server when you modify this file.
2
2
3 # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
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.
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!
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"]
@@ -8,18 +8,23
8 # policy.default_src :self, :https
8 # policy.default_src :self, :https
9 # policy.font_src :self, :https, :data
9 # policy.font_src :self, :https, :data
10 # policy.img_src :self, :https, :data
10 # policy.img_src :self, :https, :data
11 # policy.object_src :none
11 # policy.object_src :none
12 # policy.script_src :self, :https
12 # policy.script_src :self, :https
13 # policy.style_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?
14
16
15 # # Specify URI for violation reports
17 # # Specify URI for violation reports
16 # # policy.report_uri "/csp-violation-report-endpoint"
18 # # policy.report_uri "/csp-violation-report-endpoint"
17 # end
19 # end
18
20
19 # If you are using UJS then enable automatic nonce generation
21 # If you are using UJS then enable automatic nonce generation
20 # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
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 # Report CSP violations to a specified URI
27 # Report CSP violations to a specified URI
23 # For further information see the following documentation:
28 # For further information see the following documentation:
24 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
29 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25 # Rails.application.config.content_security_policy_report_only = true
30 # Rails.application.config.content_security_policy_report_only = true
@@ -1,4 +1,6
1 # Be sure to restart your server when you modify this file.
1 # Be sure to restart your server when you modify this file.
2
2
3 # Configure sensitive parameters which will be filtered from the log file.
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,23 +1,32
1 # Puma can serve each request in a thread from an internal thread pool.
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.
2 # The `threads` method setting takes two numbers: a minimum and maximum.
3 # Any libraries that use thread pools should be configured to match
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
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.
5 # and maximum; this matches the default thread size of Active Record.
6 #
6 #
7 - threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
7 + max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 - threads threads_count, threads_count
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 # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
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 # Specifies the `environment` that Puma will run in.
20 # Specifies the `environment` that Puma will run in.
15 #
21 #
16 environment ENV.fetch("RAILS_ENV") { "development" }
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 # Specifies the number of `workers` to boot in clustered mode.
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 # the concurrency of the application would be max `threads` * `workers`.
29 # the concurrency of the application would be max `threads` * `workers`.
21 # Workers do not work on JRuby or Windows (both of which do not support
30 # Workers do not work on JRuby or Windows (both of which do not support
22 # processes).
31 # processes).
23 #
32 #
@@ -1,6 +1,6
1 - %w(
1 + Spring.watch(
2 - .ruby-version
2 + ".ruby-version",
3 - .rbenv-vars
3 + ".rbenv-vars",
4 - tmp/restart.txt
4 + "tmp/restart.txt",
5 - tmp/caching-dev.txt
5 + "tmp/caching-dev.txt"
6 - ).each { |path| Spring.watch(path) }
6 + )
You need to be logged in to leave comments. Login now