Description:
merge with rails7 branch
Commit status:
[Not Reviewed]
References:
merge default
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r824:feb677289536 - - 129 files changed: 850 inserted, 594 deleted

@@ -0,0 +1,4
1 + //= link_tree ../images
2 + //= link_directory ../javascripts .js
3 + //= link_directory ../stylesheets .css
4 +
@@ -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,117
1 + # Be sure to restart your server when you modify this file.
2 + #
3 + # This file eases your Rails 7.0 framework defaults upgrade.
4 + #
5 + # Uncomment each configuration one by one to switch to the new default.
6 + # Once your application is ready to run with all new defaults, you can remove
7 + # this file and set the `config.load_defaults` to `7.0`.
8 + #
9 + # Read the Guide for Upgrading Ruby on Rails for more info on each option.
10 + # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11 +
12 + # `button_to` view helper will render `<button>` element, regardless of whether
13 + # or not the content is passed as the first argument or as a block.
14 + # Rails.application.config.action_view.button_to_generates_button_tag = true
15 +
16 + # `stylesheet_link_tag` view helper will not render the media attribute by default.
17 + # Rails.application.config.action_view.apply_stylesheet_media_default = false
18 +
19 + # Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
20 + # Changing this default means invalidate all encrypted messages generated by
21 + # your application and, all the encrypted cookies. Only change this after you
22 + # rotated all the messages using the key rotator.
23 + #
24 + # See upgrading guide for more information on how to build a rotator.
25 + # https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
26 + # Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
27 +
28 + # Change the digest class for ActiveSupport::Digest.
29 + # Changing this default means that for example Etags change and
30 + # various cache keys leading to cache invalidation.
31 + # Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
32 +
33 + # Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
34 + # implementation.
35 + # Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
36 +
37 + # Change the format of the cache entry.
38 + # Changing this default means that all new cache entries added to the cache
39 + # will have a different format that is not supported by Rails 6.1 applications.
40 + # Only change this value after your application is fully deployed to Rails 7.0
41 + # and you have no plans to rollback.
42 + # Rails.application.config.active_support.cache_format_version = 7.0
43 +
44 + # Calls `Rails.application.executor.wrap` around test cases.
45 + # This makes test cases behave closer to an actual request or job.
46 + # Several features that are normally disabled in test, such as Active Record query cache
47 + # and asynchronous queries will then be enabled.
48 + # Rails.application.config.active_support.executor_around_test_case = true
49 +
50 + # Define the isolation level of most of Rails internal state.
51 + # If you use a fiber based server or job processor, you should set it to `:fiber`.
52 + # Otherwise the default of `:thread` if preferable.
53 + # Rails.application.config.active_support.isolation_level = :thread
54 +
55 + # Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
56 + # Rails.application.config.action_mailer.smtp_timeout = 5
57 +
58 + # The ActiveStorage video previewer will now use scene change detection to generate
59 + # better preview images (rather than the previous default of using the first frame
60 + # of the video).
61 + # Rails.application.config.active_storage.video_preview_arguments =
62 + # "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
63 +
64 + # Automatically infer `inverse_of` for associations with a scope.
65 + # Rails.application.config.active_record.automatic_scope_inversing = true
66 +
67 + # Raise when running tests if fixtures contained foreign key violations
68 + # Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
69 +
70 + # Disable partial inserts.
71 + # This default means that all columns will be referenced in INSERT queries
72 + # regardless of whether they have a default or not.
73 + # Rails.application.config.active_record.partial_inserts = false
74 + #
75 + # Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
76 + # Rails.application.config.action_controller.raise_on_open_redirects = true
77 +
78 + # Change the variant processor for Active Storage.
79 + # Changing this default means updating all places in your code that
80 + # generate variants to use image processing macros and ruby-vips
81 + # operations. See the upgrading guide for detail on the changes required.
82 + # The `:mini_magick` option is not deprecated; it's fine to keep using it.
83 + # Rails.application.config.active_storage.variant_processor = :vips
84 +
85 + # If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
86 + # was `:marshal`. Convert all cookies to JSON, using the `:hybrid` formatter.
87 + #
88 + # If you're confident all your cookies are JSON formatted, you can switch to the `:json` formatter.
89 + #
90 + # Continue to use `:marshal` for backward-compatibility with old cookies.
91 + #
92 + # If you have configured the serializer elsewhere, you can remove this.
93 + #
94 + # See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
95 + # Rails.application.config.action_dispatch.cookies_serializer = :hybrid
96 +
97 + # Enable parameter wrapping for JSON.
98 + # Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
99 + # To disable parameter wrapping entirely, set this config to `false`.
100 + # Rails.application.config.action_controller.wrap_parameters_by_default = true
101 +
102 + # Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
103 + # `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
104 + #
105 + # See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
106 + # more information.
107 + # Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
108 +
109 + # Change the default headers to disable browsers' flawed legacy XSS protection.
110 + # Rails.application.config.action_dispatch.default_headers = {
111 + # "X-Frame-Options" => "SAMEORIGIN",
112 + # "X-XSS-Protection" => "0",
113 + # "X-Content-Type-Options" => "nosniff",
114 + # "X-Download-Options" => "noopen",
115 + # "X-Permitted-Cross-Domain-Policies" => "none",
116 + # "Referrer-Policy" => "strict-origin-when-cross-origin"
117 + # }
@@ -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
@@ -0,0 +1,89
1 + def display_manual
2 + puts <<-USAGE
3 + subtask_score problem last_submision_id sub1_score,sub2_score,sub3_score,....
4 + example:
5 + rails runner subtask_score.rb o64_may26_train 102983 10,15,18,18,39
6 + USAGE
7 + end
8 +
9 + def process_options
10 + res = {}
11 + if ARGV.length == 0
12 + display_manual
13 + exit(1)
14 + end
15 +
16 + res[:prob] = ARGV[0]
17 + res[:last_sub_id] = ARGV[1].to_i
18 + res[:score] = ARGV[2].split(',').map {|x| x.to_i}
19 + return res
20 + end
21 +
22 + def process_subtask(st)
23 + return true if /^P+$/.match(st)
24 + return false
25 + end
26 +
27 + def process_comment(st)
28 + res = []
29 + loop do
30 + break if st.length == 0
31 + if st[0] == '['
32 + #subtask
33 + subtask = st.slice!(0..(st.index(']')))
34 + res << process_subtask(subtask[1..-2])
35 + else #not subtask
36 + res << process_subtask(st[0])
37 + st.slice!(0)
38 + end
39 + end
40 + return res
41 + end
42 +
43 + options = process_options
44 + scoring = options[:score]
45 + puts "doing problem #{options[:prob]}"
46 + puts " consider only submission with id not more than #{options[:last_sub_id]}"
47 + scoring.each.with_index { |x,i| puts " subtask#{i}: #{x}" }
48 +
49 + res = {}
50 +
51 + p = Problem.where(name: options[:prob]).first
52 + unless p
53 + puts "Problem #{options[:prob]} not found"
54 + exit(2)
55 + end
56 +
57 + p.submissions.where('id <= ?',options[:last_sub_id]).order(:id).each do |sub|
58 + unless sub.graded_at
59 + puts "skip ungraded submission #{sub.id}"
60 + next
61 + end
62 + if sub.grader_comment == "compilation error"
63 + puts "skip uncompilable submission #{sub.id}"
64 + next
65 + end
66 +
67 + comment = sub.grader_comment.clone
68 + comment_result = process_comment(comment)
69 + if comment_result.length != scoring.length
70 + puts "ERROR!!! subtask of submission #{sub.id} does not match scoring input"
71 + end
72 +
73 + puts "processing submission #{sub.id} with comment = #{sub.grader_comment} result is #{comment_result}"
74 + current = res[sub.user.login] || [false] * scoring.length
75 + current.each.with_index do |x,i|
76 + if !x && comment_result[i]
77 + puts " user #{sub.user.login} just got subtask #{i+1} from this submission"
78 + current[i] = true
79 + end
80 + end
81 + res[sub.user.login] = current
82 + end
83 +
84 + puts "----summary-----"
85 + res.each do |u,r|
86 + score = scoring.clone
87 + r.each.with_index { |pass,i| score[i] = 0 unless pass }
88 + puts "#{u} #{score.sum} [#{score.join(',')}]"
89 + end
@@ -1,22 +1,28
1 1 source 'https://rubygems.org'
2 2 git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3 3
4 + ruby '3.1.0'
5 +
4 6 #rails
5 - gem 'rails', '~>5.2'
7 + gem 'rails', '~>7.0'
8 +
9 + # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
10 + gem "sprockets-rails"
11 +
6 12 gem 'activerecord-session_store'
7 13 gem 'puma'
8 14
9 15 # Reduces boot times through caching; required in config/boot.rb
10 - gem 'bootsnap', '>= 1.1.0', require: false
16 + gem 'bootsnap', require: false
11 17
12 18 # Bundle edge Rails instead:
13 19 # gem 'rails', :git => 'git://github.com/rails/rails.git'
14 20
15 21 #---------------- database ---------------------
16 22 #the database
17 23 gem 'mysql2'
18 24 #for testing
19 25 gem 'sqlite3'
20 26 gem 'rails-controller-testing'
21 27 #for dumping database into yaml
22 28 gem 'yaml_db'
@@ -32,29 +38,29
32 38
33 39 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
34 40 # gem 'therubyracer', :platforms => :ruby
35 41
36 42 gem 'uglifier'
37 43
38 44 gem 'haml'
39 45 gem 'haml-rails'
40 46
41 47 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42 48 #gem 'turbolinks', '~> 5'
43 49 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
44 - gem 'jbuilder', '~> 2.5'
50 + gem 'jbuilder'
45 51
46 52
47 53 #in-place editor
48 - gem 'best_in_place', '~> 3.0.1'
54 + gem 'best_in_place', git: "https://github.com/mmotherwell/best_in_place"
49 55
50 56 # jquery addition
51 57 gem 'jquery-rails'
52 58 gem 'jquery-ui-rails'
53 59 #gem 'jquery-timepicker-addon-rails'
54 60 gem 'jquery-tablesorter'
55 61 gem 'jquery-countdown-rails'
56 62
57 63 #syntax highlighter
58 64 gem 'rouge'
59 65
60 66 #bootstrap add-ons
@@ -84,33 +90,34
84 90 #gem 'verification', :git => 'https://github.com/sikachu/verification.git'
85 91
86 92
87 93 #---------------- testiing -----------------------
88 94 gem 'minitest-reporters'
89 95
90 96 #---------------- for console --------------------
91 97 gem 'fuzzy-string-match'
92 98
93 99
94 100 group :development, :test do
95 101 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
96 - gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
102 + gem 'debug', platforms: [:mri, :mingw, :x64_mingw]
97 103 end
98 104
99 105 group :development do
100 106 # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
101 107 gem 'web-console', '>= 3.3.0'
102 108 gem 'listen', '>= 3.0.5', '< 3.2'
103 109 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
104 110 gem 'spring'
105 111 gem 'spring-watcher-listen', '~> 2.0.0'
112 +
113 + # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
114 + # gem "rack-mini-profiler"
106 115 end
107 116
108 117 group :test do
109 118 # Adds support for Capybara system testing and selenium driver
110 - gem 'capybara', '>= 2.15'
119 + gem 'capybara'
111 120 gem 'selenium-webdriver'
112 - # Easy installation and use of chromedriver to run system tests with Chrome
113 - #gem 'chromedriver-helper'
114 - gem 'webdriver'
121 + gem 'webdrivers'
115 122 end
116 123
@@ -1,311 +1,373
1 + GIT
2 + remote: https://github.com/mmotherwell/best_in_place
3 + revision: 88eb3052623a9a6cd346864d2aca05021c2f80d0
4 + specs:
5 + best_in_place (3.1.1)
6 + actionpack (>= 3.2)
7 + railties (>= 3.2)
8 +
1 9 GEM
2 10 remote: https://rubygems.org/
3 11 specs:
4 - RubyInline (3.12.4)
12 + RubyInline (3.12.5)
5 13 ZenTest (~> 4.3)
6 - ZenTest (4.11.2)
7 - ace-rails-ap (4.2)
8 - actioncable (5.2.4.2)
9 - actionpack (= 5.2.4.2)
14 + ZenTest (4.12.0)
15 + ace-rails-ap (4.4)
16 + actioncable (7.0.1)
17 + actionpack (= 7.0.1)
18 + activesupport (= 7.0.1)
10 19 nio4r (~> 2.0)
11 20 websocket-driver (>= 0.6.1)
12 - actionmailer (5.2.4.2)
13 - actionpack (= 5.2.4.2)
14 - actionview (= 5.2.4.2)
15 - activejob (= 5.2.4.2)
21 + actionmailbox (7.0.1)
22 + actionpack (= 7.0.1)
23 + activejob (= 7.0.1)
24 + activerecord (= 7.0.1)
25 + activestorage (= 7.0.1)
26 + activesupport (= 7.0.1)
27 + mail (>= 2.7.1)
28 + net-imap
29 + net-pop
30 + net-smtp
31 + actionmailer (7.0.1)
32 + actionpack (= 7.0.1)
33 + actionview (= 7.0.1)
34 + activejob (= 7.0.1)
35 + activesupport (= 7.0.1)
16 36 mail (~> 2.5, >= 2.5.4)
37 + net-imap
38 + net-pop
39 + net-smtp
17 40 rails-dom-testing (~> 2.0)
18 - actionpack (5.2.4.2)
19 - actionview (= 5.2.4.2)
20 - activesupport (= 5.2.4.2)
21 - rack (~> 2.0, >= 2.0.8)
41 + actionpack (7.0.1)
42 + actionview (= 7.0.1)
43 + activesupport (= 7.0.1)
44 + rack (~> 2.0, >= 2.2.0)
22 45 rack-test (>= 0.6.3)
23 46 rails-dom-testing (~> 2.0)
24 - rails-html-sanitizer (~> 1.0, >= 1.0.2)
25 - actionview (5.2.4.2)
26 - activesupport (= 5.2.4.2)
47 + rails-html-sanitizer (~> 1.0, >= 1.2.0)
48 + actiontext (7.0.1)
49 + actionpack (= 7.0.1)
50 + activerecord (= 7.0.1)
51 + activestorage (= 7.0.1)
52 + activesupport (= 7.0.1)
53 + globalid (>= 0.6.0)
54 + nokogiri (>= 1.8.5)
55 + actionview (7.0.1)
56 + activesupport (= 7.0.1)
27 57 builder (~> 3.1)
28 58 erubi (~> 1.4)
29 59 rails-dom-testing (~> 2.0)
30 - rails-html-sanitizer (~> 1.0, >= 1.0.3)
31 - activejob (5.2.4.2)
32 - activesupport (= 5.2.4.2)
60 + rails-html-sanitizer (~> 1.1, >= 1.2.0)
61 + activejob (7.0.1)
62 + activesupport (= 7.0.1)
33 63 globalid (>= 0.3.6)
34 - activemodel (5.2.4.2)
35 - activesupport (= 5.2.4.2)
36 - activerecord (5.2.4.2)
37 - activemodel (= 5.2.4.2)
38 - activesupport (= 5.2.4.2)
39 - arel (>= 9.0)
40 - activerecord-session_store (1.1.3)
41 - actionpack (>= 4.0)
42 - activerecord (>= 4.0)
64 + activemodel (7.0.1)
65 + activesupport (= 7.0.1)
66 + activerecord (7.0.1)
67 + activemodel (= 7.0.1)
68 + activesupport (= 7.0.1)
69 + activerecord-session_store (2.0.0)
70 + actionpack (>= 5.2.4.1)
71 + activerecord (>= 5.2.4.1)
43 72 multi_json (~> 1.11, >= 1.11.2)
44 - rack (>= 1.5.2, < 3)
45 - railties (>= 4.0)
46 - activestorage (5.2.4.2)
47 - actionpack (= 5.2.4.2)
48 - activerecord (= 5.2.4.2)
49 - marcel (~> 0.3.1)
50 - activesupport (5.2.4.2)
73 + rack (>= 2.0.8, < 3)
74 + railties (>= 5.2.4.1)
75 + activestorage (7.0.1)
76 + actionpack (= 7.0.1)
77 + activejob (= 7.0.1)
78 + activerecord (= 7.0.1)
79 + activesupport (= 7.0.1)
80 + marcel (~> 1.0)
81 + mini_mime (>= 1.1.0)
82 + activesupport (7.0.1)
51 83 concurrent-ruby (~> 1.0, >= 1.0.2)
52 - i18n (>= 0.7, < 2)
53 - minitest (~> 5.1)
54 - tzinfo (~> 1.1)
55 - addressable (2.7.0)
84 + i18n (>= 1.6, < 2)
85 + minitest (>= 5.1)
86 + tzinfo (~> 2.0)
87 + addressable (2.8.0)
56 88 public_suffix (>= 2.0.2, < 5.0)
57 89 ansi (1.5.0)
58 - arel (9.0.0)
59 - autoprefixer-rails (9.5.1)
60 - execjs
61 - best_in_place (3.0.3)
62 - actionpack (>= 3.2)
63 - railties (>= 3.2)
90 + autoprefixer-rails (10.4.2.0)
91 + execjs (~> 2)
64 92 bindex (0.8.1)
65 - bootsnap (1.4.6)
93 + bootsnap (1.9.4)
66 94 msgpack (~> 1.0)
67 95 bootstrap-sass (3.4.1)
68 96 autoprefixer-rails (>= 5.2.1)
69 97 sassc (>= 2.0.0)
70 - bootstrap-switch-rails (3.3.4)
98 + bootstrap-switch-rails (3.3.5)
71 99 bootstrap-toggle-rails (2.2.1.0)
72 100 bootstrap3-datetimepicker-rails (4.17.47)
73 101 momentjs-rails (>= 2.8.1)
74 102 builder (3.2.4)
75 - byebug (11.0.1)
76 - capybara (3.15.1)
103 + capybara (3.36.0)
77 104 addressable
105 + matrix
78 106 mini_mime (>= 0.1.3)
79 107 nokogiri (~> 1.8)
80 108 rack (>= 1.6.0)
81 109 rack-test (>= 0.6.3)
82 - regexp_parser (~> 1.2)
110 + regexp_parser (>= 1.5, < 3.0)
83 111 xpath (~> 3.2)
84 - childprocess (3.0.0)
85 - coffee-rails (4.2.2)
112 + childprocess (4.1.0)
113 + coffee-rails (5.0.0)
86 114 coffee-script (>= 2.2.0)
87 - railties (>= 4.0.0)
115 + railties (>= 5.2.0)
88 116 coffee-script (2.4.1)
89 117 coffee-script-source
90 118 execjs
91 119 coffee-script-source (1.12.2)
92 - concurrent-ruby (1.1.6)
120 + concurrent-ruby (1.1.9)
93 121 crass (1.0.6)
122 + debug (1.4.0)
123 + irb (>= 1.3.6)
124 + reline (>= 0.2.7)
125 + digest (3.1.0)
94 126 dynamic_form (1.1.4)
95 - erubi (1.9.0)
127 + erubi (1.10.0)
96 128 erubis (2.7.0)
97 - execjs (2.7.0)
98 - ffi (1.10.0)
129 + execjs (2.8.1)
130 + ffi (1.15.5)
99 131 fuzzy-string-match (1.0.1)
100 132 RubyInline (>= 3.8.6)
101 - globalid (0.4.2)
102 - activesupport (>= 4.2.0)
103 - haml (5.0.4)
133 + globalid (1.0.0)
134 + activesupport (>= 5.0)
135 + haml (5.2.2)
104 136 temple (>= 0.8.0)
105 137 tilt
106 - haml-rails (1.0.0)
107 - actionpack (>= 4.0.1)
108 - activesupport (>= 4.0.1)
138 + haml-rails (2.0.1)
139 + actionpack (>= 5.1)
140 + activesupport (>= 5.1)
109 141 haml (>= 4.0.6, < 6.0)
110 142 html2haml (>= 1.0.1)
111 - railties (>= 4.0.1)
143 + railties (>= 5.1)
112 144 html2haml (2.2.0)
113 145 erubis (~> 2.7.0)
114 146 haml (>= 4.0, < 6)
115 147 nokogiri (>= 1.6.0)
116 148 ruby_parser (~> 3.5)
117 - i18n (1.8.2)
149 + i18n (1.8.11)
118 150 concurrent-ruby (~> 1.0)
119 151 in_place_editing (1.2.0)
120 - jbuilder (2.10.0)
152 + io-console (0.5.11)
153 + io-wait (0.2.1)
154 + irb (1.4.1)
155 + reline (>= 0.3.0)
156 + jbuilder (2.11.5)
157 + actionview (>= 5.0.0)
121 158 activesupport (>= 5.0.0)
122 159 jquery-countdown-rails (2.0.2)
123 - jquery-rails (4.3.3)
160 + jquery-rails (4.4.0)
124 161 rails-dom-testing (>= 1, < 3)
125 162 railties (>= 4.2.0)
126 163 thor (>= 0.14, < 2.0)
127 - jquery-tablesorter (1.26.1)
128 - railties (>= 3.2, < 6)
164 + jquery-tablesorter (1.27.2)
165 + railties (>= 3.2)
129 166 jquery-ui-rails (6.0.1)
130 167 railties (>= 3.2.16)
131 - listen (3.1.5)
168 + listen (3.0.8)
132 169 rb-fsevent (~> 0.9, >= 0.9.4)
133 170 rb-inotify (~> 0.9, >= 0.9.7)
134 - ruby_dep (~> 1.2)
135 - loofah (2.4.0)
171 + loofah (2.13.0)
136 172 crass (~> 1.0.2)
137 173 nokogiri (>= 1.5.9)
138 174 mail (2.7.1)
139 175 mini_mime (>= 0.1.1)
140 - marcel (0.3.3)
141 - mimemagic (~> 0.3.2)
176 + marcel (1.0.2)
177 + matrix (0.4.2)
142 178 method_source (1.0.0)
143 - mimemagic (0.3.4)
144 - mini_mime (1.0.2)
145 - mini_portile2 (2.4.0)
146 - minitest (5.14.0)
147 - minitest-reporters (1.3.6)
179 + mini_mime (1.1.2)
180 + minitest (5.15.0)
181 + minitest-reporters (1.5.0)
148 182 ansi
149 183 builder
150 184 minitest (>= 5.0)
151 185 ruby-progressbar
152 - momentjs-rails (2.20.1)
186 + momentjs-rails (2.29.1.1)
153 187 railties (>= 3.1)
154 - msgpack (1.3.3)
155 - multi_json (1.13.1)
156 - mysql2 (0.5.2)
157 - nio4r (2.5.2)
158 - nokogiri (1.10.9)
159 - mini_portile2 (~> 2.4.0)
160 - public_suffix (4.0.3)
161 - puma (4.3.3)
188 + msgpack (1.4.2)
189 + multi_json (1.15.0)
190 + mysql2 (0.5.3)
191 + net-imap (0.2.3)
192 + digest
193 + net-protocol
194 + strscan
195 + net-pop (0.1.1)
196 + digest
197 + net-protocol
198 + timeout
199 + net-protocol (0.1.2)
200 + io-wait
201 + timeout
202 + net-smtp (0.3.1)
203 + digest
204 + net-protocol
205 + timeout
206 + nio4r (2.5.8)
207 + nokogiri (1.13.1-x86_64-linux)
208 + racc (~> 1.4)
209 + public_suffix (4.0.6)
210 + puma (5.5.2)
162 211 nio4r (~> 2.0)
163 - rack (2.2.2)
212 + racc (1.6.0)
213 + rack (2.2.3)
164 214 rack-test (1.1.0)
165 215 rack (>= 1.0, < 3)
166 - rails (5.2.4.2)
167 - actioncable (= 5.2.4.2)
168 - actionmailer (= 5.2.4.2)
169 - actionpack (= 5.2.4.2)
170 - actionview (= 5.2.4.2)
171 - activejob (= 5.2.4.2)
172 - activemodel (= 5.2.4.2)
173 - activerecord (= 5.2.4.2)
174 - activestorage (= 5.2.4.2)
175 - activesupport (= 5.2.4.2)
176 - bundler (>= 1.3.0)
177 - railties (= 5.2.4.2)
178 - sprockets-rails (>= 2.0.0)
179 - rails-controller-testing (1.0.4)
180 - actionpack (>= 5.0.1.x)
181 - actionview (>= 5.0.1.x)
182 - activesupport (>= 5.0.1.x)
216 + rails (7.0.1)
217 + actioncable (= 7.0.1)
218 + actionmailbox (= 7.0.1)
219 + actionmailer (= 7.0.1)
220 + actionpack (= 7.0.1)
221 + actiontext (= 7.0.1)
222 + actionview (= 7.0.1)
223 + activejob (= 7.0.1)
224 + activemodel (= 7.0.1)
225 + activerecord (= 7.0.1)
226 + activestorage (= 7.0.1)
227 + activesupport (= 7.0.1)
228 + bundler (>= 1.15.0)
229 + railties (= 7.0.1)
230 + rails-controller-testing (1.0.5)
231 + actionpack (>= 5.0.1.rc1)
232 + actionview (>= 5.0.1.rc1)
233 + activesupport (>= 5.0.1.rc1)
183 234 rails-dom-testing (2.0.3)
184 235 activesupport (>= 4.2.0)
185 236 nokogiri (>= 1.6)
186 - rails-html-sanitizer (1.3.0)
237 + rails-html-sanitizer (1.4.2)
187 238 loofah (~> 2.3)
188 - rails_bootstrap_sortable (2.0.6)
239 + rails_bootstrap_sortable (2.0.7)
189 240 momentjs-rails (>= 2.8.3)
190 - railties (5.2.4.2)
191 - actionpack (= 5.2.4.2)
192 - activesupport (= 5.2.4.2)
241 + railties (7.0.1)
242 + actionpack (= 7.0.1)
243 + activesupport (= 7.0.1)
193 244 method_source
194 - rake (>= 0.8.7)
195 - thor (>= 0.19.0, < 2.0)
196 - rake (13.0.1)
197 - rb-fsevent (0.10.3)
198 - rb-inotify (0.10.0)
245 + rake (>= 12.2)
246 + thor (~> 1.0)
247 + zeitwerk (~> 2.5)
248 + rake (13.0.6)
249 + rb-fsevent (0.11.0)
250 + rb-inotify (0.10.1)
199 251 ffi (~> 1.0)
200 - rdiscount (2.2.0.1)
201 - regexp_parser (1.7.0)
202 - rouge (3.3.0)
203 - ruby-progressbar (1.10.0)
204 - ruby_dep (1.5.0)
205 - ruby_parser (3.13.1)
206 - sexp_processor (~> 4.9)
207 - rubyzip (1.3.0)
208 - sassc (2.2.1)
252 + rdiscount (2.2.0.2)
253 + regexp_parser (2.2.0)
254 + reline (0.3.1)
255 + io-console (~> 0.5)
256 + rexml (3.2.5)
257 + rouge (3.27.0)
258 + ruby-progressbar (1.11.0)
259 + ruby_parser (3.18.1)
260 + sexp_processor (~> 4.16)
261 + rubyzip (2.3.2)
262 + sassc (2.4.0)
209 263 ffi (~> 1.9)
210 264 sassc-rails (2.1.2)
211 265 railties (>= 4.0.0)
212 266 sassc (>= 2.0)
213 267 sprockets (> 3.0)
214 268 sprockets-rails
215 269 tilt
216 - select2-rails (4.0.3)
217 - thor (~> 0.14)
218 - selenium-webdriver (3.142.7)
219 - childprocess (>= 0.5, < 4.0)
270 + select2-rails (4.0.13)
271 + selenium-webdriver (4.1.0)
272 + childprocess (>= 0.5, < 5.0)
273 + rexml (~> 3.2, >= 3.2.5)
220 274 rubyzip (>= 1.2.2)
221 - sexp_processor (4.12.0)
222 - simple_form (5.0.2)
223 - actionpack (>= 5.0)
224 - activemodel (>= 5.0)
225 - spring (2.0.2)
226 - activesupport (>= 4.2)
275 + sexp_processor (4.16.0)
276 + simple_form (5.1.0)
277 + actionpack (>= 5.2)
278 + activemodel (>= 5.2)
279 + spring (2.1.1)
227 280 spring-watcher-listen (2.0.1)
228 281 listen (>= 2.7, < 4.0)
229 282 spring (>= 1.2, < 3.0)
230 - sprockets (3.7.2)
283 + sprockets (4.0.2)
231 284 concurrent-ruby (~> 1.0)
232 285 rack (> 1, < 3)
233 - sprockets-rails (3.2.1)
234 - actionpack (>= 4.0)
235 - activesupport (>= 4.0)
286 + sprockets-rails (3.4.2)
287 + actionpack (>= 5.2)
288 + activesupport (>= 5.2)
236 289 sprockets (>= 3.0.0)
237 - sqlite3 (1.4.1)
238 - temple (0.8.1)
239 - thor (0.20.3)
240 - thread_safe (0.3.6)
241 - tilt (2.0.9)
242 - tzinfo (1.2.7)
243 - thread_safe (~> 0.1)
244 - uglifier (4.1.20)
290 + sqlite3 (1.4.2)
291 + strscan (3.0.1)
292 + temple (0.8.2)
293 + thor (1.2.1)
294 + tilt (2.0.10)
295 + timeout (0.2.0)
296 + tzinfo (2.0.4)
297 + concurrent-ruby (~> 1.0)
298 + uglifier (4.2.0)
245 299 execjs (>= 0.3.0, < 3)
246 - web-console (3.7.0)
247 - actionview (>= 5.0)
248 - activemodel (>= 5.0)
300 + web-console (4.2.0)
301 + actionview (>= 6.0.0)
302 + activemodel (>= 6.0.0)
249 303 bindex (>= 0.4.0)
250 - railties (>= 5.0)
251 - webdriver (0.5.0)
252 - websocket-driver (0.7.1)
304 + railties (>= 6.0.0)
305 + webdrivers (5.0.0)
306 + nokogiri (~> 1.6)
307 + rubyzip (>= 1.3.0)
308 + selenium-webdriver (~> 4.0)
309 + websocket-driver (0.7.5)
253 310 websocket-extensions (>= 0.1.0)
254 - websocket-extensions (0.1.4)
311 + websocket-extensions (0.1.5)
255 312 xpath (3.2.0)
256 313 nokogiri (~> 1.8)
257 314 yaml_db (0.7.0)
258 315 rails (>= 3.0)
259 316 rake (>= 0.8.7)
317 + zeitwerk (2.5.3)
260 318
261 319 PLATFORMS
262 - ruby
320 + x86_64-linux
263 321
264 322 DEPENDENCIES
265 323 ace-rails-ap
266 324 activerecord-session_store
267 325 autoprefixer-rails
268 - best_in_place (~> 3.0.1)
269 - bootsnap (>= 1.1.0)
326 + best_in_place!
327 + bootsnap
270 328 bootstrap-sass (~> 3.4.1)
271 329 bootstrap-switch-rails
272 330 bootstrap-toggle-rails
273 331 bootstrap3-datetimepicker-rails (~> 4.17.47)
274 - byebug
275 - capybara (>= 2.15)
332 + capybara
276 333 coffee-rails
334 + debug
277 335 dynamic_form
278 336 fuzzy-string-match
279 337 haml
280 338 haml-rails
281 339 in_place_editing
282 - jbuilder (~> 2.5)
340 + jbuilder
283 341 jquery-countdown-rails
284 342 jquery-rails
285 343 jquery-tablesorter
286 344 jquery-ui-rails
287 345 listen (>= 3.0.5, < 3.2)
288 346 mail
289 347 minitest-reporters
290 348 momentjs-rails (>= 2.9.0)
291 349 mysql2
292 350 puma
293 - rails (~> 5.2)
351 + rails (~> 7.0)
294 352 rails-controller-testing
295 353 rails_bootstrap_sortable
296 354 rdiscount
297 355 rouge
298 356 sassc-rails
299 357 select2-rails
300 358 selenium-webdriver
301 359 simple_form
302 360 spring
303 361 spring-watcher-listen (~> 2.0.0)
362 + sprockets-rails
304 363 sqlite3
305 364 uglifier
306 365 web-console (>= 3.3.0)
307 - webdriver
366 + webdrivers
308 367 yaml_db
309 368
369 + RUBY VERSION
370 + ruby 3.1.0p0
371 +
310 372 BUNDLED WITH
311 - 1.17.2
373 + 2.3.3
@@ -36,31 +36,45
36 36 Since Ubuntu has dedicated package for RVM we will use that. Just follow instruction given in https://github.com/rvm/ubuntu_rvm. For your convenience, the step are reproduced here.
37 37
38 38 First, we install necessary package for installing RVM.
39 39
40 40 cafe@grader:~$ sudo apt install software-properties-common
41 41
42 42 Second, we add the custom PPA, update the system and install RVM.
43 43
44 44 cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm
45 45 cafe@grader:~$ sudo apt-get update
46 46 cafe@grader:~$ sudo apt-get install rvm
47 47
48 - This is very important. You have to logout and login again since RVM change a lots of system.
48 + We also need to add our user to the rvm group
49 +
50 + sudo usermod -a -G rvm $USER
49 51
50 - If you are using GUI version of Ubuntu, be sure to have Gnome Terminal (or any other terminal you are using) perform login every time. This can be done by mark the check box "Run command as a login shell" in Gnome terminal or by adding --login to bash.
52 + This is very important.
53 + 1. You have to reboot since RVM change a lots of system.
54 + 2. If you are using GUI version of Ubuntu, be sure to have Gnome Terminal (or any other terminal you are using) perform login every time. This can be done by mark the check box "Run command as a login shell" in Gnome terminal or by adding --login to bash.
55 +
56 + === 3. Install necessary package and nodejs
51 57
52 - === 3. Install necessary package
58 + First, we install required package via apt.
59 +
60 + cafe@grader:~$ sudo apt install libmysqlclient-dev default-jdk unzip php-cli apache2 dirmngr gnupg apache2-dev
61 +
62 + Since nodejs that comes with ubuntu 18.04 is very outdated, we need to install it manually. This follow the method outlined in https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04 under *Installing Node.js with Apt Using a NodeSource PPA*
53 63
54 - cafe@grader:~$ sudo apt install libmysqlclient-dev default-jdk unzip nodejs php-cli apache2 dirmngr gnupg apache2-dev
64 + cd ~
65 + curl -sL https://deb.nodesource.com/setup_17.x -o nodesource_setup.sh
66 + sudo bash nodesource_setup.sh
67 + sudo apt install nodejs
68 +
55 69
56 70 === 4. Install cafe-grader
57 71
58 72 First, ensure that RVM is installed correctly.
59 73
60 74 cafe@grader:~$ rvm
61 75
62 76 If you get a result similar to this.
63 77
64 78 Command 'rvm' not found, but there are 21 similar ones.
65 79
66 80 It is very likely that you have not re-login or you are using bash without --login. Please do so and re-read the installation of RVM on Ubuntu https://github.com/rvm/ubuntu_rvm again.
@@ -0,0 +1,18
1 + table.graders tr {
2 + &.active {
3 + border: 1px solid black;
4 + background: lightgreen;
5 + text-align: center;
6 + }
7 +
8 + &.inactive {
9 + border: 1px solid black;
10 + background: #ffcccc;
11 + text-align: center;
12 + }
13 + }
14 +
15 + .submitbox .item {
16 + padding-right: 5px;
17 + float: left;
18 + }
@@ -0,0 +1,15
1 + tr {
2 + &.available {
3 + background: #c0ffc0;
4 + }
5 +
6 + &.not-available {
7 + background: #ffc0c0;
8 + }
9 + }
10 +
11 + .import-log {
12 + background: lightgray;
13 + border: solid black 1px;
14 + padding: 10px;
15 + }
@@ -1,4 +1,4
1 1 #!/usr/bin/env ruby
2 - APP_PATH = File.expand_path('../config/application', __dir__)
3 - require_relative '../config/boot'
4 - require 'rails/commands'
2 + APP_PATH = File.expand_path("../config/application", __dir__)
3 + require_relative "../config/boot"
4 + require "rails/commands"
@@ -1,4 +1,4
1 1 #!/usr/bin/env ruby
2 - require_relative '../config/boot'
3 - require 'rake'
2 + require_relative "../config/boot"
3 + require "rake"
4 4 Rake.application.run
@@ -1,36 +1,33
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 - APP_ROOT = File.expand_path('..', __dir__)
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 - puts '== Installing dependencies =='
17 - system! 'gem install bundler --conservative'
18 - system('bundle check') || system!('bundle install')
19 -
20 - # Install JavaScript dependencies if using Yarn
21 - # system('bin/yarn')
16 + puts "== Installing dependencies =="
17 + system! "gem install bundler --conservative"
18 + system("bundle check") || system!("bundle install")
22 19
23 20 # puts "\n== Copying sample files =="
24 - # unless File.exist?('config/database.yml')
25 - # cp 'config/database.yml.sample', 'config/database.yml'
21 + # unless File.exist?("config/database.yml")
22 + # FileUtils.cp "config/database.yml.sample", "config/database.yml"
26 23 # end
27 24
28 25 puts "\n== Preparing database =="
29 - system! 'bin/rails db:setup'
26 + system! "bin/rails db:prepare"
30 27
31 28 puts "\n== Removing old logs and tempfiles =="
32 - system! 'bin/rails log:clear tmp:clear'
29 + system! "bin/rails log:clear tmp:clear"
33 30
34 31 puts "\n== Restarting application server =="
35 - system! 'bin/rails restart'
32 + system! "bin/rails restart"
36 33 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 - 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.
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,75
1 + require "active_support/core_ext/integer/time"
2 +
1 3 Rails.application.configure do
2 4 # Settings specified here will take precedence over those in config/application.rb.
3 5
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
6 + # In the development environment your application's code is reloaded any time
7 + # it changes. This slows down response time but is perfect for development
6 8 # since you don't have to restart the web server when you make code changes.
7 9 config.cache_classes = false
8 10
9 11 # Do not eager load code on boot.
10 12 config.eager_load = false
11 13
12 14 # Show full error reports.
13 15 config.consider_all_requests_local = true
14 16
17 + # Enable server timing
18 + config.server_timing = true
19 +
15 20 # Enable/disable caching. By default caching is disabled.
16 21 # Run rails dev:cache to toggle caching.
17 - if Rails.root.join('tmp', 'caching-dev.txt').exist?
22 + if Rails.root.join("tmp/caching-dev.txt").exist?
18 23 config.action_controller.perform_caching = true
24 + config.action_controller.enable_fragment_cache_logging = true
19 25
20 26 config.cache_store = :memory_store
21 27 config.public_file_server.headers = {
22 - 'Cache-Control' => "public, max-age=#{2.days.to_i}"
28 + "Cache-Control" => "public, max-age=#{2.days.to_i}"
23 29 }
24 30 else
25 31 config.action_controller.perform_caching = false
26 32
27 33 config.cache_store = :null_store
28 34 end
29 35
30 - # Store uploaded files on the local file system (see config/storage.yml for options)
36 + # Store uploaded files on the local file system (see config/storage.yml for options).
31 37 config.active_storage.service = :local
32 38
33 39 # Don't care if the mailer can't send.
34 40 config.action_mailer.raise_delivery_errors = false
35 41
36 42 config.action_mailer.perform_caching = false
37 43
38 44 # Print deprecation notices to the Rails logger.
39 45 config.active_support.deprecation = :log
40 46
47 + # Raise exceptions for disallowed deprecations.
48 + config.active_support.disallowed_deprecation = :raise
49 +
50 + # Tell Active Support which deprecation messages to disallow.
51 + config.active_support.disallowed_deprecation_warnings = []
52 +
41 53 # Raise an error on page load if there are pending migrations.
42 54 config.active_record.migration_error = :page_load
43 55
44 56 # Highlight code that triggered database queries in logs.
45 57 config.active_record.verbose_query_logs = true
46 58
47 59 # Debug mode disables concatenation and preprocessing of assets.
48 60 # This option may cause significant delays in view rendering with a large
49 61 # number of complex assets.
50 62 config.assets.debug = true
51 63
52 64 # Suppress logger output for asset requests.
53 65 config.assets.quiet = true
54 66
55 - # Raises error for missing translations
56 - # config.action_view.raise_on_missing_translations = true
67 + # Raises error for missing translations.
68 + # config.i18n.raise_on_missing_translations = true
57 69
58 - # Use an evented file watcher to asynchronously detect changes in source code,
59 - # routes, locales, etc. This feature depends on the listen gem.
60 - config.file_watcher = ActiveSupport::EventedFileUpdateChecker
70 + # Annotate rendered view with file names.
71 + # config.action_view.annotate_rendered_view_with_filenames = true
72 +
73 + # Uncomment if you wish to allow Action Cable access from any origin.
74 + # config.action_cable.disable_request_forgery_protection = true
61 75 end
@@ -1,94 +1,99
1 + require "active_support/core_ext/integer/time"
2 +
1 3 Rails.application.configure do
2 4 # Settings specified here will take precedence over those in config/application.rb.
3 5
4 6 # Code is not reloaded between requests.
5 7 config.cache_classes = true
6 8
7 9 # Eager load code on boot. This eager loads most of Rails and
8 10 # your application in memory, allowing both threaded web servers
9 11 # and those relying on copy on write to perform better.
10 12 # Rake tasks automatically ignore this option for performance.
11 13 config.eager_load = true
12 14
13 15 # Full error reports are disabled and caching is turned on.
14 16 config.consider_all_requests_local = false
15 17 config.action_controller.perform_caching = true
16 18
17 19 # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18 20 # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19 21 # config.require_master_key = true
20 22
21 23 # Disable serving static files from the `/public` folder by default since
22 24 # Apache or NGINX already handles this.
23 - config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
25 + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
24 26
25 - # Compress JavaScripts and CSS.
26 - config.assets.js_compressor = :uglifier
27 + # Compress CSS using a preprocessor.
27 28 # config.assets.css_compressor = :sass
28 29
29 30 # Do not fallback to assets pipeline if a precompiled asset is missed.
30 31 config.assets.compile = false
31 32
32 - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
33 -
34 33 # Enable serving of images, stylesheets, and JavaScripts from an asset server.
35 - # config.action_controller.asset_host = 'http://assets.example.com'
34 + # config.asset_host = "http://assets.example.com"
36 35
37 36 # Specifies the header that your server uses for sending files.
38 - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
39 - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
37 + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
38 + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
40 39
41 - # Store uploaded files on the local file system (see config/storage.yml for options)
40 + # Store uploaded files on the local file system (see config/storage.yml for options).
42 41 config.active_storage.service = :local
43 42
44 - # Mount Action Cable outside main process or domain
43 + # Mount Action Cable outside main process or domain.
45 44 # config.action_cable.mount_path = nil
46 - # config.action_cable.url = 'wss://example.com/cable'
47 - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
45 + # config.action_cable.url = "wss://example.com/cable"
46 + # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
48 47
49 48 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
50 49 # config.force_ssl = true
51 50
52 - # Use the lowest log level to ensure availability of diagnostic information
53 - # when problems arise.
54 - config.log_level = :debug
51 + # Include generic and useful information about system operation, but avoid logging too much
52 + # information to avoid inadvertent exposure of personally identifiable information (PII).
53 + config.log_level = :info
55 54
56 55 # Prepend all log lines with the following tags.
57 56 config.log_tags = [ :request_id ]
58 57
59 58 # Use a different cache store in production.
60 59 # config.cache_store = :mem_cache_store
61 60
62 - # Use a real queuing backend for Active Job (and separate queues per environment)
61 + # Use a real queuing backend for Active Job (and separate queues per environment).
63 62 # config.active_job.queue_adapter = :resque
64 - # config.active_job.queue_name_prefix = "cafe_grader_#{Rails.env}"
63 + # config.active_job.queue_name_prefix = "cafe_grader_production"
65 64
66 65 config.action_mailer.perform_caching = false
67 66
68 67 # Ignore bad email addresses and do not raise email delivery errors.
69 68 # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70 69 # config.action_mailer.raise_delivery_errors = false
71 70
72 71 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73 72 # the I18n.default_locale when a translation cannot be found).
74 73 config.i18n.fallbacks = true
75 74
76 75 # Send deprecation notices to registered listeners.
77 76 config.active_support.deprecation = :notify
78 77
78 + # Log disallowed deprecations.
79 + config.active_support.disallowed_deprecation = :log
80 +
81 + # Tell Active Support which deprecation messages to disallow.
82 + config.active_support.disallowed_deprecation_warnings = []
83 +
79 84 # Use default logging formatter so that PID and timestamp are not suppressed.
80 85 config.log_formatter = ::Logger::Formatter.new
81 86
82 87 # Use a different logger for distributed setups.
83 - # require 'syslog/logger'
84 - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
88 + # require "syslog/logger"
89 + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
85 90
86 91 if ENV["RAILS_LOG_TO_STDOUT"].present?
87 92 logger = ActiveSupport::Logger.new(STDOUT)
88 93 logger.formatter = config.log_formatter
89 94 config.logger = ActiveSupport::TaggedLogging.new(logger)
90 95 end
91 96
92 97 # Do not dump schema after migrations.
93 98 config.active_record.dump_schema_after_migration = false
94 99 end
@@ -1,46 +1,60
1 - Rails.application.configure do
2 - # Settings specified here will take precedence over those in config/application.rb.
1 + require "active_support/core_ext/integer/time"
3 2
4 3 # The test environment is used exclusively to run your application's
5 4 # test suite. You never need to work with it otherwise. Remember that
6 5 # your test database is "scratch space" for the test suite and is wiped
7 6 # and recreated between test runs. Don't rely on the data there!
7 +
8 + Rails.application.configure do
9 + # Settings specified here will take precedence over those in config/application.rb.
10 +
11 + # Turn false under Spring and add config.action_view.cache_template_loading = true.
8 12 config.cache_classes = true
9 13
10 - # 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
12 - # preloads Rails for running tests, you may have to set it to true.
13 - config.eager_load = false
14 + # Eager loading loads your whole application. When running a single test locally,
15 + # this probably isn't necessary. It's a good idea to do in a continuous integration
16 + # system, or in some way before deploying your code.
17 + config.eager_load = ENV["CI"].present?
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 - 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
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,16 +1,16
1 1 # Be sure to restart your server when you modify this file.
2 2
3 3 # Version of your assets, change this if you want to expire all your assets.
4 - Rails.application.config.assets.version = '1.0'
4 + Rails.application.config.assets.version = "1.0"
5 5
6 6 # Add additional assets to the asset load path.
7 7 # Rails.application.config.assets.paths << Emoji.images_path
8 8 # Add Yarn node_modules folder to the asset load path.
9 9 Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 10
11 11 # Precompile additional assets.
12 12 # application.js, application.css, and all non-JS/CSS in the app/assets
13 13 # folder are already added.
14 14 # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15 15 Rails.application.config.assets.precompile += ['announcement_refresh.js','effects.js','site_update.js']
16 16 Rails.application.config.assets.precompile += ['local_jquery.js','tablesorter-theme.cafe.css']
@@ -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"]
@@ -1,25 +1,26
1 1 # Be sure to restart your server when you modify this file.
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 - # Rails.application.config.content_security_policy do |policy|
7 + # Rails.application.configure do
8 + # config.content_security_policy do |policy|
8 9 # policy.default_src :self, :https
9 10 # policy.font_src :self, :https, :data
10 11 # policy.img_src :self, :https, :data
11 12 # policy.object_src :none
12 13 # policy.script_src :self, :https
13 14 # policy.style_src :self, :https
14 -
15 15 # # Specify URI for violation reports
16 16 # # policy.report_uri "/csp-violation-report-endpoint"
17 17 # end
18 -
19 - # If you are using UJS then enable automatic nonce generation
20 - # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21 -
22 - # Report CSP violations to a specified URI
23 - # For further information see the following documentation:
24 - # 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
18 + #
19 + # # Generate session nonces for permitted importmap and inline scripts
20 + # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21 + # config.content_security_policy_nonce_directives = %w(script-src)
22 + #
23 + # # Report CSP violations to a specified URI. See:
24 + # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25 + # # config.content_security_policy_report_only = true
26 + # end
@@ -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,16 +1,16
1 1 # Be sure to restart your server when you modify this file.
2 2
3 3 # Add new inflection rules using the following format. Inflections
4 4 # are locale specific, and you may define rules for as many different
5 5 # locales as you wish. All of these examples are active by default:
6 6 # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 - # inflect.plural /^(ox)$/i, '\1en'
8 - # inflect.singular /^(ox)en/i, '\1'
9 - # inflect.irregular 'person', 'people'
7 + # inflect.plural /^(ox)$/i, "\\1en"
8 + # inflect.singular /^(ox)en/i, "\\1"
9 + # inflect.irregular "person", "people"
10 10 # inflect.uncountable %w( fish sheep )
11 11 # end
12 12
13 13 # These inflection rules are supported but not enabled by default:
14 14 # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 - # inflect.acronym 'RESTful'
15 + # inflect.acronym "RESTful"
16 16 # end
@@ -1,29 +1,38
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 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 28 # Workers are forked webserver 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.
@@ -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 + )
@@ -1,15 +1,15
1 - class CreateUsers < ActiveRecord::Migration
1 + class CreateUsers < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :users do |t|
3 + create_table :users, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :login, :string, :limit => 10
5 5 t.column :full_name, :string
6 6 t.column :hashed_password, :string
7 7 t.column :salt, :string, :limit => 5
8 8 t.column :alias, :string
9 9 end
10 10 # force unique name
11 11 add_index :users, :login, :unique => true
12 12 end
13 13
14 14 def self.down
15 15 drop_table :users
@@ -1,15 +1,15
1 - class CreateProblems < ActiveRecord::Migration
1 + class CreateProblems < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :problems do |t|
3 + create_table :problems, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :name, :string, :limit => 30
5 5 t.column :full_name, :string
6 6 t.column :full_score, :integer
7 7 t.column :date_added, :date
8 8 t.column :available, :boolean
9 9 end
10 10 end
11 11
12 12 def self.down
13 13 drop_table :problems
14 14 end
15 15 end
@@ -1,15 +1,15
1 - class CreateSubmissions < ActiveRecord::Migration
1 + class CreateSubmissions < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :submissions do |t|
3 + create_table :submissions, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :user_id, :integer
5 5 t.column :problem_id, :integer
6 6 t.column :language_id, :integer
7 7 t.column :source, :text
8 8 t.column :binary, :binary
9 9 t.column :submitted_at, :datetime
10 10 t.column :compiled_at, :datetime
11 11 t.column :compiler_message, :text
12 12 t.column :graded_at, :datetime
13 13 t.column :points, :integer
14 14 t.column :grader_comment, :text
15 15 end
@@ -1,15 +1,15
1 - class CreateLanguages < ActiveRecord::Migration
1 + class CreateLanguages < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :languages do |t|
3 + create_table :languages, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :name, :string, :limit => 10
5 5 t.column :pretty_name, :string
6 6 end
7 7
8 8 Language.create(:name => "c", :pretty_name => "C")
9 9 Language.create(:name => "cpp", :pretty_name => "C++")
10 10 Language.create(:name => "pas", :pretty_name => "Pascal")
11 11 end
12 12
13 13 def self.down
14 14 drop_table :languages
15 15 end
@@ -1,9 +1,9
1 - class AddIndexToSubmissions < ActiveRecord::Migration
1 + class AddIndexToSubmissions < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_index :submissions, [:user_id, :problem_id]
4 4 end
5 5
6 6 def self.down
7 7 remove_index :submissions, :column => [:user_id, :problem_id]
8 8 end
9 9 end
@@ -1,19 +1,19
1 - class CreateRoles < ActiveRecord::Migration
1 + class CreateRoles < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :roles do |t|
3 + create_table :roles, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column 'name', :string
5 5 end
6 6
7 - create_table :roles_users, :id => false do |t|
7 + create_table :roles_users, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
8 8 t.column 'role_id', :integer
9 9 t.column 'user_id', :integer
10 10 end
11 11
12 12 add_index :roles_users, :user_id
13 13 end
14 14
15 15 def self.down
16 16 drop_table :roles_users
17 17 drop_table :roles
18 18 end
19 19 end
@@ -1,21 +1,21
1 - class CreateRights < ActiveRecord::Migration
1 + class CreateRights < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :rights do |t|
3 + create_table :rights, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column 'name', :string
5 5 t.column 'controller', :string
6 6 t.column 'action', :string
7 7 end
8 8
9 - create_table :rights_roles, :id => false do |t|
9 + create_table :rights_roles, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
10 10 t.column 'right_id', :integer
11 11 t.column 'role_id', :integer
12 12 end
13 13
14 14 add_index :rights_roles, :role_id
15 15 end
16 16
17 17 def self.down
18 18 drop_table :rights_roles
19 19 drop_table :rights
20 20 end
21 21 end
@@ -1,12 +1,12
1 - class CreateTasks < ActiveRecord::Migration
1 + class CreateTasks < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :tasks do |t|
3 + create_table :tasks, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column 'submission_id', :integer
5 5 t.column 'created_at', :datetime
6 6 end
7 7 end
8 8
9 9 def self.down
10 10 drop_table :tasks
11 11 end
12 12 end
@@ -1,15 +1,15
1 - class AddSessions < ActiveRecord::Migration
1 + class AddSessions < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :sessions do |t|
3 + create_table :sessions, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :session_id, :string
5 5 t.column :data, :text
6 6 t.column :updated_at, :datetime
7 7 end
8 8
9 9 add_index :sessions, :session_id
10 10 add_index :sessions, :updated_at
11 11 end
12 12
13 13 def self.down
14 14 drop_table :sessions
15 15 end
@@ -1,13 +1,13
1 - class AddLanguageExt < ActiveRecord::Migration
1 + class AddLanguageExt < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :languages, :ext, :string, :limit => 10
4 4
5 5 Language.reset_column_information
6 6 langs = Language.all
7 7 langs.each do |l|
8 8 l.ext = l.name
9 9 l.save
10 10 end
11 11 end
12 12
13 13 def self.down
@@ -1,9 +1,9
1 - class AddEmailToUsers < ActiveRecord::Migration
1 + class AddEmailToUsers < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :users, :email, :string
4 4 end
5 5
6 6 def self.down
7 7 remove_column :users, :email
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class AddUrlToProblem < ActiveRecord::Migration
1 + class AddUrlToProblem < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :problems, :url, :string
4 4 end
5 5
6 6 def self.down
7 7 remove_column :problems, :url
8 8 end
9 9 end
@@ -1,15 +1,15
1 - class CreateGraderProcesses < ActiveRecord::Migration
1 + class CreateGraderProcesses < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :grader_processes do |t|
3 + create_table :grader_processes, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :ip, :string, :limit => 20
5 5 t.column :pid, :integer
6 6 t.column :mode, :string
7 7 t.column :active, :boolean
8 8 t.timestamps
9 9 end
10 10 add_index :grader_processes, ["ip","pid"]
11 11 end
12 12
13 13 def self.down
14 14 drop_table :grader_processes
15 15 end
@@ -1,13 +1,13
1 - class AddStatusToTasks < ActiveRecord::Migration
1 + class AddStatusToTasks < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :tasks, :status, :integer
4 4 add_column :tasks, :updated_at, :datetime
5 5
6 6 Task.reset_column_information
7 7 Task.all.each do |task|
8 8 task.status_complete
9 9 task.save
10 10 end
11 11 end
12 12
13 13 def self.down
@@ -1,9 +1,9
1 - class AddTaskToGraderProcess < ActiveRecord::Migration
1 + class AddTaskToGraderProcess < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :grader_processes, :task_id, :integer
4 4 end
5 5
6 6 def self.down
7 7 remove_column :grader_processes, :task_id
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class RenameGraderProcessColumnIpToHost < ActiveRecord::Migration
1 + class RenameGraderProcessColumnIpToHost < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 rename_column :grader_processes, :ip, :host
4 4 end
5 5
6 6 def self.down
7 7 rename_column :grader_processes, :host, :ip
8 8 end
9 9 end
@@ -1,13 +1,13
1 - class AddNumberToSubmissions < ActiveRecord::Migration
1 + class AddNumberToSubmissions < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :submissions, :number, :integer
4 4
5 5 # add number field for all records
6 6 Submission.reset_column_information
7 7
8 8 last_user_id = nil
9 9 last_problem_id = nil
10 10 current_number = 0
11 11
12 12 Submission.order('user_id, problem_id, submitted_at').each do |submission|
13 13 if submission.user_id==last_user_id and submission.problem_id==last_problem_id
@@ -1,25 +1,24
1 - class CreateTestRequests < ActiveRecord::Migration
1 + class CreateTestRequests < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :test_requests do |t|
3 + create_table :test_requests, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :user_id, :integer
5 5 t.column :problem_id, :integer
6 6 t.column :submission_id, :integer
7 7 t.column :input_file_name, :string
8 8 t.column :output_file_name, :string
9 9 t.column :running_stat, :string
10 10
11 11 # these are similar to tasks
12 12 t.column :status, :integer
13 - t.column :updated_at, :datetime
14 13
15 14 # these are intentionally similar to submissions
16 15 t.column :submitted_at, :datetime
17 16 t.column :compiled_at, :datetime
18 17 t.column :compiler_message, :string
19 18 t.column :graded_at, :datetime
20 19 t.column :grader_comment, :string
21 20 t.timestamps
22 21 end
23 22 add_index :test_requests, [:user_id, :problem_id]
24 23 end
25 24
@@ -1,9 +1,9
1 - class ChangeCompilerMessageTypeTestRequest < ActiveRecord::Migration
1 + class ChangeCompilerMessageTypeTestRequest < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 change_column :test_requests, :compiler_message, :text
4 4 end
5 5
6 6 def self.down
7 7 change_column :test_requests, :compiler_message, :string
8 8 end
9 9 end
@@ -1,14 +1,14
1 - class CreateConfigurations < ActiveRecord::Migration
1 + class CreateConfigurations < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :configurations do |t|
3 + create_table :configurations, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :key, :string
5 5 t.column :value_type, :string
6 6 t.column :value, :string
7 7 t.timestamps
8 8 end
9 9 end
10 10
11 11 def self.down
12 12 drop_table :configurations
13 13 end
14 14 end
@@ -1,13 +1,13
1 - class AddRunstatColumnsToTestRequest < ActiveRecord::Migration
1 + class AddRunstatColumnsToTestRequest < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :test_requests, :running_time, :float
4 4 add_column :test_requests, :exit_status, :string
5 5 add_column :test_requests, :memory_usage, :integer
6 6 end
7 7
8 8 def self.down
9 9 remove_column :test_requests, :running_time
10 10 remove_column :test_requests, :exit_status
11 11 remove_column :test_requests, :memory_usage
12 12 end
13 13 end
@@ -1,15 +1,15
1 - class CreateSites < ActiveRecord::Migration
1 + class CreateSites < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :sites do |t|
3 + create_table :sites, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.string :name
5 5 t.boolean :started
6 6 t.datetime :start_time
7 7
8 8 t.timestamps
9 9 end
10 10 end
11 11
12 12 def self.down
13 13 drop_table :sites
14 14 end
15 15 end
@@ -1,13 +1,13
1 - class AddSiteToUserAndAddDefaultSite < ActiveRecord::Migration
1 + class AddSiteToUserAndAddDefaultSite < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 default_site = Site.new({:name => 'default',
4 4 :started => false})
5 5 default_site.save!
6 6
7 7 add_column :users, :site_id, :integer
8 8 User.reset_column_information
9 9
10 10 User.all.each do |user|
11 11
12 12 class << user
13 13 def valid?
@@ -1,9 +1,9
1 - class AddBodyToProblems < ActiveRecord::Migration
1 + class AddBodyToProblems < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :problems, :body, :text
4 4 end
5 5
6 6 def self.down
7 7 remove_column :problems, :body
8 8 end
9 9 end
@@ -1,13 +1,13
1 - class CreateDescriptions < ActiveRecord::Migration
1 + class CreateDescriptions < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :descriptions do |t|
3 + create_table :descriptions, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :body, :text
5 5 t.column :markdowned, :boolean
6 6 t.timestamps
7 7 end
8 8 end
9 9
10 10 def self.down
11 11 drop_table :descriptions
12 12 end
13 13 end
@@ -1,13 +1,13
1 - class RefactorProblemBodyToDescription < ActiveRecord::Migration
1 + class RefactorProblemBodyToDescription < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :problems, :description_id, :integer
4 4 Problem.reset_column_information
5 5
6 6 Problem.all.each do |problem|
7 7 if problem.body!=nil
8 8 description = Description.new
9 9 description.body = problem.body
10 10 description.markdowned = false
11 11 description.save
12 12 problem.description_id = description.id
13 13 problem.save
@@ -1,13 +1,13
1 - class AddTestAllowedToProblems < ActiveRecord::Migration
1 + class AddTestAllowedToProblems < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :problems, :test_allowed, :boolean
4 4 Problem.reset_column_information
5 5
6 6 Problem.all.each do |problem|
7 7 problem.test_allowed = true
8 8 problem.save
9 9 end
10 10 end
11 11
12 12 def self.down
13 13 remove_column :problems, :test_allowed
@@ -1,15 +1,15
1 - class CreateAnnouncements < ActiveRecord::Migration
1 + class CreateAnnouncements < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :announcements do |t|
3 + create_table :announcements, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.string :author
5 5 t.text :body
6 6 t.boolean :published
7 7
8 8 t.timestamps
9 9 end
10 10 end
11 11
12 12 def self.down
13 13 drop_table :announcements
14 14 end
15 15 end
@@ -1,11 +1,11
1 - class AddSupportsForOutputOnlyProblems < ActiveRecord::Migration
1 + class AddSupportsForOutputOnlyProblems < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :submissions, :source_filename, :string
4 4 add_column :problems, :output_only, :boolean
5 5 end
6 6
7 7 def self.down
8 8 remove_column :submissions, :source_filename
9 9 remove_column :problems, :output_only
10 10 end
11 11 end
@@ -1,15 +1,15
1 - class CreateMessages < ActiveRecord::Migration
1 + class CreateMessages < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :messages do |t|
3 + create_table :messages, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column "sender_id", :integer
5 5 t.column "receiver_id", :integer
6 6 t.column "replying_message_id", :integer
7 7 t.column "body", :text
8 8 t.column "replied", :boolean # this is for efficiency
9 9
10 10 t.timestamps
11 11 end
12 12 end
13 13
14 14 def self.down
15 15 drop_table :messages
@@ -1,9 +1,9
1 - class AddTaskTypeToGraderProcesses < ActiveRecord::Migration
1 + class AddTaskTypeToGraderProcesses < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column 'grader_processes', 'task_type', :string
4 4 end
5 5
6 6 def self.down
7 7 remove_column 'grader_processes', 'task_type'
8 8 end
9 9 end
@@ -1,12 +1,12
1 - class CreateCountries < ActiveRecord::Migration
1 + class CreateCountries < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :countries do |t|
3 + create_table :countries, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column :name, :string
5 5 t.timestamps
6 6 end
7 7 end
8 8
9 9 def self.down
10 10 drop_table :countries
11 11 end
12 12 end
@@ -1,13 +1,13
1 - class AddCountryToSitesAndUsers < ActiveRecord::Migration
1 + class AddCountryToSitesAndUsers < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column 'sites', 'country_id', :integer
4 4 add_column 'sites', 'password', :string
5 5
6 6 add_column 'users', 'country_id', :integer
7 7 end
8 8
9 9 def self.down
10 10 remove_column 'users', 'country_id'
11 11
12 12 remove_column 'sites', 'country_id'
13 13 remove_column 'sites', 'password'
@@ -1,9 +1,9
1 - class AddFrontpageFlagToAnnouncement < ActiveRecord::Migration
1 + class AddFrontpageFlagToAnnouncement < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :announcements, "frontpage", :boolean, :default => 0
4 4 end
5 5
6 6 def self.down
7 7 remove_column :announcements, "frontpage"
8 8 end
9 9 end
@@ -1,13 +1,13
1 - class AddActivatedToUsers < ActiveRecord::Migration
1 + class AddActivatedToUsers < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :users, :activated, :boolean, :default => 0
4 4
5 5 User.reset_column_information
6 6
7 7 User.all.each do |user|
8 8
9 9 # disable validation
10 10 class <<user
11 11 def valid?
12 12 return true
13 13 end
@@ -1,9 +1,9
1 - class AddTimestampsToUsers < ActiveRecord::Migration
1 + class AddTimestampsToUsers < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_timestamps :users
4 4 end
5 5
6 6 def self.down
7 7 remove_timestamps :users
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class ChangeUserLoginStringLimit < ActiveRecord::Migration
1 + class ChangeUserLoginStringLimit < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 execute "ALTER TABLE `users` CHANGE `login` `login` VARCHAR( 50 )"
4 4 end
5 5
6 6 def self.down
7 7 # don't have to revert
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class AddContestFlagToAnnouncements < ActiveRecord::Migration
1 + class AddContestFlagToAnnouncements < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :announcements, :contest_only, :boolean, :default => false
4 4 end
5 5
6 6 def self.down
7 7 remove_column :announcements, :contest_only
8 8 end
9 9 end
@@ -1,13 +1,13
1 - class AddCommonExtToLanguages < ActiveRecord::Migration
1 + class AddCommonExtToLanguages < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 # language.common_ext is a comma-separated list of common file
4 4 # extensions.
5 5 add_column :languages, :common_ext, :string
6 6
7 7 # updating table information
8 8 Language.reset_column_information
9 9 common_ext = {
10 10 'c' => 'c',
11 11 'cpp' => 'cpp,cc',
12 12 'pas' => 'pas'
13 13 }
@@ -1,9 +1,9
1 - class AddTerminatedToGraderProcesses < ActiveRecord::Migration
1 + class AddTerminatedToGraderProcesses < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :grader_processes, :terminated, :boolean
4 4 end
5 5
6 6 def self.down
7 7 remove_column :grader_processes, :terminated
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class AddTitleToAnnouncements < ActiveRecord::Migration
1 + class AddTitleToAnnouncements < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :announcements, :title, :string
4 4 end
5 5
6 6 def self.down
7 7 remove_column :announcements, :title
8 8 end
9 9 end
@@ -1,15 +1,15
1 - class CreateTestPairs < ActiveRecord::Migration
1 + class CreateTestPairs < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :test_pairs do |t|
3 + create_table :test_pairs, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.integer :problem_id
5 5 t.text :input
6 6 t.text :solution
7 7
8 8 t.timestamps
9 9 end
10 10 end
11 11
12 12 def self.down
13 13 drop_table :test_pairs
14 14 end
15 15 end
@@ -1,9 +1,9
1 - class AddDescriptionToConfig < ActiveRecord::Migration
1 + class AddDescriptionToConfig < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :configurations, :description, :text
4 4 end
5 5
6 6 def self.down
7 7 remove_column :configurations, :description
8 8 end
9 9 end
@@ -1,14 +1,14
1 - class CreateUserContestStats < ActiveRecord::Migration
1 + class CreateUserContestStats < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :user_contest_stats do |t|
3 + create_table :user_contest_stats, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.integer :user_id
5 5 t.timestamp :started_at
6 6
7 7 t.timestamps
8 8 end
9 9 end
10 10
11 11 def self.down
12 12 drop_table :user_contest_stats
13 13 end
14 14 end
@@ -1,11 +1,11
1 - class ChangeInputSolutionFieldLimitInTestPair < ActiveRecord::Migration
1 + class ChangeInputSolutionFieldLimitInTestPair < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 change_column :test_pairs, :input, :text, :limit => 1.megabytes
4 4 change_column :test_pairs, :solution, :text, :limit => 1.megabytes
5 5 end
6 6
7 7 def self.down
8 8 change_column :test_pairs, :input, :text
9 9 change_column :test_pairs, :solution, :text
10 10 end
11 11 end
@@ -1,14 +1,14
1 - class CreateContests < ActiveRecord::Migration
1 + class CreateContests < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :contests do |t|
3 + create_table :contests, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.string :title
5 5 t.boolean :enabled
6 6
7 7 t.timestamps
8 8 end
9 9 end
10 10
11 11 def self.down
12 12 drop_table :contests
13 13 end
14 14 end
@@ -1,12 +1,12
1 - class CreateContestsUsersJoinTable < ActiveRecord::Migration
1 + class CreateContestsUsersJoinTable < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :contests_users, :id => false do |t|
3 + create_table :contests_users, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.integer :contest_id
5 5 t.integer :user_id
6 6 end
7 7 end
8 8
9 9 def self.down
10 10 drop_table :contests_users
11 11 end
12 12 end
@@ -1,12 +1,12
1 - class CreateContestsProblemsJoinTable < ActiveRecord::Migration
1 + class CreateContestsProblemsJoinTable < ActiveRecord::Migration[4.2]
2 2 def self.up
3 - create_table :contests_problems, :id => false do |t|
3 + create_table :contests_problems, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.integer :contest_id
5 5 t.integer :problem_id
6 6 end
7 7 end
8 8
9 9 def self.down
10 10 drop_table :contests_problems
11 11 end
12 12 end
@@ -1,9 +1,9
1 - class AddDescriptionFilenameToProblems < ActiveRecord::Migration
1 + class AddDescriptionFilenameToProblems < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :problems, :description_filename, :string
4 4 end
5 5
6 6 def self.down
7 7 remove_column :problems, :description_filename
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class AddNameToContests < ActiveRecord::Migration
1 + class AddNameToContests < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :contests, :name, :string
4 4 end
5 5
6 6 def self.down
7 7 remove_column :contests, :name
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class AddForcedLogoutToUserContestStat < ActiveRecord::Migration
1 + class AddForcedLogoutToUserContestStat < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :user_contest_stats, :forced_logout, :boolean
4 4 end
5 5
6 6 def self.down
7 7 remove_column :user_contest_stats, :forced_logout, :boolean
8 8 end
9 9 end
@@ -1,9 +1,9
1 - class AddNotesToAnnouncements < ActiveRecord::Migration
1 + class AddNotesToAnnouncements < ActiveRecord::Migration[4.2]
2 2 def self.up
3 3 add_column :announcements, :notes, :string
4 4 end
5 5
6 6 def self.down
7 7 remove_column :announcements, :notes
8 8 end
9 9 end
@@ -1,5 +1,5
1 - class RenameConfigurationsToGraderConfigurations < ActiveRecord::Migration
1 + class RenameConfigurationsToGraderConfigurations < ActiveRecord::Migration[4.2]
2 2 def change
3 3 rename_table 'configurations', 'grader_configurations'
4 4 end
5 5 end
@@ -1,7 +1,7
1 - class AddMoreDetailToSubmission < ActiveRecord::Migration
1 + class AddMoreDetailToSubmission < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_column :submissions, :max_runtime, :float
4 4 add_column :submissions, :peak_memory, :integer
5 5 add_column :submissions, :effective_code_length, :integer
6 6 end
7 7 end
@@ -1,10 +1,10
1 - class CreateLogins < ActiveRecord::Migration
1 + class CreateLogins < ActiveRecord::Migration[4.2]
2 2 def change
3 - create_table :logins do |t|
3 + create_table :logins, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.string :user_id
5 5 t.string :ip_address
6 6
7 7 t.timestamps
8 8 end
9 9 end
10 10 end
@@ -1,5 +1,5
1 - class AddSectionToUsers < ActiveRecord::Migration
1 + class AddSectionToUsers < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_column :users, :section, :string
4 4 end
5 5 end
@@ -1,5 +1,5
1 - class AddIpToSubmissions < ActiveRecord::Migration
1 + class AddIpToSubmissions < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_column :submissions, :ip_address, :string
4 4 end
5 5 end
@@ -1,6 +1,6
1 - class AddMoreToUsers < ActiveRecord::Migration
1 + class AddMoreToUsers < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_column :users, :enabled, :boolean, default: 1
4 4 add_column :users, :remark, :string
5 5 end
6 6 end
@@ -1,9 +1,9
1 - class ChangeUseridOnLogin < ActiveRecord::Migration
1 + class ChangeUseridOnLogin < ActiveRecord::Migration[4.2]
2 2 def up
3 3 change_column :logins, :user_id, :integer
4 4 end
5 5
6 6 def down
7 7 change_column :logins, :user_id, :string
8 8 end
9 9 end
@@ -1,10 +1,10
1 - class CreateSubmissionViewLogs < ActiveRecord::Migration
1 + class CreateSubmissionViewLogs < ActiveRecord::Migration[4.2]
2 2 def change
3 - create_table :submission_view_logs do |t|
3 + create_table :submission_view_logs, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.integer :user_id
5 5 t.integer :submission_id
6 6
7 7 t.timestamps
8 8 end
9 9 end
10 10 end
@@ -1,5 +1,5
1 - class AddLastIpToUser < ActiveRecord::Migration
1 + class AddLastIpToUser < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_column :users, :last_ip, :string
4 4 end
5 5 end
@@ -1,10 +1,10
1 - class CreateHeartBeats < ActiveRecord::Migration
1 + class CreateHeartBeats < ActiveRecord::Migration[4.2]
2 2 def change
3 - create_table :heart_beats do |t|
3 + create_table :heart_beats, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.column 'user_id',:integer
5 5 t.column 'ip_address',:string
6 6
7 7 t.timestamps
8 8 end
9 9 end
10 10 end
@@ -1,5 +1,5
1 - class AddStatusToHeartBeat < ActiveRecord::Migration
1 + class AddStatusToHeartBeat < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_column :heart_beats, :status, :string
4 4 end
5 5 end
@@ -1,9 +1,9
1 - class AddMoreConfig < ActiveRecord::Migration
1 + class AddMoreConfig < ActiveRecord::Migration[4.2]
2 2 def up
3 3 GraderConfiguration.create key: 'right.bypass_agreement', value_type: 'boolean', value:'true', description:'When false, a check box to accept license agreement appear at login and the user must click accept'
4 4 end
5 5
6 6 def down
7 7
8 8 end
9 9 end
@@ -1,10 +1,10
1 - class UpdateHeartBeat < ActiveRecord::Migration
1 + class UpdateHeartBeat < ActiveRecord::Migration[4.2]
2 2 def up
3 3 GraderConfiguration.create key: 'right.heartbeat_response', value_type: 'string', value:'OK', description:'Heart beat response text'
4 4 add_index :heart_beats, :updated_at
5 5 end
6 6
7 7 def down
8 8 remove_index :heart_beats, :updated_at
9 9 end
10 10 end
@@ -1,9 +1,9
1 - class ModifyGraderProcess < ActiveRecord::Migration
1 + class ModifyGraderProcess < ActiveRecord::Migration[4.2]
2 2 def up
3 3 change_column :grader_processes, :host, :string
4 4 end
5 5
6 6 def down
7 7 change_column :grader_processes, :host, :string, limit: 20
8 8 end
9 9 end
@@ -1,15 +1,15
1 - class CreateTestcases < ActiveRecord::Migration
1 + class CreateTestcases < ActiveRecord::Migration[4.2]
2 2 def change
3 - create_table :testcases do |t|
3 + create_table :testcases, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.references :problem
5 5 t.integer :num
6 6 t.integer :group
7 7 t.integer :score
8 8 t.text :input
9 9 t.text :sol
10 10
11 11 t.timestamps
12 12 end
13 13 add_index :testcases, :problem_id
14 14 end
15 15 end
@@ -1,13 +1,13
1 - class AddConfigViewTest < ActiveRecord::Migration
1 + class AddConfigViewTest < ActiveRecord::Migration[4.2]
2 2 def up
3 3 GraderConfiguration.create key: 'right.view_testcase', value_type: 'boolean', value:'true', description:'When true, any user can view/download test data'
4 4 #uglily and dirtily and shamelessly check other config and inifialize
5 5 GraderConfiguration.where(key: 'right.user_hall_of_fame').first_or_create(value_type: 'boolean', value: 'false',
6 6 description: 'If true, any user can access hall of fame page.')
7 7 GraderConfiguration.where(key: 'right.multiple_ip_login').first_or_create(value_type: 'boolean', value: 'false',
8 8 description: 'When change from true to false, a user can login from the first IP they logged into afterward.')
9 9 GraderConfiguration.where(key: 'right.user_view_submission').first_or_create(value_type: 'boolean', value: 'false',
10 10 description: 'If true, any user can view submissions of every one.')
11 11 end
12 12
13 13 def down
@@ -1,6 +1,6
1 - class ChangeTestcaseSize < ActiveRecord::Migration
1 + class ChangeTestcaseSize < ActiveRecord::Migration[4.2]
2 2 def change
3 3 change_column :testcases, :input, :text, :limit => 4294967295
4 4 change_column :testcases, :sol, :text, :limit => 4294967295
5 5 end
6 6 end
@@ -1,5 +1,5
1 - class AddViewTestcaseToProblem < ActiveRecord::Migration
1 + class AddViewTestcaseToProblem < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_column :problems, :view_testcase, :bool
4 4 end
5 5 end
@@ -1,5 +1,5
1 - class AddIndexToTask < ActiveRecord::Migration
1 + class AddIndexToTask < ActiveRecord::Migration[4.2]
2 2 def change
3 3 add_index :tasks, :submission_id
4 4 end
5 5 end
@@ -1,9 +1,9
1 - class AddHeartBeatFull < ActiveRecord::Migration
1 + class AddHeartBeatFull < ActiveRecord::Migration[4.2]
2 2 def up
3 3 GraderConfiguration.create key: 'right.heartbeat_response_full', value_type: 'string', value:'RESTART', description:'Heart beat response text when user got full score (set this value to the empty string to disable this feature)'
4 4 end
5 5
6 6 def down
7 7
8 8 end
9 9 end
@@ -1,26 +1,26
1 - class CreateGroups < ActiveRecord::Migration
1 + class CreateGroups < ActiveRecord::Migration[4.2]
2 2
3 3 def change
4 - create_table :groups do |t|
4 + create_table :groups, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
5 5 t.string :name
6 6 t.string :description
7 7 end
8 8
9 - create_join_table :groups, :users do |t|
9 + create_join_table :groups, :users, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
10 10 # t.index [:group_id, :user_id]
11 11 t.index [:user_id, :group_id]
12 12 end
13 13
14 - create_join_table :problems, :groups do |t|
14 + create_join_table :problems, :groups, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
15 15 # t.index [:problem_id, :group_id]
16 16 t.index [:group_id, :problem_id]
17 17 end
18 18
19 19 reversible do |change|
20 20 change.up do
21 21 GraderConfiguration.where(key: 'system.use_problem_group').first_or_create(value_type: 'boolean', value: 'false',
22 22 description: 'If true, available problem to the user will be only ones associated with the group of the user');
23 23 end
24 24
25 25 change.down do
26 26 GraderConfiguration.where(key: 'system.use_problem_group').destroy_all
@@ -1,11 +1,11
1 - class CreateTags < ActiveRecord::Migration
1 + class CreateTags < ActiveRecord::Migration[4.2]
2 2 def change
3 - create_table :tags do |t|
3 + create_table :tags, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.string :name, null: false
5 5 t.text :description
6 6 t.boolean :public
7 7
8 8 t.timestamps null: false
9 9 end
10 10 end
11 11 end
@@ -1,10 +1,10
1 - class CreateProblemTags < ActiveRecord::Migration
1 + class CreateProblemTags < ActiveRecord::Migration[4.2]
2 2 def change
3 - create_table :problems_tags do |t|
3 + create_table :problems_tags, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
4 4 t.references :problem, index: true, foreign_key: true
5 5 t.references :tag, index: true, foreign_key: true
6 6
7 7 t.index [:problem_id,:tag_id], unique: true
8 8 end
9 9 end
10 10 end
deleted file
deleted file
deleted file
deleted file
deleted file
deleted file
deleted file
deleted file
deleted file
You need to be logged in to leave comments. Login now