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 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 + ruby '3.1.0'
5 +
4 #rails
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 gem 'activerecord-session_store'
12 gem 'activerecord-session_store'
7 gem 'puma'
13 gem 'puma'
8
14
9 # Reduces boot times through caching; required in config/boot.rb
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 # Bundle edge Rails instead:
18 # Bundle edge Rails instead:
13 # gem 'rails', :git => 'git://github.com/rails/rails.git'
19 # gem 'rails', :git => 'git://github.com/rails/rails.git'
14
20
15 #---------------- database ---------------------
21 #---------------- database ---------------------
16 #the database
22 #the database
17 gem 'mysql2'
23 gem 'mysql2'
18 #for testing
24 #for testing
19 gem 'sqlite3'
25 gem 'sqlite3'
20 gem 'rails-controller-testing'
26 gem 'rails-controller-testing'
21 #for dumping database into yaml
27 #for dumping database into yaml
22 gem 'yaml_db'
28 gem 'yaml_db'
@@ -32,29 +38,29
32
38
33 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
39 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
34 # gem 'therubyracer', :platforms => :ruby
40 # gem 'therubyracer', :platforms => :ruby
35
41
36 gem 'uglifier'
42 gem 'uglifier'
37
43
38 gem 'haml'
44 gem 'haml'
39 gem 'haml-rails'
45 gem 'haml-rails'
40
46
41 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
47 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
42 #gem 'turbolinks', '~> 5'
48 #gem 'turbolinks', '~> 5'
43 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
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 #in-place editor
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 # jquery addition
56 # jquery addition
51 gem 'jquery-rails'
57 gem 'jquery-rails'
52 gem 'jquery-ui-rails'
58 gem 'jquery-ui-rails'
53 #gem 'jquery-timepicker-addon-rails'
59 #gem 'jquery-timepicker-addon-rails'
54 gem 'jquery-tablesorter'
60 gem 'jquery-tablesorter'
55 gem 'jquery-countdown-rails'
61 gem 'jquery-countdown-rails'
56
62
57 #syntax highlighter
63 #syntax highlighter
58 gem 'rouge'
64 gem 'rouge'
59
65
60 #bootstrap add-ons
66 #bootstrap add-ons
@@ -84,33 +90,34
84 #gem 'verification', :git => 'https://github.com/sikachu/verification.git'
90 #gem 'verification', :git => 'https://github.com/sikachu/verification.git'
85
91
86
92
87 #---------------- testiing -----------------------
93 #---------------- testiing -----------------------
88 gem 'minitest-reporters'
94 gem 'minitest-reporters'
89
95
90 #---------------- for console --------------------
96 #---------------- for console --------------------
91 gem 'fuzzy-string-match'
97 gem 'fuzzy-string-match'
92
98
93
99
94 group :development, :test do
100 group :development, :test do
95 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
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 end
103 end
98
104
99 group :development do
105 group :development do
100 # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
106 # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
101 gem 'web-console', '>= 3.3.0'
107 gem 'web-console', '>= 3.3.0'
102 gem 'listen', '>= 3.0.5', '< 3.2'
108 gem 'listen', '>= 3.0.5', '< 3.2'
103 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
109 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
104 gem 'spring'
110 gem 'spring'
105 gem 'spring-watcher-listen', '~> 2.0.0'
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 end
115 end
107
116
108 group :test do
117 group :test do
109 # Adds support for Capybara system testing and selenium driver
118 # Adds support for Capybara system testing and selenium driver
110 - gem 'capybara', '>= 2.15'
119 + gem 'capybara'
111 gem 'selenium-webdriver'
120 gem 'selenium-webdriver'
112 - # Easy installation and use of chromedriver to run system tests with Chrome
121 + gem 'webdrivers'
113 - #gem 'chromedriver-helper'
114 - gem 'webdriver'
115 end
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 GEM
9 GEM
2 remote: https://rubygems.org/
10 remote: https://rubygems.org/
3 specs:
11 specs:
4 - RubyInline (3.12.4)
12 + RubyInline (3.12.5)
5 ZenTest (~> 4.3)
13 ZenTest (~> 4.3)
6 - ZenTest (4.11.2)
14 + ZenTest (4.12.0)
7 - ace-rails-ap (4.2)
15 + ace-rails-ap (4.4)
8 - actioncable (5.2.4.2)
16 + actioncable (7.0.1)
9 - actionpack (= 5.2.4.2)
17 + actionpack (= 7.0.1)
18 + activesupport (= 7.0.1)
10 nio4r (~> 2.0)
19 nio4r (~> 2.0)
11 websocket-driver (>= 0.6.1)
20 websocket-driver (>= 0.6.1)
12 - actionmailer (5.2.4.2)
21 + actionmailbox (7.0.1)
13 - actionpack (= 5.2.4.2)
22 + actionpack (= 7.0.1)
14 - actionview (= 5.2.4.2)
23 + activejob (= 7.0.1)
15 - activejob (= 5.2.4.2)
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 mail (~> 2.5, >= 2.5.4)
36 mail (~> 2.5, >= 2.5.4)
37 + net-imap
38 + net-pop
39 + net-smtp
17 rails-dom-testing (~> 2.0)
40 rails-dom-testing (~> 2.0)
18 - actionpack (5.2.4.2)
41 + actionpack (7.0.1)
19 - actionview (= 5.2.4.2)
42 + actionview (= 7.0.1)
20 - activesupport (= 5.2.4.2)
43 + activesupport (= 7.0.1)
21 - rack (~> 2.0, >= 2.0.8)
44 + rack (~> 2.0, >= 2.2.0)
22 rack-test (>= 0.6.3)
45 rack-test (>= 0.6.3)
23 rails-dom-testing (~> 2.0)
46 rails-dom-testing (~> 2.0)
24 - rails-html-sanitizer (~> 1.0, >= 1.0.2)
47 + rails-html-sanitizer (~> 1.0, >= 1.2.0)
25 - actionview (5.2.4.2)
48 + actiontext (7.0.1)
26 - activesupport (= 5.2.4.2)
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 builder (~> 3.1)
57 builder (~> 3.1)
28 erubi (~> 1.4)
58 erubi (~> 1.4)
29 rails-dom-testing (~> 2.0)
59 rails-dom-testing (~> 2.0)
30 - rails-html-sanitizer (~> 1.0, >= 1.0.3)
60 + rails-html-sanitizer (~> 1.1, >= 1.2.0)
31 - activejob (5.2.4.2)
61 + activejob (7.0.1)
32 - activesupport (= 5.2.4.2)
62 + activesupport (= 7.0.1)
33 globalid (>= 0.3.6)
63 globalid (>= 0.3.6)
34 - activemodel (5.2.4.2)
64 + activemodel (7.0.1)
35 - activesupport (= 5.2.4.2)
65 + activesupport (= 7.0.1)
36 - activerecord (5.2.4.2)
66 + activerecord (7.0.1)
37 - activemodel (= 5.2.4.2)
67 + activemodel (= 7.0.1)
38 - activesupport (= 5.2.4.2)
68 + activesupport (= 7.0.1)
39 - arel (>= 9.0)
69 + activerecord-session_store (2.0.0)
40 - activerecord-session_store (1.1.3)
70 + actionpack (>= 5.2.4.1)
41 - actionpack (>= 4.0)
71 + activerecord (>= 5.2.4.1)
42 - activerecord (>= 4.0)
43 multi_json (~> 1.11, >= 1.11.2)
72 multi_json (~> 1.11, >= 1.11.2)
44 - rack (>= 1.5.2, < 3)
73 + rack (>= 2.0.8, < 3)
45 - railties (>= 4.0)
74 + railties (>= 5.2.4.1)
46 - activestorage (5.2.4.2)
75 + activestorage (7.0.1)
47 - actionpack (= 5.2.4.2)
76 + actionpack (= 7.0.1)
48 - activerecord (= 5.2.4.2)
77 + activejob (= 7.0.1)
49 - marcel (~> 0.3.1)
78 + activerecord (= 7.0.1)
50 - activesupport (5.2.4.2)
79 + activesupport (= 7.0.1)
80 + marcel (~> 1.0)
81 + mini_mime (>= 1.1.0)
82 + activesupport (7.0.1)
51 concurrent-ruby (~> 1.0, >= 1.0.2)
83 concurrent-ruby (~> 1.0, >= 1.0.2)
52 - i18n (>= 0.7, < 2)
84 + i18n (>= 1.6, < 2)
53 - minitest (~> 5.1)
85 + minitest (>= 5.1)
54 - tzinfo (~> 1.1)
86 + tzinfo (~> 2.0)
55 - addressable (2.7.0)
87 + addressable (2.8.0)
56 public_suffix (>= 2.0.2, < 5.0)
88 public_suffix (>= 2.0.2, < 5.0)
57 ansi (1.5.0)
89 ansi (1.5.0)
58 - arel (9.0.0)
90 + autoprefixer-rails (10.4.2.0)
59 - autoprefixer-rails (9.5.1)
91 + execjs (~> 2)
60 - execjs
61 - best_in_place (3.0.3)
62 - actionpack (>= 3.2)
63 - railties (>= 3.2)
64 bindex (0.8.1)
92 bindex (0.8.1)
65 - bootsnap (1.4.6)
93 + bootsnap (1.9.4)
66 msgpack (~> 1.0)
94 msgpack (~> 1.0)
67 bootstrap-sass (3.4.1)
95 bootstrap-sass (3.4.1)
68 autoprefixer-rails (>= 5.2.1)
96 autoprefixer-rails (>= 5.2.1)
69 sassc (>= 2.0.0)
97 sassc (>= 2.0.0)
70 - bootstrap-switch-rails (3.3.4)
98 + bootstrap-switch-rails (3.3.5)
71 bootstrap-toggle-rails (2.2.1.0)
99 bootstrap-toggle-rails (2.2.1.0)
72 bootstrap3-datetimepicker-rails (4.17.47)
100 bootstrap3-datetimepicker-rails (4.17.47)
73 momentjs-rails (>= 2.8.1)
101 momentjs-rails (>= 2.8.1)
74 builder (3.2.4)
102 builder (3.2.4)
75 - byebug (11.0.1)
103 + capybara (3.36.0)
76 - capybara (3.15.1)
77 addressable
104 addressable
105 + matrix
78 mini_mime (>= 0.1.3)
106 mini_mime (>= 0.1.3)
79 nokogiri (~> 1.8)
107 nokogiri (~> 1.8)
80 rack (>= 1.6.0)
108 rack (>= 1.6.0)
81 rack-test (>= 0.6.3)
109 rack-test (>= 0.6.3)
82 - regexp_parser (~> 1.2)
110 + regexp_parser (>= 1.5, < 3.0)
83 xpath (~> 3.2)
111 xpath (~> 3.2)
84 - childprocess (3.0.0)
112 + childprocess (4.1.0)
85 - coffee-rails (4.2.2)
113 + coffee-rails (5.0.0)
86 coffee-script (>= 2.2.0)
114 coffee-script (>= 2.2.0)
87 - railties (>= 4.0.0)
115 + railties (>= 5.2.0)
88 coffee-script (2.4.1)
116 coffee-script (2.4.1)
89 coffee-script-source
117 coffee-script-source
90 execjs
118 execjs
91 coffee-script-source (1.12.2)
119 coffee-script-source (1.12.2)
92 - concurrent-ruby (1.1.6)
120 + concurrent-ruby (1.1.9)
93 crass (1.0.6)
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 dynamic_form (1.1.4)
126 dynamic_form (1.1.4)
95 - erubi (1.9.0)
127 + erubi (1.10.0)
96 erubis (2.7.0)
128 erubis (2.7.0)
97 - execjs (2.7.0)
129 + execjs (2.8.1)
98 - ffi (1.10.0)
130 + ffi (1.15.5)
99 fuzzy-string-match (1.0.1)
131 fuzzy-string-match (1.0.1)
100 RubyInline (>= 3.8.6)
132 RubyInline (>= 3.8.6)
101 - globalid (0.4.2)
133 + globalid (1.0.0)
102 - activesupport (>= 4.2.0)
134 + activesupport (>= 5.0)
103 - haml (5.0.4)
135 + haml (5.2.2)
104 temple (>= 0.8.0)
136 temple (>= 0.8.0)
105 tilt
137 tilt
106 - haml-rails (1.0.0)
138 + haml-rails (2.0.1)
107 - actionpack (>= 4.0.1)
139 + actionpack (>= 5.1)
108 - activesupport (>= 4.0.1)
140 + activesupport (>= 5.1)
109 haml (>= 4.0.6, < 6.0)
141 haml (>= 4.0.6, < 6.0)
110 html2haml (>= 1.0.1)
142 html2haml (>= 1.0.1)
111 - railties (>= 4.0.1)
143 + railties (>= 5.1)
112 html2haml (2.2.0)
144 html2haml (2.2.0)
113 erubis (~> 2.7.0)
145 erubis (~> 2.7.0)
114 haml (>= 4.0, < 6)
146 haml (>= 4.0, < 6)
115 nokogiri (>= 1.6.0)
147 nokogiri (>= 1.6.0)
116 ruby_parser (~> 3.5)
148 ruby_parser (~> 3.5)
117 - i18n (1.8.2)
149 + i18n (1.8.11)
118 concurrent-ruby (~> 1.0)
150 concurrent-ruby (~> 1.0)
119 in_place_editing (1.2.0)
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 activesupport (>= 5.0.0)
158 activesupport (>= 5.0.0)
122 jquery-countdown-rails (2.0.2)
159 jquery-countdown-rails (2.0.2)
123 - jquery-rails (4.3.3)
160 + jquery-rails (4.4.0)
124 rails-dom-testing (>= 1, < 3)
161 rails-dom-testing (>= 1, < 3)
125 railties (>= 4.2.0)
162 railties (>= 4.2.0)
126 thor (>= 0.14, < 2.0)
163 thor (>= 0.14, < 2.0)
127 - jquery-tablesorter (1.26.1)
164 + jquery-tablesorter (1.27.2)
128 - railties (>= 3.2, < 6)
165 + railties (>= 3.2)
129 jquery-ui-rails (6.0.1)
166 jquery-ui-rails (6.0.1)
130 railties (>= 3.2.16)
167 railties (>= 3.2.16)
131 - listen (3.1.5)
168 + listen (3.0.8)
132 rb-fsevent (~> 0.9, >= 0.9.4)
169 rb-fsevent (~> 0.9, >= 0.9.4)
133 rb-inotify (~> 0.9, >= 0.9.7)
170 rb-inotify (~> 0.9, >= 0.9.7)
134 - ruby_dep (~> 1.2)
171 + loofah (2.13.0)
135 - loofah (2.4.0)
136 crass (~> 1.0.2)
172 crass (~> 1.0.2)
137 nokogiri (>= 1.5.9)
173 nokogiri (>= 1.5.9)
138 mail (2.7.1)
174 mail (2.7.1)
139 mini_mime (>= 0.1.1)
175 mini_mime (>= 0.1.1)
140 - marcel (0.3.3)
176 + marcel (1.0.2)
141 - mimemagic (~> 0.3.2)
177 + matrix (0.4.2)
142 method_source (1.0.0)
178 method_source (1.0.0)
143 - mimemagic (0.3.4)
179 + mini_mime (1.1.2)
144 - mini_mime (1.0.2)
180 + minitest (5.15.0)
145 - mini_portile2 (2.4.0)
181 + minitest-reporters (1.5.0)
146 - minitest (5.14.0)
147 - minitest-reporters (1.3.6)
148 ansi
182 ansi
149 builder
183 builder
150 minitest (>= 5.0)
184 minitest (>= 5.0)
151 ruby-progressbar
185 ruby-progressbar
152 - momentjs-rails (2.20.1)
186 + momentjs-rails (2.29.1.1)
153 railties (>= 3.1)
187 railties (>= 3.1)
154 - msgpack (1.3.3)
188 + msgpack (1.4.2)
155 - multi_json (1.13.1)
189 + multi_json (1.15.0)
156 - mysql2 (0.5.2)
190 + mysql2 (0.5.3)
157 - nio4r (2.5.2)
191 + net-imap (0.2.3)
158 - nokogiri (1.10.9)
192 + digest
159 - mini_portile2 (~> 2.4.0)
193 + net-protocol
160 - public_suffix (4.0.3)
194 + strscan
161 - puma (4.3.3)
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 nio4r (~> 2.0)
211 nio4r (~> 2.0)
163 - rack (2.2.2)
212 + racc (1.6.0)
213 + rack (2.2.3)
164 rack-test (1.1.0)
214 rack-test (1.1.0)
165 rack (>= 1.0, < 3)
215 rack (>= 1.0, < 3)
166 - rails (5.2.4.2)
216 + rails (7.0.1)
167 - actioncable (= 5.2.4.2)
217 + actioncable (= 7.0.1)
168 - actionmailer (= 5.2.4.2)
218 + actionmailbox (= 7.0.1)
169 - actionpack (= 5.2.4.2)
219 + actionmailer (= 7.0.1)
170 - actionview (= 5.2.4.2)
220 + actionpack (= 7.0.1)
171 - activejob (= 5.2.4.2)
221 + actiontext (= 7.0.1)
172 - activemodel (= 5.2.4.2)
222 + actionview (= 7.0.1)
173 - activerecord (= 5.2.4.2)
223 + activejob (= 7.0.1)
174 - activestorage (= 5.2.4.2)
224 + activemodel (= 7.0.1)
175 - activesupport (= 5.2.4.2)
225 + activerecord (= 7.0.1)
176 - bundler (>= 1.3.0)
226 + activestorage (= 7.0.1)
177 - railties (= 5.2.4.2)
227 + activesupport (= 7.0.1)
178 - sprockets-rails (>= 2.0.0)
228 + bundler (>= 1.15.0)
179 - rails-controller-testing (1.0.4)
229 + railties (= 7.0.1)
180 - actionpack (>= 5.0.1.x)
230 + rails-controller-testing (1.0.5)
181 - actionview (>= 5.0.1.x)
231 + actionpack (>= 5.0.1.rc1)
182 - activesupport (>= 5.0.1.x)
232 + actionview (>= 5.0.1.rc1)
233 + activesupport (>= 5.0.1.rc1)
183 rails-dom-testing (2.0.3)
234 rails-dom-testing (2.0.3)
184 activesupport (>= 4.2.0)
235 activesupport (>= 4.2.0)
185 nokogiri (>= 1.6)
236 nokogiri (>= 1.6)
186 - rails-html-sanitizer (1.3.0)
237 + rails-html-sanitizer (1.4.2)
187 loofah (~> 2.3)
238 loofah (~> 2.3)
188 - rails_bootstrap_sortable (2.0.6)
239 + rails_bootstrap_sortable (2.0.7)
189 momentjs-rails (>= 2.8.3)
240 momentjs-rails (>= 2.8.3)
190 - railties (5.2.4.2)
241 + railties (7.0.1)
191 - actionpack (= 5.2.4.2)
242 + actionpack (= 7.0.1)
192 - activesupport (= 5.2.4.2)
243 + activesupport (= 7.0.1)
193 method_source
244 method_source
194 - rake (>= 0.8.7)
245 + rake (>= 12.2)
195 - thor (>= 0.19.0, < 2.0)
246 + thor (~> 1.0)
196 - rake (13.0.1)
247 + zeitwerk (~> 2.5)
197 - rb-fsevent (0.10.3)
248 + rake (13.0.6)
198 - rb-inotify (0.10.0)
249 + rb-fsevent (0.11.0)
250 + rb-inotify (0.10.1)
199 ffi (~> 1.0)
251 ffi (~> 1.0)
200 - rdiscount (2.2.0.1)
252 + rdiscount (2.2.0.2)
201 - regexp_parser (1.7.0)
253 + regexp_parser (2.2.0)
202 - rouge (3.3.0)
254 + reline (0.3.1)
203 - ruby-progressbar (1.10.0)
255 + io-console (~> 0.5)
204 - ruby_dep (1.5.0)
256 + rexml (3.2.5)
205 - ruby_parser (3.13.1)
257 + rouge (3.27.0)
206 - sexp_processor (~> 4.9)
258 + ruby-progressbar (1.11.0)
207 - rubyzip (1.3.0)
259 + ruby_parser (3.18.1)
208 - sassc (2.2.1)
260 + sexp_processor (~> 4.16)
261 + rubyzip (2.3.2)
262 + sassc (2.4.0)
209 ffi (~> 1.9)
263 ffi (~> 1.9)
210 sassc-rails (2.1.2)
264 sassc-rails (2.1.2)
211 railties (>= 4.0.0)
265 railties (>= 4.0.0)
212 sassc (>= 2.0)
266 sassc (>= 2.0)
213 sprockets (> 3.0)
267 sprockets (> 3.0)
214 sprockets-rails
268 sprockets-rails
215 tilt
269 tilt
216 - select2-rails (4.0.3)
270 + select2-rails (4.0.13)
217 - thor (~> 0.14)
271 + selenium-webdriver (4.1.0)
218 - selenium-webdriver (3.142.7)
272 + childprocess (>= 0.5, < 5.0)
219 - childprocess (>= 0.5, < 4.0)
273 + rexml (~> 3.2, >= 3.2.5)
220 rubyzip (>= 1.2.2)
274 rubyzip (>= 1.2.2)
221 - sexp_processor (4.12.0)
275 + sexp_processor (4.16.0)
222 - simple_form (5.0.2)
276 + simple_form (5.1.0)
223 - actionpack (>= 5.0)
277 + actionpack (>= 5.2)
224 - activemodel (>= 5.0)
278 + activemodel (>= 5.2)
225 - spring (2.0.2)
279 + spring (2.1.1)
226 - activesupport (>= 4.2)
227 spring-watcher-listen (2.0.1)
280 spring-watcher-listen (2.0.1)
228 listen (>= 2.7, < 4.0)
281 listen (>= 2.7, < 4.0)
229 spring (>= 1.2, < 3.0)
282 spring (>= 1.2, < 3.0)
230 - sprockets (3.7.2)
283 + sprockets (4.0.2)
231 concurrent-ruby (~> 1.0)
284 concurrent-ruby (~> 1.0)
232 rack (> 1, < 3)
285 rack (> 1, < 3)
233 - sprockets-rails (3.2.1)
286 + sprockets-rails (3.4.2)
234 - actionpack (>= 4.0)
287 + actionpack (>= 5.2)
235 - activesupport (>= 4.0)
288 + activesupport (>= 5.2)
236 sprockets (>= 3.0.0)
289 sprockets (>= 3.0.0)
237 - sqlite3 (1.4.1)
290 + sqlite3 (1.4.2)
238 - temple (0.8.1)
291 + strscan (3.0.1)
239 - thor (0.20.3)
292 + temple (0.8.2)
240 - thread_safe (0.3.6)
293 + thor (1.2.1)
241 - tilt (2.0.9)
294 + tilt (2.0.10)
242 - tzinfo (1.2.7)
295 + timeout (0.2.0)
243 - thread_safe (~> 0.1)
296 + tzinfo (2.0.4)
244 - uglifier (4.1.20)
297 + concurrent-ruby (~> 1.0)
298 + uglifier (4.2.0)
245 execjs (>= 0.3.0, < 3)
299 execjs (>= 0.3.0, < 3)
246 - web-console (3.7.0)
300 + web-console (4.2.0)
247 - actionview (>= 5.0)
301 + actionview (>= 6.0.0)
248 - activemodel (>= 5.0)
302 + activemodel (>= 6.0.0)
249 bindex (>= 0.4.0)
303 bindex (>= 0.4.0)
250 - railties (>= 5.0)
304 + railties (>= 6.0.0)
251 - webdriver (0.5.0)
305 + webdrivers (5.0.0)
252 - websocket-driver (0.7.1)
306 + nokogiri (~> 1.6)
307 + rubyzip (>= 1.3.0)
308 + selenium-webdriver (~> 4.0)
309 + websocket-driver (0.7.5)
253 websocket-extensions (>= 0.1.0)
310 websocket-extensions (>= 0.1.0)
254 - websocket-extensions (0.1.4)
311 + websocket-extensions (0.1.5)
255 xpath (3.2.0)
312 xpath (3.2.0)
256 nokogiri (~> 1.8)
313 nokogiri (~> 1.8)
257 yaml_db (0.7.0)
314 yaml_db (0.7.0)
258 rails (>= 3.0)
315 rails (>= 3.0)
259 rake (>= 0.8.7)
316 rake (>= 0.8.7)
317 + zeitwerk (2.5.3)
260
318
261 PLATFORMS
319 PLATFORMS
262 - ruby
320 + x86_64-linux
263
321
264 DEPENDENCIES
322 DEPENDENCIES
265 ace-rails-ap
323 ace-rails-ap
266 activerecord-session_store
324 activerecord-session_store
267 autoprefixer-rails
325 autoprefixer-rails
268 - best_in_place (~> 3.0.1)
326 + best_in_place!
269 - bootsnap (>= 1.1.0)
327 + bootsnap
270 bootstrap-sass (~> 3.4.1)
328 bootstrap-sass (~> 3.4.1)
271 bootstrap-switch-rails
329 bootstrap-switch-rails
272 bootstrap-toggle-rails
330 bootstrap-toggle-rails
273 bootstrap3-datetimepicker-rails (~> 4.17.47)
331 bootstrap3-datetimepicker-rails (~> 4.17.47)
274 - byebug
332 + capybara
275 - capybara (>= 2.15)
276 coffee-rails
333 coffee-rails
334 + debug
277 dynamic_form
335 dynamic_form
278 fuzzy-string-match
336 fuzzy-string-match
279 haml
337 haml
280 haml-rails
338 haml-rails
281 in_place_editing
339 in_place_editing
282 - jbuilder (~> 2.5)
340 + jbuilder
283 jquery-countdown-rails
341 jquery-countdown-rails
284 jquery-rails
342 jquery-rails
285 jquery-tablesorter
343 jquery-tablesorter
286 jquery-ui-rails
344 jquery-ui-rails
287 listen (>= 3.0.5, < 3.2)
345 listen (>= 3.0.5, < 3.2)
288 mail
346 mail
289 minitest-reporters
347 minitest-reporters
290 momentjs-rails (>= 2.9.0)
348 momentjs-rails (>= 2.9.0)
291 mysql2
349 mysql2
292 puma
350 puma
293 - rails (~> 5.2)
351 + rails (~> 7.0)
294 rails-controller-testing
352 rails-controller-testing
295 rails_bootstrap_sortable
353 rails_bootstrap_sortable
296 rdiscount
354 rdiscount
297 rouge
355 rouge
298 sassc-rails
356 sassc-rails
299 select2-rails
357 select2-rails
300 selenium-webdriver
358 selenium-webdriver
301 simple_form
359 simple_form
302 spring
360 spring
303 spring-watcher-listen (~> 2.0.0)
361 spring-watcher-listen (~> 2.0.0)
362 + sprockets-rails
304 sqlite3
363 sqlite3
305 uglifier
364 uglifier
306 web-console (>= 3.3.0)
365 web-console (>= 3.3.0)
307 - webdriver
366 + webdrivers
308 yaml_db
367 yaml_db
309
368
369 + RUBY VERSION
370 + ruby 3.1.0p0
371 +
310 BUNDLED WITH
372 BUNDLED WITH
311 - 1.17.2
373 + 2.3.3
@@ -36,31 +36,45
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.
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 First, we install necessary package for installing RVM.
38 First, we install necessary package for installing RVM.
39
39
40 cafe@grader:~$ sudo apt install software-properties-common
40 cafe@grader:~$ sudo apt install software-properties-common
41
41
42 Second, we add the custom PPA, update the system and install RVM.
42 Second, we add the custom PPA, update the system and install RVM.
43
43
44 cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm
44 cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm
45 cafe@grader:~$ sudo apt-get update
45 cafe@grader:~$ sudo apt-get update
46 cafe@grader:~$ sudo apt-get install rvm
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 === 4. Install cafe-grader
70 === 4. Install cafe-grader
57
71
58 First, ensure that RVM is installed correctly.
72 First, ensure that RVM is installed correctly.
59
73
60 cafe@grader:~$ rvm
74 cafe@grader:~$ rvm
61
75
62 If you get a result similar to this.
76 If you get a result similar to this.
63
77
64 Command 'rvm' not found, but there are 21 similar ones.
78 Command 'rvm' not found, but there are 21 similar ones.
65
79
66 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.
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 #!/usr/bin/env ruby
1 #!/usr/bin/env ruby
2 - APP_PATH = File.expand_path('../config/application', __dir__)
2 + APP_PATH = File.expand_path("../config/application", __dir__)
3 - require_relative '../config/boot'
3 + require_relative "../config/boot"
4 - require 'rails/commands'
4 + require "rails/commands"
@@ -1,4 +1,4
1 #!/usr/bin/env ruby
1 #!/usr/bin/env ruby
2 - require_relative '../config/boot'
2 + require_relative "../config/boot"
3 - require 'rake'
3 + require "rake"
4 Rake.application.run
4 Rake.application.run
@@ -1,36 +1,33
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 -
20 - # Install JavaScript dependencies if using Yarn
21 - # system('bin/yarn')
22
19
23 # puts "\n== Copying sample files =="
20 # puts "\n== Copying sample files =="
24 - # unless File.exist?('config/database.yml')
21 + # unless File.exist?("config/database.yml")
25 - # cp 'config/database.yml.sample', 'config/database.yml'
22 + # FileUtils.cp "config/database.yml.sample", "config/database.yml"
26 # end
23 # end
27
24
28 puts "\n== Preparing database =="
25 puts "\n== Preparing database =="
29 - system! 'bin/rails db:setup'
26 + system! "bin/rails db:prepare"
30
27
31 puts "\n== Removing old logs and tempfiles =="
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 puts "\n== Restarting application server =="
31 puts "\n== Restarting application server =="
35 - system! 'bin/rails restart'
32 + system! "bin/rails restart"
36 end
33 end
@@ -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,61 +1,75
1 + require "active_support/core_ext/integer/time"
2 +
1 Rails.application.configure do
3 Rails.application.configure do
2 # Settings specified here will take precedence over those in config/application.rb.
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
6 + # 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
7 + # 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.
8 # since you don't have to restart the web server when you make code changes.
7 config.cache_classes = false
9 config.cache_classes = false
8
10
9 # Do not eager load code on boot.
11 # Do not eager load code on boot.
10 config.eager_load = false
12 config.eager_load = false
11
13
12 # Show full error reports.
14 # Show full error reports.
13 config.consider_all_requests_local = true
15 config.consider_all_requests_local = true
14
16
17 + # Enable server timing
18 + config.server_timing = true
19 +
15 # Enable/disable caching. By default caching is disabled.
20 # Enable/disable caching. By default caching is disabled.
16 # Run rails dev:cache to toggle caching.
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 config.action_controller.perform_caching = true
23 config.action_controller.perform_caching = true
24 + config.action_controller.enable_fragment_cache_logging = true
19
25
20 config.cache_store = :memory_store
26 config.cache_store = :memory_store
21 config.public_file_server.headers = {
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 else
30 else
25 config.action_controller.perform_caching = false
31 config.action_controller.perform_caching = false
26
32
27 config.cache_store = :null_store
33 config.cache_store = :null_store
28 end
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 config.active_storage.service = :local
37 config.active_storage.service = :local
32
38
33 # Don't care if the mailer can't send.
39 # Don't care if the mailer can't send.
34 config.action_mailer.raise_delivery_errors = false
40 config.action_mailer.raise_delivery_errors = false
35
41
36 config.action_mailer.perform_caching = false
42 config.action_mailer.perform_caching = false
37
43
38 # Print deprecation notices to the Rails logger.
44 # Print deprecation notices to the Rails logger.
39 config.active_support.deprecation = :log
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 # Raise an error on page load if there are pending migrations.
53 # Raise an error on page load if there are pending migrations.
42 config.active_record.migration_error = :page_load
54 config.active_record.migration_error = :page_load
43
55
44 # Highlight code that triggered database queries in logs.
56 # Highlight code that triggered database queries in logs.
45 config.active_record.verbose_query_logs = true
57 config.active_record.verbose_query_logs = true
46
58
47 # Debug mode disables concatenation and preprocessing of assets.
59 # Debug mode disables concatenation and preprocessing of assets.
48 # This option may cause significant delays in view rendering with a large
60 # This option may cause significant delays in view rendering with a large
49 # number of complex assets.
61 # number of complex assets.
50 config.assets.debug = true
62 config.assets.debug = true
51
63
52 # Suppress logger output for asset requests.
64 # Suppress logger output for asset requests.
53 config.assets.quiet = true
65 config.assets.quiet = true
54
66
55 - # Raises error for missing translations
67 + # Raises error for missing translations.
56 - # config.action_view.raise_on_missing_translations = true
68 + # config.i18n.raise_on_missing_translations = true
57
69
58 - # Use an evented file watcher to asynchronously detect changes in source code,
70 + # Annotate rendered view with file names.
59 - # routes, locales, etc. This feature depends on the listen gem.
71 + # config.action_view.annotate_rendered_view_with_filenames = true
60 - config.file_watcher = ActiveSupport::EventedFileUpdateChecker
72 +
73 + # Uncomment if you wish to allow Action Cable access from any origin.
74 + # config.action_cable.disable_request_forgery_protection = true
61 end
75 end
@@ -1,94 +1,99
1 + require "active_support/core_ext/integer/time"
2 +
1 Rails.application.configure do
3 Rails.application.configure do
2 # Settings specified here will take precedence over those in config/application.rb.
4 # Settings specified here will take precedence over those in config/application.rb.
3
5
4 # Code is not reloaded between requests.
6 # Code is not reloaded between requests.
5 config.cache_classes = true
7 config.cache_classes = true
6
8
7 # Eager load code on boot. This eager loads most of Rails and
9 # Eager load code on boot. This eager loads most of Rails and
8 # your application in memory, allowing both threaded web servers
10 # your application in memory, allowing both threaded web servers
9 # and those relying on copy on write to perform better.
11 # and those relying on copy on write to perform better.
10 # Rake tasks automatically ignore this option for performance.
12 # Rake tasks automatically ignore this option for performance.
11 config.eager_load = true
13 config.eager_load = true
12
14
13 # Full error reports are disabled and caching is turned on.
15 # Full error reports are disabled and caching is turned on.
14 config.consider_all_requests_local = false
16 config.consider_all_requests_local = false
15 config.action_controller.perform_caching = true
17 config.action_controller.perform_caching = true
16
18
17 # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
19 # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18 # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
20 # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19 # config.require_master_key = true
21 # config.require_master_key = true
20
22
21 # Disable serving static files from the `/public` folder by default since
23 # Disable serving static files from the `/public` folder by default since
22 # Apache or NGINX already handles this.
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.
27 + # Compress CSS using a preprocessor.
26 - config.assets.js_compressor = :uglifier
27 # config.assets.css_compressor = :sass
28 # config.assets.css_compressor = :sass
28
29
29 # Do not fallback to assets pipeline if a precompiled asset is missed.
30 # Do not fallback to assets pipeline if a precompiled asset is missed.
30 config.assets.compile = false
31 config.assets.compile = false
31
32
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.
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 # Specifies the header that your server uses for sending files.
36 # Specifies the header that your server uses for sending files.
38 - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
37 + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
39 - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
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 config.active_storage.service = :local
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 # config.action_cable.mount_path = nil
44 # config.action_cable.mount_path = nil
46 - # config.action_cable.url = 'wss://example.com/cable'
45 + # config.action_cable.url = "wss://example.com/cable"
47 - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
46 + # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
48
47
49 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
48 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
50 # config.force_ssl = true
49 # config.force_ssl = true
51
50
52 - # Use the lowest log level to ensure availability of diagnostic information
51 + # Include generic and useful information about system operation, but avoid logging too much
53 - # when problems arise.
52 + # information to avoid inadvertent exposure of personally identifiable information (PII).
54 - config.log_level = :debug
53 + config.log_level = :info
55
54
56 # Prepend all log lines with the following tags.
55 # Prepend all log lines with the following tags.
57 config.log_tags = [ :request_id ]
56 config.log_tags = [ :request_id ]
58
57
59 # Use a different cache store in production.
58 # Use a different cache store in production.
60 # config.cache_store = :mem_cache_store
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 # config.active_job.queue_adapter = :resque
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 config.action_mailer.perform_caching = false
65 config.action_mailer.perform_caching = false
67
66
68 # Ignore bad email addresses and do not raise email delivery errors.
67 # 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.
68 # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70 # config.action_mailer.raise_delivery_errors = false
69 # config.action_mailer.raise_delivery_errors = false
71
70
72 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
71 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73 # the I18n.default_locale when a translation cannot be found).
72 # the I18n.default_locale when a translation cannot be found).
74 config.i18n.fallbacks = true
73 config.i18n.fallbacks = true
75
74
76 # Send deprecation notices to registered listeners.
75 # Send deprecation notices to registered listeners.
77 config.active_support.deprecation = :notify
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 # Use default logging formatter so that PID and timestamp are not suppressed.
84 # Use default logging formatter so that PID and timestamp are not suppressed.
80 config.log_formatter = ::Logger::Formatter.new
85 config.log_formatter = ::Logger::Formatter.new
81
86
82 # Use a different logger for distributed setups.
87 # Use a different logger for distributed setups.
83 - # require 'syslog/logger'
88 + # require "syslog/logger"
84 - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
89 + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
85
90
86 if ENV["RAILS_LOG_TO_STDOUT"].present?
91 if ENV["RAILS_LOG_TO_STDOUT"].present?
87 logger = ActiveSupport::Logger.new(STDOUT)
92 logger = ActiveSupport::Logger.new(STDOUT)
88 logger.formatter = config.log_formatter
93 logger.formatter = config.log_formatter
89 config.logger = ActiveSupport::TaggedLogging.new(logger)
94 config.logger = ActiveSupport::TaggedLogging.new(logger)
90 end
95 end
91
96
92 # Do not dump schema after migrations.
97 # Do not dump schema after migrations.
93 config.active_record.dump_schema_after_migration = false
98 config.active_record.dump_schema_after_migration = false
94 end
99 end
@@ -1,46 +1,60
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!
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 config.cache_classes = true
12 config.cache_classes = true
9
13
10 - # Do not eager load code on boot. This avoids loading your whole application
14 + # Eager loading loads your whole application. When running a single test locally,
11 - # just for the purpose of running a single test. If you are using a tool that
15 + # this probably isn't necessary. It's a good idea to do in a continuous integration
12 - # preloads Rails for running tests, you may have to set it to true.
16 + # system, or in some way before deploying your code.
13 - config.eager_load = false
17 + config.eager_load = ENV["CI"].present?
14
18
15 # Configure public file server for tests with Cache-Control for performance.
19 # Configure public file server for tests with Cache-Control for performance.
16 config.public_file_server.enabled = true
20 config.public_file_server.enabled = true
17 config.public_file_server.headers = {
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 # 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,16 +1,16
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 # Version of your assets, change this if you want to expire all your assets.
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 # Add additional assets to the asset load path.
6 # Add additional assets to the asset load path.
7 # Rails.application.config.assets.paths << Emoji.images_path
7 # Rails.application.config.assets.paths << Emoji.images_path
8 # Add Yarn node_modules folder to the asset load path.
8 # Add Yarn node_modules folder to the asset load path.
9 Rails.application.config.assets.paths << Rails.root.join('node_modules')
9 Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
10
11 # Precompile additional assets.
11 # Precompile additional assets.
12 # application.js, application.css, and all non-JS/CSS in the app/assets
12 # application.js, application.css, and all non-JS/CSS in the app/assets
13 # folder are already added.
13 # folder are already added.
14 # Rails.application.config.assets.precompile += %w( admin.js admin.css )
14 # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15 Rails.application.config.assets.precompile += ['announcement_refresh.js','effects.js','site_update.js']
15 Rails.application.config.assets.precompile += ['announcement_refresh.js','effects.js','site_update.js']
16 Rails.application.config.assets.precompile += ['local_jquery.js','tablesorter-theme.cafe.css']
16 Rails.application.config.assets.precompile += ['local_jquery.js','tablesorter-theme.cafe.css']
@@ -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"]
@@ -1,25 +1,26
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 # Define an application-wide content security policy
3 # Define an application-wide content security policy
4 # For further information see the following documentation
4 # For further information see the following documentation
5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
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 # policy.default_src :self, :https
9 # policy.default_src :self, :https
9 # policy.font_src :self, :https, :data
10 # policy.font_src :self, :https, :data
10 # policy.img_src :self, :https, :data
11 # policy.img_src :self, :https, :data
11 # policy.object_src :none
12 # policy.object_src :none
12 # policy.script_src :self, :https
13 # policy.script_src :self, :https
13 # policy.style_src :self, :https
14 # policy.style_src :self, :https
14 -
15 # # Specify URI for violation reports
15 # # Specify URI for violation reports
16 # # policy.report_uri "/csp-violation-report-endpoint"
16 # # policy.report_uri "/csp-violation-report-endpoint"
17 # end
17 # end
18 -
18 + #
19 - # If you are using UJS then enable automatic nonce generation
19 + # # Generate session nonces for permitted importmap and inline scripts
20 - # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
20 + # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21 -
21 + # config.content_security_policy_nonce_directives = %w(script-src)
22 - # Report CSP violations to a specified URI
22 + #
23 - # For further information see the following documentation:
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
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
25 + # # config.content_security_policy_report_only = true
26 + # end
@@ -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,16 +1,16
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 # Add new inflection rules using the following format. Inflections
3 # Add new inflection rules using the following format. Inflections
4 # are locale specific, and you may define rules for as many different
4 # are locale specific, and you may define rules for as many different
5 # locales as you wish. All of these examples are active by default:
5 # locales as you wish. All of these examples are active by default:
6 # ActiveSupport::Inflector.inflections(:en) do |inflect|
6 # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 - # inflect.plural /^(ox)$/i, '\1en'
7 + # inflect.plural /^(ox)$/i, "\\1en"
8 - # inflect.singular /^(ox)en/i, '\1'
8 + # inflect.singular /^(ox)en/i, "\\1"
9 - # inflect.irregular 'person', 'people'
9 + # inflect.irregular "person", "people"
10 # inflect.uncountable %w( fish sheep )
10 # inflect.uncountable %w( fish sheep )
11 # end
11 # end
12
12
13 # These inflection rules are supported but not enabled by default:
13 # These inflection rules are supported but not enabled by default:
14 # ActiveSupport::Inflector.inflections(:en) do |inflect|
14 # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 - # inflect.acronym 'RESTful'
15 + # inflect.acronym "RESTful"
16 # end
16 # end
@@ -1,29 +1,38
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 #
24 # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
33 # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25
34
26 # Use the `preload_app!` method when specifying a `workers` number.
35 # Use the `preload_app!` method when specifying a `workers` number.
27 # This directive tells Puma to first boot the application and load code
36 # This directive tells Puma to first boot the application and load code
28 # before forking the application. This takes advantage of Copy On Write
37 # before forking the application. This takes advantage of Copy On Write
29 # process behavior so workers use less memory.
38 # process behavior so workers use less memory.
@@ -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 + )
@@ -1,15 +1,15
1 - class CreateUsers < ActiveRecord::Migration
1 + class CreateUsers < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :login, :string, :limit => 10
4 t.column :login, :string, :limit => 10
5 t.column :full_name, :string
5 t.column :full_name, :string
6 t.column :hashed_password, :string
6 t.column :hashed_password, :string
7 t.column :salt, :string, :limit => 5
7 t.column :salt, :string, :limit => 5
8 t.column :alias, :string
8 t.column :alias, :string
9 end
9 end
10 # force unique name
10 # force unique name
11 add_index :users, :login, :unique => true
11 add_index :users, :login, :unique => true
12 end
12 end
13
13
14 def self.down
14 def self.down
15 drop_table :users
15 drop_table :users
@@ -1,15 +1,15
1 - class CreateProblems < ActiveRecord::Migration
1 + class CreateProblems < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :name, :string, :limit => 30
4 t.column :name, :string, :limit => 30
5 t.column :full_name, :string
5 t.column :full_name, :string
6 t.column :full_score, :integer
6 t.column :full_score, :integer
7 t.column :date_added, :date
7 t.column :date_added, :date
8 t.column :available, :boolean
8 t.column :available, :boolean
9 end
9 end
10 end
10 end
11
11
12 def self.down
12 def self.down
13 drop_table :problems
13 drop_table :problems
14 end
14 end
15 end
15 end
@@ -1,15 +1,15
1 - class CreateSubmissions < ActiveRecord::Migration
1 + class CreateSubmissions < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :user_id, :integer
4 t.column :user_id, :integer
5 t.column :problem_id, :integer
5 t.column :problem_id, :integer
6 t.column :language_id, :integer
6 t.column :language_id, :integer
7 t.column :source, :text
7 t.column :source, :text
8 t.column :binary, :binary
8 t.column :binary, :binary
9 t.column :submitted_at, :datetime
9 t.column :submitted_at, :datetime
10 t.column :compiled_at, :datetime
10 t.column :compiled_at, :datetime
11 t.column :compiler_message, :text
11 t.column :compiler_message, :text
12 t.column :graded_at, :datetime
12 t.column :graded_at, :datetime
13 t.column :points, :integer
13 t.column :points, :integer
14 t.column :grader_comment, :text
14 t.column :grader_comment, :text
15 end
15 end
@@ -1,15 +1,15
1 - class CreateLanguages < ActiveRecord::Migration
1 + class CreateLanguages < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :name, :string, :limit => 10
4 t.column :name, :string, :limit => 10
5 t.column :pretty_name, :string
5 t.column :pretty_name, :string
6 end
6 end
7
7
8 Language.create(:name => "c", :pretty_name => "C")
8 Language.create(:name => "c", :pretty_name => "C")
9 Language.create(:name => "cpp", :pretty_name => "C++")
9 Language.create(:name => "cpp", :pretty_name => "C++")
10 Language.create(:name => "pas", :pretty_name => "Pascal")
10 Language.create(:name => "pas", :pretty_name => "Pascal")
11 end
11 end
12
12
13 def self.down
13 def self.down
14 drop_table :languages
14 drop_table :languages
15 end
15 end
@@ -1,9 +1,9
1 - class AddIndexToSubmissions < ActiveRecord::Migration
1 + class AddIndexToSubmissions < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_index :submissions, [:user_id, :problem_id]
3 add_index :submissions, [:user_id, :problem_id]
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_index :submissions, :column => [:user_id, :problem_id]
7 remove_index :submissions, :column => [:user_id, :problem_id]
8 end
8 end
9 end
9 end
@@ -1,19 +1,19
1 - class CreateRoles < ActiveRecord::Migration
1 + class CreateRoles < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column 'name', :string
4 t.column 'name', :string
5 end
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 t.column 'role_id', :integer
8 t.column 'role_id', :integer
9 t.column 'user_id', :integer
9 t.column 'user_id', :integer
10 end
10 end
11
11
12 add_index :roles_users, :user_id
12 add_index :roles_users, :user_id
13 end
13 end
14
14
15 def self.down
15 def self.down
16 drop_table :roles_users
16 drop_table :roles_users
17 drop_table :roles
17 drop_table :roles
18 end
18 end
19 end
19 end
@@ -1,21 +1,21
1 - class CreateRights < ActiveRecord::Migration
1 + class CreateRights < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column 'name', :string
4 t.column 'name', :string
5 t.column 'controller', :string
5 t.column 'controller', :string
6 t.column 'action', :string
6 t.column 'action', :string
7 end
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 t.column 'right_id', :integer
10 t.column 'right_id', :integer
11 t.column 'role_id', :integer
11 t.column 'role_id', :integer
12 end
12 end
13
13
14 add_index :rights_roles, :role_id
14 add_index :rights_roles, :role_id
15 end
15 end
16
16
17 def self.down
17 def self.down
18 drop_table :rights_roles
18 drop_table :rights_roles
19 drop_table :rights
19 drop_table :rights
20 end
20 end
21 end
21 end
@@ -1,12 +1,12
1 - class CreateTasks < ActiveRecord::Migration
1 + class CreateTasks < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column 'submission_id', :integer
4 t.column 'submission_id', :integer
5 t.column 'created_at', :datetime
5 t.column 'created_at', :datetime
6 end
6 end
7 end
7 end
8
8
9 def self.down
9 def self.down
10 drop_table :tasks
10 drop_table :tasks
11 end
11 end
12 end
12 end
@@ -1,15 +1,15
1 - class AddSessions < ActiveRecord::Migration
1 + class AddSessions < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :session_id, :string
4 t.column :session_id, :string
5 t.column :data, :text
5 t.column :data, :text
6 t.column :updated_at, :datetime
6 t.column :updated_at, :datetime
7 end
7 end
8
8
9 add_index :sessions, :session_id
9 add_index :sessions, :session_id
10 add_index :sessions, :updated_at
10 add_index :sessions, :updated_at
11 end
11 end
12
12
13 def self.down
13 def self.down
14 drop_table :sessions
14 drop_table :sessions
15 end
15 end
@@ -1,13 +1,13
1 - class AddLanguageExt < ActiveRecord::Migration
1 + class AddLanguageExt < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :languages, :ext, :string, :limit => 10
3 add_column :languages, :ext, :string, :limit => 10
4
4
5 Language.reset_column_information
5 Language.reset_column_information
6 langs = Language.all
6 langs = Language.all
7 langs.each do |l|
7 langs.each do |l|
8 l.ext = l.name
8 l.ext = l.name
9 l.save
9 l.save
10 end
10 end
11 end
11 end
12
12
13 def self.down
13 def self.down
@@ -1,9 +1,9
1 - class AddEmailToUsers < ActiveRecord::Migration
1 + class AddEmailToUsers < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :users, :email, :string
3 add_column :users, :email, :string
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :users, :email
7 remove_column :users, :email
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class AddUrlToProblem < ActiveRecord::Migration
1 + class AddUrlToProblem < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :problems, :url, :string
3 add_column :problems, :url, :string
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :problems, :url
7 remove_column :problems, :url
8 end
8 end
9 end
9 end
@@ -1,15 +1,15
1 - class CreateGraderProcesses < ActiveRecord::Migration
1 + class CreateGraderProcesses < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :ip, :string, :limit => 20
4 t.column :ip, :string, :limit => 20
5 t.column :pid, :integer
5 t.column :pid, :integer
6 t.column :mode, :string
6 t.column :mode, :string
7 t.column :active, :boolean
7 t.column :active, :boolean
8 t.timestamps
8 t.timestamps
9 end
9 end
10 add_index :grader_processes, ["ip","pid"]
10 add_index :grader_processes, ["ip","pid"]
11 end
11 end
12
12
13 def self.down
13 def self.down
14 drop_table :grader_processes
14 drop_table :grader_processes
15 end
15 end
@@ -1,13 +1,13
1 - class AddStatusToTasks < ActiveRecord::Migration
1 + class AddStatusToTasks < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :tasks, :status, :integer
3 add_column :tasks, :status, :integer
4 add_column :tasks, :updated_at, :datetime
4 add_column :tasks, :updated_at, :datetime
5
5
6 Task.reset_column_information
6 Task.reset_column_information
7 Task.all.each do |task|
7 Task.all.each do |task|
8 task.status_complete
8 task.status_complete
9 task.save
9 task.save
10 end
10 end
11 end
11 end
12
12
13 def self.down
13 def self.down
@@ -1,9 +1,9
1 - class AddTaskToGraderProcess < ActiveRecord::Migration
1 + class AddTaskToGraderProcess < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :grader_processes, :task_id, :integer
3 add_column :grader_processes, :task_id, :integer
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :grader_processes, :task_id
7 remove_column :grader_processes, :task_id
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class RenameGraderProcessColumnIpToHost < ActiveRecord::Migration
1 + class RenameGraderProcessColumnIpToHost < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 rename_column :grader_processes, :ip, :host
3 rename_column :grader_processes, :ip, :host
4 end
4 end
5
5
6 def self.down
6 def self.down
7 rename_column :grader_processes, :host, :ip
7 rename_column :grader_processes, :host, :ip
8 end
8 end
9 end
9 end
@@ -1,13 +1,13
1 - class AddNumberToSubmissions < ActiveRecord::Migration
1 + class AddNumberToSubmissions < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :submissions, :number, :integer
3 add_column :submissions, :number, :integer
4
4
5 # add number field for all records
5 # add number field for all records
6 Submission.reset_column_information
6 Submission.reset_column_information
7
7
8 last_user_id = nil
8 last_user_id = nil
9 last_problem_id = nil
9 last_problem_id = nil
10 current_number = 0
10 current_number = 0
11
11
12 Submission.order('user_id, problem_id, submitted_at').each do |submission|
12 Submission.order('user_id, problem_id, submitted_at').each do |submission|
13 if submission.user_id==last_user_id and submission.problem_id==last_problem_id
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 def self.up
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 t.column :user_id, :integer
4 t.column :user_id, :integer
5 t.column :problem_id, :integer
5 t.column :problem_id, :integer
6 t.column :submission_id, :integer
6 t.column :submission_id, :integer
7 t.column :input_file_name, :string
7 t.column :input_file_name, :string
8 t.column :output_file_name, :string
8 t.column :output_file_name, :string
9 t.column :running_stat, :string
9 t.column :running_stat, :string
10
10
11 # these are similar to tasks
11 # these are similar to tasks
12 t.column :status, :integer
12 t.column :status, :integer
13 - t.column :updated_at, :datetime
14
13
15 # these are intentionally similar to submissions
14 # these are intentionally similar to submissions
16 t.column :submitted_at, :datetime
15 t.column :submitted_at, :datetime
17 t.column :compiled_at, :datetime
16 t.column :compiled_at, :datetime
18 t.column :compiler_message, :string
17 t.column :compiler_message, :string
19 t.column :graded_at, :datetime
18 t.column :graded_at, :datetime
20 t.column :grader_comment, :string
19 t.column :grader_comment, :string
21 t.timestamps
20 t.timestamps
22 end
21 end
23 add_index :test_requests, [:user_id, :problem_id]
22 add_index :test_requests, [:user_id, :problem_id]
24 end
23 end
25
24
@@ -1,9 +1,9
1 - class ChangeCompilerMessageTypeTestRequest < ActiveRecord::Migration
1 + class ChangeCompilerMessageTypeTestRequest < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 change_column :test_requests, :compiler_message, :text
3 change_column :test_requests, :compiler_message, :text
4 end
4 end
5
5
6 def self.down
6 def self.down
7 change_column :test_requests, :compiler_message, :string
7 change_column :test_requests, :compiler_message, :string
8 end
8 end
9 end
9 end
@@ -1,14 +1,14
1 - class CreateConfigurations < ActiveRecord::Migration
1 + class CreateConfigurations < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :key, :string
4 t.column :key, :string
5 t.column :value_type, :string
5 t.column :value_type, :string
6 t.column :value, :string
6 t.column :value, :string
7 t.timestamps
7 t.timestamps
8 end
8 end
9 end
9 end
10
10
11 def self.down
11 def self.down
12 drop_table :configurations
12 drop_table :configurations
13 end
13 end
14 end
14 end
@@ -1,13 +1,13
1 - class AddRunstatColumnsToTestRequest < ActiveRecord::Migration
1 + class AddRunstatColumnsToTestRequest < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :test_requests, :running_time, :float
3 add_column :test_requests, :running_time, :float
4 add_column :test_requests, :exit_status, :string
4 add_column :test_requests, :exit_status, :string
5 add_column :test_requests, :memory_usage, :integer
5 add_column :test_requests, :memory_usage, :integer
6 end
6 end
7
7
8 def self.down
8 def self.down
9 remove_column :test_requests, :running_time
9 remove_column :test_requests, :running_time
10 remove_column :test_requests, :exit_status
10 remove_column :test_requests, :exit_status
11 remove_column :test_requests, :memory_usage
11 remove_column :test_requests, :memory_usage
12 end
12 end
13 end
13 end
@@ -1,15 +1,15
1 - class CreateSites < ActiveRecord::Migration
1 + class CreateSites < ActiveRecord::Migration[4.2]
2 def self.up
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 t.string :name
4 t.string :name
5 t.boolean :started
5 t.boolean :started
6 t.datetime :start_time
6 t.datetime :start_time
7
7
8 t.timestamps
8 t.timestamps
9 end
9 end
10 end
10 end
11
11
12 def self.down
12 def self.down
13 drop_table :sites
13 drop_table :sites
14 end
14 end
15 end
15 end
@@ -1,13 +1,13
1 - class AddSiteToUserAndAddDefaultSite < ActiveRecord::Migration
1 + class AddSiteToUserAndAddDefaultSite < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 default_site = Site.new({:name => 'default',
3 default_site = Site.new({:name => 'default',
4 :started => false})
4 :started => false})
5 default_site.save!
5 default_site.save!
6
6
7 add_column :users, :site_id, :integer
7 add_column :users, :site_id, :integer
8 User.reset_column_information
8 User.reset_column_information
9
9
10 User.all.each do |user|
10 User.all.each do |user|
11
11
12 class << user
12 class << user
13 def valid?
13 def valid?
@@ -1,9 +1,9
1 - class AddBodyToProblems < ActiveRecord::Migration
1 + class AddBodyToProblems < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :problems, :body, :text
3 add_column :problems, :body, :text
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :problems, :body
7 remove_column :problems, :body
8 end
8 end
9 end
9 end
@@ -1,13 +1,13
1 - class CreateDescriptions < ActiveRecord::Migration
1 + class CreateDescriptions < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :body, :text
4 t.column :body, :text
5 t.column :markdowned, :boolean
5 t.column :markdowned, :boolean
6 t.timestamps
6 t.timestamps
7 end
7 end
8 end
8 end
9
9
10 def self.down
10 def self.down
11 drop_table :descriptions
11 drop_table :descriptions
12 end
12 end
13 end
13 end
@@ -1,13 +1,13
1 - class RefactorProblemBodyToDescription < ActiveRecord::Migration
1 + class RefactorProblemBodyToDescription < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :problems, :description_id, :integer
3 add_column :problems, :description_id, :integer
4 Problem.reset_column_information
4 Problem.reset_column_information
5
5
6 Problem.all.each do |problem|
6 Problem.all.each do |problem|
7 if problem.body!=nil
7 if problem.body!=nil
8 description = Description.new
8 description = Description.new
9 description.body = problem.body
9 description.body = problem.body
10 description.markdowned = false
10 description.markdowned = false
11 description.save
11 description.save
12 problem.description_id = description.id
12 problem.description_id = description.id
13 problem.save
13 problem.save
@@ -1,13 +1,13
1 - class AddTestAllowedToProblems < ActiveRecord::Migration
1 + class AddTestAllowedToProblems < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :problems, :test_allowed, :boolean
3 add_column :problems, :test_allowed, :boolean
4 Problem.reset_column_information
4 Problem.reset_column_information
5
5
6 Problem.all.each do |problem|
6 Problem.all.each do |problem|
7 problem.test_allowed = true
7 problem.test_allowed = true
8 problem.save
8 problem.save
9 end
9 end
10 end
10 end
11
11
12 def self.down
12 def self.down
13 remove_column :problems, :test_allowed
13 remove_column :problems, :test_allowed
@@ -1,15 +1,15
1 - class CreateAnnouncements < ActiveRecord::Migration
1 + class CreateAnnouncements < ActiveRecord::Migration[4.2]
2 def self.up
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 t.string :author
4 t.string :author
5 t.text :body
5 t.text :body
6 t.boolean :published
6 t.boolean :published
7
7
8 t.timestamps
8 t.timestamps
9 end
9 end
10 end
10 end
11
11
12 def self.down
12 def self.down
13 drop_table :announcements
13 drop_table :announcements
14 end
14 end
15 end
15 end
@@ -1,11 +1,11
1 - class AddSupportsForOutputOnlyProblems < ActiveRecord::Migration
1 + class AddSupportsForOutputOnlyProblems < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :submissions, :source_filename, :string
3 add_column :submissions, :source_filename, :string
4 add_column :problems, :output_only, :boolean
4 add_column :problems, :output_only, :boolean
5 end
5 end
6
6
7 def self.down
7 def self.down
8 remove_column :submissions, :source_filename
8 remove_column :submissions, :source_filename
9 remove_column :problems, :output_only
9 remove_column :problems, :output_only
10 end
10 end
11 end
11 end
@@ -1,15 +1,15
1 - class CreateMessages < ActiveRecord::Migration
1 + class CreateMessages < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column "sender_id", :integer
4 t.column "sender_id", :integer
5 t.column "receiver_id", :integer
5 t.column "receiver_id", :integer
6 t.column "replying_message_id", :integer
6 t.column "replying_message_id", :integer
7 t.column "body", :text
7 t.column "body", :text
8 t.column "replied", :boolean # this is for efficiency
8 t.column "replied", :boolean # this is for efficiency
9
9
10 t.timestamps
10 t.timestamps
11 end
11 end
12 end
12 end
13
13
14 def self.down
14 def self.down
15 drop_table :messages
15 drop_table :messages
@@ -1,9 +1,9
1 - class AddTaskTypeToGraderProcesses < ActiveRecord::Migration
1 + class AddTaskTypeToGraderProcesses < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column 'grader_processes', 'task_type', :string
3 add_column 'grader_processes', 'task_type', :string
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column 'grader_processes', 'task_type'
7 remove_column 'grader_processes', 'task_type'
8 end
8 end
9 end
9 end
@@ -1,12 +1,12
1 - class CreateCountries < ActiveRecord::Migration
1 + class CreateCountries < ActiveRecord::Migration[4.2]
2 def self.up
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 t.column :name, :string
4 t.column :name, :string
5 t.timestamps
5 t.timestamps
6 end
6 end
7 end
7 end
8
8
9 def self.down
9 def self.down
10 drop_table :countries
10 drop_table :countries
11 end
11 end
12 end
12 end
@@ -1,13 +1,13
1 - class AddCountryToSitesAndUsers < ActiveRecord::Migration
1 + class AddCountryToSitesAndUsers < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column 'sites', 'country_id', :integer
3 add_column 'sites', 'country_id', :integer
4 add_column 'sites', 'password', :string
4 add_column 'sites', 'password', :string
5
5
6 add_column 'users', 'country_id', :integer
6 add_column 'users', 'country_id', :integer
7 end
7 end
8
8
9 def self.down
9 def self.down
10 remove_column 'users', 'country_id'
10 remove_column 'users', 'country_id'
11
11
12 remove_column 'sites', 'country_id'
12 remove_column 'sites', 'country_id'
13 remove_column 'sites', 'password'
13 remove_column 'sites', 'password'
@@ -1,9 +1,9
1 - class AddFrontpageFlagToAnnouncement < ActiveRecord::Migration
1 + class AddFrontpageFlagToAnnouncement < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :announcements, "frontpage", :boolean, :default => 0
3 add_column :announcements, "frontpage", :boolean, :default => 0
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :announcements, "frontpage"
7 remove_column :announcements, "frontpage"
8 end
8 end
9 end
9 end
@@ -1,13 +1,13
1 - class AddActivatedToUsers < ActiveRecord::Migration
1 + class AddActivatedToUsers < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :users, :activated, :boolean, :default => 0
3 add_column :users, :activated, :boolean, :default => 0
4
4
5 User.reset_column_information
5 User.reset_column_information
6
6
7 User.all.each do |user|
7 User.all.each do |user|
8
8
9 # disable validation
9 # disable validation
10 class <<user
10 class <<user
11 def valid?
11 def valid?
12 return true
12 return true
13 end
13 end
@@ -1,9 +1,9
1 - class AddTimestampsToUsers < ActiveRecord::Migration
1 + class AddTimestampsToUsers < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_timestamps :users
3 add_timestamps :users
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_timestamps :users
7 remove_timestamps :users
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class ChangeUserLoginStringLimit < ActiveRecord::Migration
1 + class ChangeUserLoginStringLimit < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 execute "ALTER TABLE `users` CHANGE `login` `login` VARCHAR( 50 )"
3 execute "ALTER TABLE `users` CHANGE `login` `login` VARCHAR( 50 )"
4 end
4 end
5
5
6 def self.down
6 def self.down
7 # don't have to revert
7 # don't have to revert
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class AddContestFlagToAnnouncements < ActiveRecord::Migration
1 + class AddContestFlagToAnnouncements < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :announcements, :contest_only, :boolean, :default => false
3 add_column :announcements, :contest_only, :boolean, :default => false
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :announcements, :contest_only
7 remove_column :announcements, :contest_only
8 end
8 end
9 end
9 end
@@ -1,13 +1,13
1 - class AddCommonExtToLanguages < ActiveRecord::Migration
1 + class AddCommonExtToLanguages < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 # language.common_ext is a comma-separated list of common file
3 # language.common_ext is a comma-separated list of common file
4 # extensions.
4 # extensions.
5 add_column :languages, :common_ext, :string
5 add_column :languages, :common_ext, :string
6
6
7 # updating table information
7 # updating table information
8 Language.reset_column_information
8 Language.reset_column_information
9 common_ext = {
9 common_ext = {
10 'c' => 'c',
10 'c' => 'c',
11 'cpp' => 'cpp,cc',
11 'cpp' => 'cpp,cc',
12 'pas' => 'pas'
12 'pas' => 'pas'
13 }
13 }
@@ -1,9 +1,9
1 - class AddTerminatedToGraderProcesses < ActiveRecord::Migration
1 + class AddTerminatedToGraderProcesses < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :grader_processes, :terminated, :boolean
3 add_column :grader_processes, :terminated, :boolean
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :grader_processes, :terminated
7 remove_column :grader_processes, :terminated
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class AddTitleToAnnouncements < ActiveRecord::Migration
1 + class AddTitleToAnnouncements < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :announcements, :title, :string
3 add_column :announcements, :title, :string
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :announcements, :title
7 remove_column :announcements, :title
8 end
8 end
9 end
9 end
@@ -1,15 +1,15
1 - class CreateTestPairs < ActiveRecord::Migration
1 + class CreateTestPairs < ActiveRecord::Migration[4.2]
2 def self.up
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 t.integer :problem_id
4 t.integer :problem_id
5 t.text :input
5 t.text :input
6 t.text :solution
6 t.text :solution
7
7
8 t.timestamps
8 t.timestamps
9 end
9 end
10 end
10 end
11
11
12 def self.down
12 def self.down
13 drop_table :test_pairs
13 drop_table :test_pairs
14 end
14 end
15 end
15 end
@@ -1,9 +1,9
1 - class AddDescriptionToConfig < ActiveRecord::Migration
1 + class AddDescriptionToConfig < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :configurations, :description, :text
3 add_column :configurations, :description, :text
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :configurations, :description
7 remove_column :configurations, :description
8 end
8 end
9 end
9 end
@@ -1,14 +1,14
1 - class CreateUserContestStats < ActiveRecord::Migration
1 + class CreateUserContestStats < ActiveRecord::Migration[4.2]
2 def self.up
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 t.integer :user_id
4 t.integer :user_id
5 t.timestamp :started_at
5 t.timestamp :started_at
6
6
7 t.timestamps
7 t.timestamps
8 end
8 end
9 end
9 end
10
10
11 def self.down
11 def self.down
12 drop_table :user_contest_stats
12 drop_table :user_contest_stats
13 end
13 end
14 end
14 end
@@ -1,11 +1,11
1 - class ChangeInputSolutionFieldLimitInTestPair < ActiveRecord::Migration
1 + class ChangeInputSolutionFieldLimitInTestPair < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 change_column :test_pairs, :input, :text, :limit => 1.megabytes
3 change_column :test_pairs, :input, :text, :limit => 1.megabytes
4 change_column :test_pairs, :solution, :text, :limit => 1.megabytes
4 change_column :test_pairs, :solution, :text, :limit => 1.megabytes
5 end
5 end
6
6
7 def self.down
7 def self.down
8 change_column :test_pairs, :input, :text
8 change_column :test_pairs, :input, :text
9 change_column :test_pairs, :solution, :text
9 change_column :test_pairs, :solution, :text
10 end
10 end
11 end
11 end
@@ -1,14 +1,14
1 - class CreateContests < ActiveRecord::Migration
1 + class CreateContests < ActiveRecord::Migration[4.2]
2 def self.up
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 t.string :title
4 t.string :title
5 t.boolean :enabled
5 t.boolean :enabled
6
6
7 t.timestamps
7 t.timestamps
8 end
8 end
9 end
9 end
10
10
11 def self.down
11 def self.down
12 drop_table :contests
12 drop_table :contests
13 end
13 end
14 end
14 end
@@ -1,12 +1,12
1 - class CreateContestsUsersJoinTable < ActiveRecord::Migration
1 + class CreateContestsUsersJoinTable < ActiveRecord::Migration[4.2]
2 def self.up
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 t.integer :contest_id
4 t.integer :contest_id
5 t.integer :user_id
5 t.integer :user_id
6 end
6 end
7 end
7 end
8
8
9 def self.down
9 def self.down
10 drop_table :contests_users
10 drop_table :contests_users
11 end
11 end
12 end
12 end
@@ -1,12 +1,12
1 - class CreateContestsProblemsJoinTable < ActiveRecord::Migration
1 + class CreateContestsProblemsJoinTable < ActiveRecord::Migration[4.2]
2 def self.up
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 t.integer :contest_id
4 t.integer :contest_id
5 t.integer :problem_id
5 t.integer :problem_id
6 end
6 end
7 end
7 end
8
8
9 def self.down
9 def self.down
10 drop_table :contests_problems
10 drop_table :contests_problems
11 end
11 end
12 end
12 end
@@ -1,9 +1,9
1 - class AddDescriptionFilenameToProblems < ActiveRecord::Migration
1 + class AddDescriptionFilenameToProblems < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :problems, :description_filename, :string
3 add_column :problems, :description_filename, :string
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :problems, :description_filename
7 remove_column :problems, :description_filename
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class AddNameToContests < ActiveRecord::Migration
1 + class AddNameToContests < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :contests, :name, :string
3 add_column :contests, :name, :string
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :contests, :name
7 remove_column :contests, :name
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class AddForcedLogoutToUserContestStat < ActiveRecord::Migration
1 + class AddForcedLogoutToUserContestStat < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :user_contest_stats, :forced_logout, :boolean
3 add_column :user_contest_stats, :forced_logout, :boolean
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :user_contest_stats, :forced_logout, :boolean
7 remove_column :user_contest_stats, :forced_logout, :boolean
8 end
8 end
9 end
9 end
@@ -1,9 +1,9
1 - class AddNotesToAnnouncements < ActiveRecord::Migration
1 + class AddNotesToAnnouncements < ActiveRecord::Migration[4.2]
2 def self.up
2 def self.up
3 add_column :announcements, :notes, :string
3 add_column :announcements, :notes, :string
4 end
4 end
5
5
6 def self.down
6 def self.down
7 remove_column :announcements, :notes
7 remove_column :announcements, :notes
8 end
8 end
9 end
9 end
@@ -1,5 +1,5
1 - class RenameConfigurationsToGraderConfigurations < ActiveRecord::Migration
1 + class RenameConfigurationsToGraderConfigurations < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 rename_table 'configurations', 'grader_configurations'
3 rename_table 'configurations', 'grader_configurations'
4 end
4 end
5 end
5 end
@@ -1,7 +1,7
1 - class AddMoreDetailToSubmission < ActiveRecord::Migration
1 + class AddMoreDetailToSubmission < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_column :submissions, :max_runtime, :float
3 add_column :submissions, :max_runtime, :float
4 add_column :submissions, :peak_memory, :integer
4 add_column :submissions, :peak_memory, :integer
5 add_column :submissions, :effective_code_length, :integer
5 add_column :submissions, :effective_code_length, :integer
6 end
6 end
7 end
7 end
@@ -1,10 +1,10
1 - class CreateLogins < ActiveRecord::Migration
1 + class CreateLogins < ActiveRecord::Migration[4.2]
2 def change
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 t.string :user_id
4 t.string :user_id
5 t.string :ip_address
5 t.string :ip_address
6
6
7 t.timestamps
7 t.timestamps
8 end
8 end
9 end
9 end
10 end
10 end
@@ -1,5 +1,5
1 - class AddSectionToUsers < ActiveRecord::Migration
1 + class AddSectionToUsers < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_column :users, :section, :string
3 add_column :users, :section, :string
4 end
4 end
5 end
5 end
@@ -1,5 +1,5
1 - class AddIpToSubmissions < ActiveRecord::Migration
1 + class AddIpToSubmissions < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_column :submissions, :ip_address, :string
3 add_column :submissions, :ip_address, :string
4 end
4 end
5 end
5 end
@@ -1,6 +1,6
1 - class AddMoreToUsers < ActiveRecord::Migration
1 + class AddMoreToUsers < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_column :users, :enabled, :boolean, default: 1
3 add_column :users, :enabled, :boolean, default: 1
4 add_column :users, :remark, :string
4 add_column :users, :remark, :string
5 end
5 end
6 end
6 end
@@ -1,9 +1,9
1 - class ChangeUseridOnLogin < ActiveRecord::Migration
1 + class ChangeUseridOnLogin < ActiveRecord::Migration[4.2]
2 def up
2 def up
3 change_column :logins, :user_id, :integer
3 change_column :logins, :user_id, :integer
4 end
4 end
5
5
6 def down
6 def down
7 change_column :logins, :user_id, :string
7 change_column :logins, :user_id, :string
8 end
8 end
9 end
9 end
@@ -1,10 +1,10
1 - class CreateSubmissionViewLogs < ActiveRecord::Migration
1 + class CreateSubmissionViewLogs < ActiveRecord::Migration[4.2]
2 def change
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 t.integer :user_id
4 t.integer :user_id
5 t.integer :submission_id
5 t.integer :submission_id
6
6
7 t.timestamps
7 t.timestamps
8 end
8 end
9 end
9 end
10 end
10 end
@@ -1,5 +1,5
1 - class AddLastIpToUser < ActiveRecord::Migration
1 + class AddLastIpToUser < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_column :users, :last_ip, :string
3 add_column :users, :last_ip, :string
4 end
4 end
5 end
5 end
@@ -1,10 +1,10
1 - class CreateHeartBeats < ActiveRecord::Migration
1 + class CreateHeartBeats < ActiveRecord::Migration[4.2]
2 def change
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 t.column 'user_id',:integer
4 t.column 'user_id',:integer
5 t.column 'ip_address',:string
5 t.column 'ip_address',:string
6
6
7 t.timestamps
7 t.timestamps
8 end
8 end
9 end
9 end
10 end
10 end
@@ -1,5 +1,5
1 - class AddStatusToHeartBeat < ActiveRecord::Migration
1 + class AddStatusToHeartBeat < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_column :heart_beats, :status, :string
3 add_column :heart_beats, :status, :string
4 end
4 end
5 end
5 end
@@ -1,9 +1,9
1 - class AddMoreConfig < ActiveRecord::Migration
1 + class AddMoreConfig < ActiveRecord::Migration[4.2]
2 def up
2 def up
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'
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 end
4 end
5
5
6 def down
6 def down
7
7
8 end
8 end
9 end
9 end
@@ -1,10 +1,10
1 - class UpdateHeartBeat < ActiveRecord::Migration
1 + class UpdateHeartBeat < ActiveRecord::Migration[4.2]
2 def up
2 def up
3 GraderConfiguration.create key: 'right.heartbeat_response', value_type: 'string', value:'OK', description:'Heart beat response text'
3 GraderConfiguration.create key: 'right.heartbeat_response', value_type: 'string', value:'OK', description:'Heart beat response text'
4 add_index :heart_beats, :updated_at
4 add_index :heart_beats, :updated_at
5 end
5 end
6
6
7 def down
7 def down
8 remove_index :heart_beats, :updated_at
8 remove_index :heart_beats, :updated_at
9 end
9 end
10 end
10 end
@@ -1,9 +1,9
1 - class ModifyGraderProcess < ActiveRecord::Migration
1 + class ModifyGraderProcess < ActiveRecord::Migration[4.2]
2 def up
2 def up
3 change_column :grader_processes, :host, :string
3 change_column :grader_processes, :host, :string
4 end
4 end
5
5
6 def down
6 def down
7 change_column :grader_processes, :host, :string, limit: 20
7 change_column :grader_processes, :host, :string, limit: 20
8 end
8 end
9 end
9 end
@@ -1,15 +1,15
1 - class CreateTestcases < ActiveRecord::Migration
1 + class CreateTestcases < ActiveRecord::Migration[4.2]
2 def change
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 t.references :problem
4 t.references :problem
5 t.integer :num
5 t.integer :num
6 t.integer :group
6 t.integer :group
7 t.integer :score
7 t.integer :score
8 t.text :input
8 t.text :input
9 t.text :sol
9 t.text :sol
10
10
11 t.timestamps
11 t.timestamps
12 end
12 end
13 add_index :testcases, :problem_id
13 add_index :testcases, :problem_id
14 end
14 end
15 end
15 end
@@ -1,13 +1,13
1 - class AddConfigViewTest < ActiveRecord::Migration
1 + class AddConfigViewTest < ActiveRecord::Migration[4.2]
2 def up
2 def up
3 GraderConfiguration.create key: 'right.view_testcase', value_type: 'boolean', value:'true', description:'When true, any user can view/download test data'
3 GraderConfiguration.create key: 'right.view_testcase', value_type: 'boolean', value:'true', description:'When true, any user can view/download test data'
4 #uglily and dirtily and shamelessly check other config and inifialize
4 #uglily and dirtily and shamelessly check other config and inifialize
5 GraderConfiguration.where(key: 'right.user_hall_of_fame').first_or_create(value_type: 'boolean', value: 'false',
5 GraderConfiguration.where(key: 'right.user_hall_of_fame').first_or_create(value_type: 'boolean', value: 'false',
6 description: 'If true, any user can access hall of fame page.')
6 description: 'If true, any user can access hall of fame page.')
7 GraderConfiguration.where(key: 'right.multiple_ip_login').first_or_create(value_type: 'boolean', value: 'false',
7 GraderConfiguration.where(key: 'right.multiple_ip_login').first_or_create(value_type: 'boolean', value: 'false',
8 description: 'When change from true to false, a user can login from the first IP they logged into afterward.')
8 description: 'When change from true to false, a user can login from the first IP they logged into afterward.')
9 GraderConfiguration.where(key: 'right.user_view_submission').first_or_create(value_type: 'boolean', value: 'false',
9 GraderConfiguration.where(key: 'right.user_view_submission').first_or_create(value_type: 'boolean', value: 'false',
10 description: 'If true, any user can view submissions of every one.')
10 description: 'If true, any user can view submissions of every one.')
11 end
11 end
12
12
13 def down
13 def down
@@ -1,6 +1,6
1 - class ChangeTestcaseSize < ActiveRecord::Migration
1 + class ChangeTestcaseSize < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 change_column :testcases, :input, :text, :limit => 4294967295
3 change_column :testcases, :input, :text, :limit => 4294967295
4 change_column :testcases, :sol, :text, :limit => 4294967295
4 change_column :testcases, :sol, :text, :limit => 4294967295
5 end
5 end
6 end
6 end
@@ -1,5 +1,5
1 - class AddViewTestcaseToProblem < ActiveRecord::Migration
1 + class AddViewTestcaseToProblem < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_column :problems, :view_testcase, :bool
3 add_column :problems, :view_testcase, :bool
4 end
4 end
5 end
5 end
@@ -1,5 +1,5
1 - class AddIndexToTask < ActiveRecord::Migration
1 + class AddIndexToTask < ActiveRecord::Migration[4.2]
2 def change
2 def change
3 add_index :tasks, :submission_id
3 add_index :tasks, :submission_id
4 end
4 end
5 end
5 end
@@ -1,9 +1,9
1 - class AddHeartBeatFull < ActiveRecord::Migration
1 + class AddHeartBeatFull < ActiveRecord::Migration[4.2]
2 def up
2 def up
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)'
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 end
4 end
5
5
6 def down
6 def down
7
7
8 end
8 end
9 end
9 end
@@ -1,26 +1,26
1 - class CreateGroups < ActiveRecord::Migration
1 + class CreateGroups < ActiveRecord::Migration[4.2]
2
2
3 def change
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 t.string :name
5 t.string :name
6 t.string :description
6 t.string :description
7 end
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 # t.index [:group_id, :user_id]
10 # t.index [:group_id, :user_id]
11 t.index [:user_id, :group_id]
11 t.index [:user_id, :group_id]
12 end
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 # t.index [:problem_id, :group_id]
15 # t.index [:problem_id, :group_id]
16 t.index [:group_id, :problem_id]
16 t.index [:group_id, :problem_id]
17 end
17 end
18
18
19 reversible do |change|
19 reversible do |change|
20 change.up do
20 change.up do
21 GraderConfiguration.where(key: 'system.use_problem_group').first_or_create(value_type: 'boolean', value: 'false',
21 GraderConfiguration.where(key: 'system.use_problem_group').first_or_create(value_type: 'boolean', value: 'false',
22 description: 'If true, available problem to the user will be only ones associated with the group of the user');
22 description: 'If true, available problem to the user will be only ones associated with the group of the user');
23 end
23 end
24
24
25 change.down do
25 change.down do
26 GraderConfiguration.where(key: 'system.use_problem_group').destroy_all
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 def change
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 t.string :name, null: false
4 t.string :name, null: false
5 t.text :description
5 t.text :description
6 t.boolean :public
6 t.boolean :public
7
7
8 t.timestamps null: false
8 t.timestamps null: false
9 end
9 end
10 end
10 end
11 end
11 end
@@ -1,10 +1,10
1 - class CreateProblemTags < ActiveRecord::Migration
1 + class CreateProblemTags < ActiveRecord::Migration[4.2]
2 def change
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 t.references :problem, index: true, foreign_key: true
4 t.references :problem, index: true, foreign_key: true
5 t.references :tag, index: true, foreign_key: true
5 t.references :tag, index: true, foreign_key: true
6
6
7 t.index [:problem_id,:tag_id], unique: true
7 t.index [:problem_id,:tag_id], unique: true
8 end
8 end
9 end
9 end
10 end
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