Upgrade Rails to version 5.2.1 and adopt code & specs where necessary
Signed-off-by: Sebastian Serth <Sebastian.Serth@student.hpi.de>
This commit is contained in:
@ -19,7 +19,7 @@ before_install:
|
|||||||
- docker pull openhpi/co_execenv_python
|
- docker pull openhpi/co_execenv_python
|
||||||
- docker pull openhpi/co_execenv_java
|
- docker pull openhpi/co_execenv_java
|
||||||
- mkdir ~/geckodriver
|
- mkdir ~/geckodriver
|
||||||
- wget -O ~/geckodriver/download.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
|
- wget -O ~/geckodriver/download.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz
|
||||||
- tar -xvzf ~/geckodriver/download.tar.gz -C ~/geckodriver/
|
- tar -xvzf ~/geckodriver/download.tar.gz -C ~/geckodriver/
|
||||||
- rm ~/geckodriver/download.tar.gz
|
- rm ~/geckodriver/download.tar.gz
|
||||||
- chmod +x ~/geckodriver/geckodriver
|
- chmod +x ~/geckodriver/geckodriver
|
||||||
@ -39,6 +39,6 @@ before_script:
|
|||||||
cache: bundler
|
cache: bundler
|
||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.3.6
|
- 2.5.1
|
||||||
|
|
||||||
script: bundle exec rspec --color --format documentation --require spec_helper --require rails_helper && bundle exec codeclimate-test-reporter
|
script: bundle exec rspec --color --format documentation --require spec_helper --require rails_helper && bundle exec codeclimate-test-reporter
|
||||||
|
18
Gemfile
18
Gemfile
@ -14,11 +14,11 @@ gem 'jquery-turbolinks'
|
|||||||
gem 'ims-lti', '< 2.0.0'
|
gem 'ims-lti', '< 2.0.0'
|
||||||
gem 'kramdown'
|
gem 'kramdown'
|
||||||
gem 'newrelic_rpm'
|
gem 'newrelic_rpm'
|
||||||
gem 'pg', '< 1.0', platform: :ruby
|
gem 'pg'
|
||||||
gem 'pry-byebug'
|
gem 'pry-byebug'
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
gem 'pundit'
|
gem 'pundit'
|
||||||
gem 'rails', '4.2.10'
|
gem 'rails', '5.2.1'
|
||||||
gem 'rails-i18n'
|
gem 'rails-i18n'
|
||||||
gem 'ransack'
|
gem 'ransack'
|
||||||
gem 'rubytree'
|
gem 'rubytree'
|
||||||
@ -28,19 +28,20 @@ gem 'bootstrap_pagedown'
|
|||||||
gem 'sorcery'
|
gem 'sorcery'
|
||||||
gem 'turbolinks', '< 5.0.0' # newer versions prevent loading ACE if the page containing is not accessed directly / refreshed
|
gem 'turbolinks', '< 5.0.0' # newer versions prevent loading ACE if the page containing is not accessed directly / refreshed
|
||||||
gem 'uglifier'
|
gem 'uglifier'
|
||||||
gem 'tubesock'
|
gem 'tubesock', git: 'https://github.com/gosukiwi/tubesock', branch: 'patch-1' # Switch to a fork which is compatible with Rails 5
|
||||||
gem 'faye-websocket'
|
gem 'faye-websocket'
|
||||||
gem 'eventmachine', '1.0.9.1' # explicitly added, this is used by faye-websocket, version 1.2.5 still has an error in eventmachine.rb:202: [BUG] Segmentation fault, which is not yet fixed and causes the whole ruby process to crash
|
|
||||||
gem 'nokogiri'
|
gem 'nokogiri'
|
||||||
gem 'd3-rails', '~>4.0'
|
gem 'd3-rails'
|
||||||
gem 'rest-client'
|
gem 'rest-client'
|
||||||
gem 'rubyzip'
|
gem 'rubyzip'
|
||||||
gem 'mnemosyne-ruby'
|
gem 'mnemosyne-ruby'
|
||||||
gem 'whenever', require: false
|
gem 'whenever', require: false
|
||||||
|
|
||||||
group :development, :staging do
|
group :development, :staging do
|
||||||
gem 'better_errors', platform: :ruby
|
gem 'bootsnap', require: false
|
||||||
gem 'binding_of_caller', platform: :ruby
|
gem 'listen'
|
||||||
|
gem 'better_errors'
|
||||||
|
gem 'binding_of_caller'
|
||||||
gem 'capistrano'
|
gem 'capistrano'
|
||||||
gem 'capistrano3-puma'
|
gem 'capistrano3-puma'
|
||||||
gem 'capistrano-rails'
|
gem 'capistrano-rails'
|
||||||
@ -49,7 +50,7 @@ group :development, :staging do
|
|||||||
gem 'rack-mini-profiler'
|
gem 'rack-mini-profiler'
|
||||||
gem 'rubocop', require: false
|
gem 'rubocop', require: false
|
||||||
gem 'rubocop-rspec'
|
gem 'rubocop-rspec'
|
||||||
gem 'web-console', platform: :ruby
|
gem 'web-console'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test, :staging do
|
group :development, :test, :staging do
|
||||||
@ -57,6 +58,7 @@ group :development, :test, :staging do
|
|||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
gem 'rails-controller-testing'
|
||||||
gem 'autotest-rails'
|
gem 'autotest-rails'
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'selenium-webdriver'
|
gem 'selenium-webdriver'
|
||||||
|
206
Gemfile.lock
206
Gemfile.lock
@ -1,47 +1,63 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/gosukiwi/tubesock
|
||||||
|
revision: 86a5ca4f7d3c3a7b9a727ad91df3b9b4912eda39
|
||||||
|
branch: patch-1
|
||||||
|
specs:
|
||||||
|
tubesock (0.2.7)
|
||||||
|
rack (>= 1.5.0)
|
||||||
|
websocket (>= 1.1.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
ZenTest (4.11.1)
|
ZenTest (4.11.1)
|
||||||
actionmailer (4.2.10)
|
actioncable (5.2.1)
|
||||||
actionpack (= 4.2.10)
|
actionpack (= 5.2.1)
|
||||||
actionview (= 4.2.10)
|
nio4r (~> 2.0)
|
||||||
activejob (= 4.2.10)
|
websocket-driver (>= 0.6.1)
|
||||||
|
actionmailer (5.2.1)
|
||||||
|
actionpack (= 5.2.1)
|
||||||
|
actionview (= 5.2.1)
|
||||||
|
activejob (= 5.2.1)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (4.2.10)
|
actionpack (5.2.1)
|
||||||
actionview (= 4.2.10)
|
actionview (= 5.2.1)
|
||||||
activesupport (= 4.2.10)
|
activesupport (= 5.2.1)
|
||||||
rack (~> 1.6)
|
rack (~> 2.0)
|
||||||
rack-test (~> 0.6.2)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
actionview (4.2.10)
|
actionview (5.2.1)
|
||||||
activesupport (= 4.2.10)
|
activesupport (= 5.2.1)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubis (~> 2.7.0)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||||
activejob (4.2.10)
|
activejob (5.2.1)
|
||||||
activesupport (= 4.2.10)
|
activesupport (= 5.2.1)
|
||||||
globalid (>= 0.3.0)
|
globalid (>= 0.3.6)
|
||||||
activemodel (4.2.10)
|
activemodel (5.2.1)
|
||||||
activesupport (= 4.2.10)
|
activesupport (= 5.2.1)
|
||||||
builder (~> 3.1)
|
activerecord (5.2.1)
|
||||||
activerecord (4.2.10)
|
activemodel (= 5.2.1)
|
||||||
activemodel (= 4.2.10)
|
activesupport (= 5.2.1)
|
||||||
activesupport (= 4.2.10)
|
arel (>= 9.0)
|
||||||
arel (~> 6.0)
|
activestorage (5.2.1)
|
||||||
activesupport (4.2.10)
|
actionpack (= 5.2.1)
|
||||||
i18n (~> 0.7)
|
activerecord (= 5.2.1)
|
||||||
|
marcel (~> 0.3.1)
|
||||||
|
activesupport (5.2.1)
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.3, >= 0.3.4)
|
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
addressable (2.5.2)
|
addressable (2.5.2)
|
||||||
public_suffix (>= 2.0.2, < 4.0)
|
public_suffix (>= 2.0.2, < 4.0)
|
||||||
airbrussh (1.3.0)
|
airbrussh (1.3.0)
|
||||||
sshkit (>= 1.6.1, != 1.7.0)
|
sshkit (>= 1.6.1, != 1.7.0)
|
||||||
amq-protocol (2.3.0)
|
amq-protocol (2.3.0)
|
||||||
arel (6.0.4)
|
arel (9.0.0)
|
||||||
ast (2.4.0)
|
ast (2.4.0)
|
||||||
autotest-rails (4.2.1)
|
autotest-rails (4.2.1)
|
||||||
ZenTest (~> 4.5)
|
ZenTest (~> 4.5)
|
||||||
@ -50,8 +66,11 @@ GEM
|
|||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
erubi (>= 1.0.0)
|
erubi (>= 1.0.0)
|
||||||
rack (>= 0.9.0)
|
rack (>= 0.9.0)
|
||||||
|
bindex (0.5.0)
|
||||||
binding_of_caller (0.8.0)
|
binding_of_caller (0.8.0)
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
|
bootsnap (1.3.2)
|
||||||
|
msgpack (~> 1.0)
|
||||||
bootstrap-will_paginate (1.0.0)
|
bootstrap-will_paginate (1.0.0)
|
||||||
will_paginate
|
will_paginate
|
||||||
bootstrap_pagedown (1.1.0)
|
bootstrap_pagedown (1.1.0)
|
||||||
@ -80,7 +99,7 @@ GEM
|
|||||||
capistrano (~> 3.7)
|
capistrano (~> 3.7)
|
||||||
capistrano-bundler
|
capistrano-bundler
|
||||||
puma (~> 3.4)
|
puma (~> 3.4)
|
||||||
capybara (3.7.1)
|
capybara (3.7.2)
|
||||||
addressable
|
addressable
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
@ -94,8 +113,8 @@ GEM
|
|||||||
childprocess (0.9.0)
|
childprocess (0.9.0)
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
codeclimate-test-reporter (1.0.7)
|
codeclimate-test-reporter (1.0.8)
|
||||||
simplecov
|
simplecov (<= 0.13)
|
||||||
coderay (1.1.2)
|
coderay (1.1.2)
|
||||||
coffee-rails (4.2.2)
|
coffee-rails (4.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
@ -106,20 +125,19 @@ GEM
|
|||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
crass (1.0.4)
|
crass (1.0.4)
|
||||||
d3-rails (4.13.0)
|
d3-rails (5.5.0)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
database_cleaner (1.7.0)
|
database_cleaner (1.7.0)
|
||||||
debug_inspector (0.0.3)
|
debug_inspector (0.0.3)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
docile (1.3.1)
|
docile (1.1.5)
|
||||||
docker-api (1.34.2)
|
docker-api (1.34.2)
|
||||||
excon (>= 0.47.0)
|
excon (>= 0.47.0)
|
||||||
multi_json
|
multi_json
|
||||||
domain_name (0.5.20180417)
|
domain_name (0.5.20180417)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
erubi (1.7.1)
|
erubi (1.7.1)
|
||||||
erubis (2.7.0)
|
eventmachine (1.2.7)
|
||||||
eventmachine (1.0.9.1)
|
|
||||||
excon (0.62.0)
|
excon (0.62.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
factory_bot (4.11.1)
|
factory_bot (4.11.1)
|
||||||
@ -140,7 +158,7 @@ GEM
|
|||||||
highline (2.0.0)
|
highline (2.0.0)
|
||||||
http-cookie (1.0.3)
|
http-cookie (1.0.3)
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
i18n (0.9.5)
|
i18n (1.1.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
ims-lti (1.2.2)
|
ims-lti (1.2.2)
|
||||||
builder
|
builder
|
||||||
@ -159,21 +177,29 @@ GEM
|
|||||||
json (2.1.0)
|
json (2.1.0)
|
||||||
jwt (1.5.6)
|
jwt (1.5.6)
|
||||||
kramdown (1.17.0)
|
kramdown (1.17.0)
|
||||||
|
listen (3.1.5)
|
||||||
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
|
ruby_dep (~> 1.2)
|
||||||
loofah (2.2.2)
|
loofah (2.2.2)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.7.0)
|
mail (2.7.0)
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
|
marcel (0.3.3)
|
||||||
|
mimemagic (~> 0.3.2)
|
||||||
method_source (0.9.0)
|
method_source (0.9.0)
|
||||||
mime-types (3.2.2)
|
mime-types (3.2.2)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2018.0812)
|
mime-types-data (3.2018.0812)
|
||||||
|
mimemagic (0.3.2)
|
||||||
mini_mime (1.0.1)
|
mini_mime (1.0.1)
|
||||||
mini_portile2 (2.3.0)
|
mini_portile2 (2.3.0)
|
||||||
minitest (5.11.3)
|
minitest (5.11.3)
|
||||||
mnemosyne-ruby (1.5.1)
|
mnemosyne-ruby (1.5.1)
|
||||||
activesupport (>= 4)
|
activesupport (>= 4)
|
||||||
bunny
|
bunny
|
||||||
|
msgpack (1.2.4)
|
||||||
multi_json (1.13.1)
|
multi_json (1.13.1)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
@ -181,7 +207,8 @@ GEM
|
|||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (5.0.2)
|
net-ssh (5.0.2)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
newrelic_rpm (5.3.0.346)
|
newrelic_rpm (5.4.0.347)
|
||||||
|
nio4r (2.3.1)
|
||||||
nokogiri (1.8.4)
|
nokogiri (1.8.4)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.3.0)
|
||||||
nyan-cat-formatter (0.12.0)
|
nyan-cat-formatter (0.12.0)
|
||||||
@ -196,7 +223,7 @@ GEM
|
|||||||
parallel (1.12.1)
|
parallel (1.12.1)
|
||||||
parser (2.5.1.2)
|
parser (2.5.1.2)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
pg (0.21.0)
|
pg (1.1.3)
|
||||||
powerpack (0.1.2)
|
powerpack (0.1.2)
|
||||||
pry (0.11.3)
|
pry (0.11.3)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
@ -208,44 +235,48 @@ GEM
|
|||||||
puma (3.12.0)
|
puma (3.12.0)
|
||||||
pundit (2.0.0)
|
pundit (2.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
rack (1.6.10)
|
rack (2.0.5)
|
||||||
rack-mini-profiler (1.0.0)
|
rack-mini-profiler (1.0.0)
|
||||||
rack (>= 1.2.0)
|
rack (>= 1.2.0)
|
||||||
rack-test (0.6.3)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0, < 3)
|
||||||
rails (4.2.10)
|
rails (5.2.1)
|
||||||
actionmailer (= 4.2.10)
|
actioncable (= 5.2.1)
|
||||||
actionpack (= 4.2.10)
|
actionmailer (= 5.2.1)
|
||||||
actionview (= 4.2.10)
|
actionpack (= 5.2.1)
|
||||||
activejob (= 4.2.10)
|
actionview (= 5.2.1)
|
||||||
activemodel (= 4.2.10)
|
activejob (= 5.2.1)
|
||||||
activerecord (= 4.2.10)
|
activemodel (= 5.2.1)
|
||||||
activesupport (= 4.2.10)
|
activerecord (= 5.2.1)
|
||||||
bundler (>= 1.3.0, < 2.0)
|
activestorage (= 5.2.1)
|
||||||
railties (= 4.2.10)
|
activesupport (= 5.2.1)
|
||||||
sprockets-rails
|
bundler (>= 1.3.0)
|
||||||
rails-deprecated_sanitizer (1.0.3)
|
railties (= 5.2.1)
|
||||||
activesupport (>= 4.2.0.alpha)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-dom-testing (1.0.9)
|
rails-controller-testing (1.0.2)
|
||||||
activesupport (>= 4.2.0, < 5.0)
|
actionpack (~> 5.x, >= 5.0.1)
|
||||||
nokogiri (~> 1.6)
|
actionview (~> 5.x, >= 5.0.1)
|
||||||
rails-deprecated_sanitizer (>= 1.0.1)
|
activesupport (~> 5.x)
|
||||||
|
rails-dom-testing (2.0.3)
|
||||||
|
activesupport (>= 4.2.0)
|
||||||
|
nokogiri (>= 1.6)
|
||||||
rails-html-sanitizer (1.0.4)
|
rails-html-sanitizer (1.0.4)
|
||||||
loofah (~> 2.2, >= 2.2.2)
|
loofah (~> 2.2, >= 2.2.2)
|
||||||
rails-i18n (4.0.9)
|
rails-i18n (5.1.1)
|
||||||
i18n (~> 0.7)
|
i18n (>= 0.7, < 2)
|
||||||
railties (~> 4.0)
|
railties (>= 5.0, < 6)
|
||||||
railties (4.2.10)
|
railties (5.2.1)
|
||||||
actionpack (= 4.2.10)
|
actionpack (= 5.2.1)
|
||||||
activesupport (= 4.2.10)
|
activesupport (= 5.2.1)
|
||||||
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.19.0, < 2.0)
|
||||||
rainbow (3.0.0)
|
rainbow (3.0.0)
|
||||||
rake (12.3.1)
|
rake (12.3.1)
|
||||||
ransack (1.8.9)
|
ransack (2.0.1)
|
||||||
actionpack (>= 3.0, <= 5.1.1)
|
actionpack (>= 5.0)
|
||||||
activerecord (>= 3.0, <= 5.1.1)
|
activerecord (>= 5.0)
|
||||||
activesupport (>= 3.0, <= 5.1.1)
|
activesupport (>= 5.0)
|
||||||
i18n
|
i18n
|
||||||
rb-fsevent (0.10.3)
|
rb-fsevent (0.10.3)
|
||||||
rb-inotify (0.9.10)
|
rb-inotify (0.9.10)
|
||||||
@ -277,7 +308,7 @@ GEM
|
|||||||
rspec-mocks (~> 3.8.0)
|
rspec-mocks (~> 3.8.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.8.0)
|
||||||
rspec-support (3.8.0)
|
rspec-support (3.8.0)
|
||||||
rubocop (0.59.0)
|
rubocop (0.59.1)
|
||||||
jaro_winkler (~> 1.5.1)
|
jaro_winkler (~> 1.5.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.5, != 2.5.1.1)
|
parser (>= 2.5, != 2.5.1.1)
|
||||||
@ -288,6 +319,7 @@ GEM
|
|||||||
rubocop-rspec (1.29.1)
|
rubocop-rspec (1.29.1)
|
||||||
rubocop (>= 0.58.0)
|
rubocop (>= 0.58.0)
|
||||||
ruby-progressbar (1.10.0)
|
ruby-progressbar (1.10.0)
|
||||||
|
ruby_dep (1.5.0)
|
||||||
rubytree (1.0.0)
|
rubytree (1.0.0)
|
||||||
json (~> 2.1)
|
json (~> 2.1)
|
||||||
structured_warnings (~> 0.3)
|
structured_warnings (~> 0.3)
|
||||||
@ -306,8 +338,8 @@ GEM
|
|||||||
selenium-webdriver (3.14.0)
|
selenium-webdriver (3.14.0)
|
||||||
childprocess (~> 0.5)
|
childprocess (~> 0.5)
|
||||||
rubyzip (~> 1.2)
|
rubyzip (~> 1.2)
|
||||||
simplecov (0.16.1)
|
simplecov (0.13.0)
|
||||||
docile (~> 1.1)
|
docile (~> 1.1.0)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
@ -339,23 +371,21 @@ GEM
|
|||||||
thor (0.20.0)
|
thor (0.20.0)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.8)
|
tilt (2.0.8)
|
||||||
tubesock (0.2.7)
|
|
||||||
rack (>= 1.5.0)
|
|
||||||
websocket (>= 1.1.0)
|
|
||||||
turbolinks (2.5.4)
|
turbolinks (2.5.4)
|
||||||
coffee-rails
|
coffee-rails
|
||||||
tzinfo (1.2.5)
|
tzinfo (1.2.5)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (4.1.18)
|
uglifier (4.1.19)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
unf (0.1.4)
|
unf (0.1.4)
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.7.5)
|
unf_ext (0.0.7.5)
|
||||||
unicode-display_width (1.4.0)
|
unicode-display_width (1.4.0)
|
||||||
web-console (3.3.0)
|
web-console (3.7.0)
|
||||||
activemodel (>= 4.2)
|
actionview (>= 5.0)
|
||||||
debug_inspector
|
activemodel (>= 5.0)
|
||||||
railties (>= 4.2)
|
bindex (>= 0.4.0)
|
||||||
|
railties (>= 5.0)
|
||||||
websocket (1.2.8)
|
websocket (1.2.8)
|
||||||
websocket-driver (0.7.0)
|
websocket-driver (0.7.0)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
@ -374,6 +404,7 @@ DEPENDENCIES
|
|||||||
bcrypt
|
bcrypt
|
||||||
better_errors
|
better_errors
|
||||||
binding_of_caller
|
binding_of_caller
|
||||||
|
bootsnap
|
||||||
bootstrap-will_paginate
|
bootstrap-will_paginate
|
||||||
bootstrap_pagedown
|
bootstrap_pagedown
|
||||||
capistrano
|
capistrano
|
||||||
@ -385,10 +416,9 @@ DEPENDENCIES
|
|||||||
carrierwave
|
carrierwave
|
||||||
codeclimate-test-reporter
|
codeclimate-test-reporter
|
||||||
concurrent-ruby
|
concurrent-ruby
|
||||||
d3-rails (~> 4.0)
|
d3-rails
|
||||||
database_cleaner
|
database_cleaner
|
||||||
docker-api
|
docker-api
|
||||||
eventmachine (= 1.0.9.1)
|
|
||||||
factory_bot_rails
|
factory_bot_rails
|
||||||
faye-websocket
|
faye-websocket
|
||||||
forgery
|
forgery
|
||||||
@ -399,16 +429,18 @@ DEPENDENCIES
|
|||||||
jquery-rails
|
jquery-rails
|
||||||
jquery-turbolinks
|
jquery-turbolinks
|
||||||
kramdown
|
kramdown
|
||||||
|
listen
|
||||||
mnemosyne-ruby
|
mnemosyne-ruby
|
||||||
newrelic_rpm
|
newrelic_rpm
|
||||||
nokogiri
|
nokogiri
|
||||||
nyan-cat-formatter
|
nyan-cat-formatter
|
||||||
pg (< 1.0)
|
pg
|
||||||
pry-byebug
|
pry-byebug
|
||||||
puma
|
puma
|
||||||
pundit
|
pundit
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
rails (= 4.2.10)
|
rails (= 5.2.1)
|
||||||
|
rails-controller-testing
|
||||||
rails-i18n
|
rails-i18n
|
||||||
ransack
|
ransack
|
||||||
rest-client
|
rest-client
|
||||||
@ -424,11 +456,11 @@ DEPENDENCIES
|
|||||||
slim-rails
|
slim-rails
|
||||||
sorcery
|
sorcery
|
||||||
spring
|
spring
|
||||||
tubesock
|
tubesock!
|
||||||
turbolinks (< 5.0.0)
|
turbolinks (< 5.0.0)
|
||||||
uglifier
|
uglifier
|
||||||
web-console
|
web-console
|
||||||
whenever
|
whenever
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.16.3
|
1.16.5
|
||||||
|
@ -11,16 +11,23 @@
|
|||||||
// about supported directives.
|
// about supported directives.
|
||||||
//
|
//
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//
|
|
||||||
//= require ace/ace
|
|
||||||
//= require chosen.jquery.min
|
|
||||||
//= require jquery-ui.min
|
|
||||||
//= require d3
|
|
||||||
//= require jquery.turbolinks
|
//= require jquery.turbolinks
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require jstree/jstree.min
|
|
||||||
//= require turbolinks
|
|
||||||
//= require_tree ../../../lib
|
|
||||||
//= require_tree .
|
|
||||||
//= require bootstrap_pagedown
|
//= require bootstrap_pagedown
|
||||||
//= require ace/ext-language_tools
|
//= require d3
|
||||||
|
//= require turbolinks
|
||||||
|
//
|
||||||
|
// lib/assets
|
||||||
|
//= require flash
|
||||||
|
//= require url
|
||||||
|
//
|
||||||
|
// vendor/assets
|
||||||
|
//= require ace/ace
|
||||||
|
//= require ace/ext-language_tools
|
||||||
|
//= require jstree/jstree.min
|
||||||
|
//= require bootstrap.min
|
||||||
|
//= require chosen.jquery.min
|
||||||
|
//= require jquery-ui.min
|
||||||
|
//= require underscore.min
|
||||||
|
//= require vis.min
|
||||||
|
//= require_tree .
|
||||||
|
@ -51,6 +51,7 @@ $(function() {
|
|||||||
} else {
|
} else {
|
||||||
var jqxhr = $.ajax({
|
var jqxhr = $.ajax({
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
url: 'dashboard',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
jqxhr.done(function(response) {
|
jqxhr.done(function(response) {
|
||||||
|
@ -10,9 +10,19 @@
|
|||||||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||||
* file per style scope.
|
* file per style scope.
|
||||||
*
|
*
|
||||||
*= require_tree .
|
|
||||||
*= require_tree ../../../lib
|
|
||||||
*= require_tree ../../../vendor/assets/stylesheets/
|
|
||||||
*= require_self
|
|
||||||
*= require bootstrap_pagedown
|
*= require bootstrap_pagedown
|
||||||
|
*
|
||||||
|
* lib/assets
|
||||||
|
*= require flash
|
||||||
|
*
|
||||||
|
* vendor/assets
|
||||||
|
*= require bootstrap.min
|
||||||
|
*= require chosen.min
|
||||||
|
*= require font-awesome.min
|
||||||
|
*= require google_opensans
|
||||||
|
*= require jquery-ui.min
|
||||||
|
*= require jquery-ui.structure.min
|
||||||
|
*= require style.min
|
||||||
|
*= require vis.min
|
||||||
|
*= require_tree .
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +41,7 @@ module CodeOcean
|
|||||||
end
|
end
|
||||||
|
|
||||||
def file_params
|
def file_params
|
||||||
params[:code_ocean_file].permit(file_attributes).merge(context_type: 'Submission', role: 'user_defined_file')
|
params[:code_ocean_file].permit(file_attributes).merge(context_type: 'Submission', role: 'user_defined_file') if params[:code_ocean_file].present?
|
||||||
end
|
end
|
||||||
private :file_params
|
private :file_params
|
||||||
end
|
end
|
||||||
|
@ -23,9 +23,9 @@ module Lti
|
|||||||
session.delete(:consumer_id)
|
session.delete(:consumer_id)
|
||||||
session.delete(:external_user_id)
|
session.delete(:external_user_id)
|
||||||
else
|
else
|
||||||
LtiParameter.destroy_all(consumers_id: consumer_id,
|
LtiParameter.where(consumers_id: consumer_id,
|
||||||
external_users_id: user_id,
|
external_users_id: user_id,
|
||||||
exercises_id: exercise_id)
|
exercises_id: exercise_id).destroy_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
private :clear_lti_session_data
|
private :clear_lti_session_data
|
||||||
@ -138,7 +138,7 @@ module Lti
|
|||||||
external_users_id: @current_user.id,
|
external_users_id: @current_user.id,
|
||||||
exercises_id: @exercise.id)
|
exercises_id: @exercise.id)
|
||||||
|
|
||||||
lti_parameters.lti_parameters = options[:parameters].slice(*SESSION_PARAMETERS).to_json
|
lti_parameters.lti_parameters = options[:parameters].slice(*SESSION_PARAMETERS).permit!.to_h
|
||||||
lti_parameters.save!
|
lti_parameters.save!
|
||||||
@lti_parameters = lti_parameters
|
@lti_parameters = lti_parameters
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ module RemoteEvaluationParameters
|
|||||||
include FileParameters
|
include FileParameters
|
||||||
|
|
||||||
def remote_evaluation_params
|
def remote_evaluation_params
|
||||||
remote_evaluation_params = params[:remote_evaluation].permit(:validation_token, files_attributes: file_attributes)
|
remote_evaluation_params = params[:remote_evaluation].permit(:validation_token, files_attributes: file_attributes) if params[:remote_evaluation].present?
|
||||||
end
|
end
|
||||||
private :remote_evaluation_params
|
private :remote_evaluation_params
|
||||||
end
|
end
|
@ -16,7 +16,7 @@ module SubmissionParameters
|
|||||||
current_user_id = current_user.id
|
current_user_id = current_user.id
|
||||||
current_user_class_name = current_user.class.name
|
current_user_class_name = current_user.class.name
|
||||||
end
|
end
|
||||||
submission_params = params[:submission].permit(:cause, :exercise_id, files_attributes: file_attributes).merge(user_id: current_user_id, user_type: current_user_class_name)
|
submission_params = params[:submission].present? ? params[:submission].permit(:cause, :exercise_id, files_attributes: file_attributes).merge(user_id: current_user_id, user_type: current_user_class_name) : {}
|
||||||
reject_illegal_file_attributes!(submission_params)
|
reject_illegal_file_attributes!(submission_params)
|
||||||
submission_params
|
submission_params
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ class ConsumersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def consumer_params
|
def consumer_params
|
||||||
params[:consumer].permit(:name, :oauth_key, :oauth_secret)
|
params[:consumer].permit(:name, :oauth_key, :oauth_secret) if params[:consumer].present?
|
||||||
end
|
end
|
||||||
private :consumer_params
|
private :consumer_params
|
||||||
|
|
||||||
|
@ -81,6 +81,6 @@ class ErrorTemplateAttributesController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def error_template_attribute_params
|
def error_template_attribute_params
|
||||||
params[:error_template_attribute].permit(:key, :description, :regex, :important)
|
params[:error_template_attribute].permit(:key, :description, :regex, :important) if params[:error_template_attribute].present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -99,6 +99,6 @@ class ErrorTemplatesController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def error_template_params
|
def error_template_params
|
||||||
params[:error_template].permit(:name, :execution_environment_id, :signature, :description, :hint)
|
params[:error_template].permit(:name, :execution_environment_id, :signature, :description, :hint) if params[:error_template].present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -15,14 +15,14 @@ class ErrorsController < ApplicationController
|
|||||||
if hint
|
if hint
|
||||||
render(json: {hint: hint})
|
render(json: {hint: hint})
|
||||||
else
|
else
|
||||||
render(nothing: true, status: @error.save ? :created : :unprocessable_entity)
|
head (@error.save ? :created : :unprocessable_entity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def error_params
|
def error_params
|
||||||
params[:error].permit(:message, :submission_id).merge(execution_environment_id: @execution_environment.id)
|
params[:error].permit(:message, :submission_id).merge(execution_environment_id: @execution_environment.id) if params[:error].present?
|
||||||
end
|
end
|
||||||
private :error_params
|
private :error_params
|
||||||
|
|
||||||
|
@ -86,11 +86,11 @@ class ExecutionEnvironmentsController < ApplicationController
|
|||||||
working_time_statistics = {}
|
working_time_statistics = {}
|
||||||
user_statistics = {}
|
user_statistics = {}
|
||||||
|
|
||||||
ActiveRecord::Base.connection.execute(working_time_query).each do |tuple|
|
ApplicationRecord.connection.execute(working_time_query).each do |tuple|
|
||||||
working_time_statistics[tuple["exercise_id"].to_i] = tuple
|
working_time_statistics[tuple["exercise_id"].to_i] = tuple
|
||||||
end
|
end
|
||||||
|
|
||||||
ActiveRecord::Base.connection.execute(user_query).each do |tuple|
|
ApplicationRecord.connection.execute(user_query).each do |tuple|
|
||||||
user_statistics[tuple["exercise_id"].to_i] = tuple
|
user_statistics[tuple["exercise_id"].to_i] = tuple
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ class ExecutionEnvironmentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execution_environment_params
|
def execution_environment_params
|
||||||
params[:execution_environment].permit(:docker_image, :exposed_ports, :editor_mode, :file_extension, :file_type_id, :help, :indent_size, :memory_limit, :name, :network_enabled, :permitted_execution_time, :pool_size, :run_command, :test_command, :testing_framework).merge(user_id: current_user.id, user_type: current_user.class.name)
|
params[:execution_environment].permit(:docker_image, :exposed_ports, :editor_mode, :file_extension, :file_type_id, :help, :indent_size, :memory_limit, :name, :network_enabled, :permitted_execution_time, :pool_size, :run_command, :test_command, :testing_framework).merge(user_id: current_user.id, user_type: current_user.class.name) if params[:execution_environment].present?
|
||||||
end
|
end
|
||||||
private :execution_environment_params
|
private :execution_environment_params
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class ExerciseCollectionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def exercise_collection_params
|
def exercise_collection_params
|
||||||
sanitized_params = params[:exercise_collection].permit(:name, :use_anomaly_detection, :user_id, :user_type, :exercise_ids => []).merge(user_type: InternalUser.name)
|
sanitized_params = params[:exercise_collection].present? ? params[:exercise_collection].permit(:name, :use_anomaly_detection, :user_id, :user_type, :exercise_ids => []).merge(user_type: InternalUser.name) : {}
|
||||||
sanitized_params[:exercise_ids] = sanitized_params[:exercise_ids].reject {|v| v.nil? or v == ''}
|
sanitized_params[:exercise_ids] = sanitized_params[:exercise_ids].reject {|v| v.nil? or v == ''}
|
||||||
sanitized_params.tap {|p| p[:exercise_collection_items] = p[:exercise_ids].map.with_index {|_id, index| ExerciseCollectionItem.find_or_create_by(exercise_id: _id, exercise_collection_id: @exercise_collection.id, position: index)}; p.delete(:exercise_ids)}
|
sanitized_params.tap {|p| p[:exercise_collection_items] = p[:exercise_ids].map.with_index {|_id, index| ExerciseCollectionItem.find_or_create_by(exercise_id: _id, exercise_collection_id: @exercise_collection.id, position: index)}; p.delete(:exercise_ids)}
|
||||||
end
|
end
|
||||||
|
@ -12,9 +12,9 @@ class ExercisesController < ApplicationController
|
|||||||
before_action :set_file_types, only: [:create, :edit, :new, :update]
|
before_action :set_file_types, only: [:create, :edit, :new, :update]
|
||||||
before_action :set_course_token, only: [:implement]
|
before_action :set_course_token, only: [:implement]
|
||||||
|
|
||||||
skip_before_filter :verify_authenticity_token, only: [:import_proforma_xml]
|
skip_before_action :verify_authenticity_token, only: [:import_proforma_xml]
|
||||||
skip_after_action :verify_authorized, only: [:import_proforma_xml]
|
skip_after_action :verify_authorized, only: [:import_proforma_xml]
|
||||||
skip_after_action :verify_policy_scoped, only: [:import_proforma_xml]
|
skip_after_action :verify_policy_scoped, only: [:import_proforma_xml], raise: false
|
||||||
|
|
||||||
def authorize!
|
def authorize!
|
||||||
authorize(@exercise || @exercises)
|
authorize(@exercise || @exercises)
|
||||||
@ -77,7 +77,7 @@ class ExercisesController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
@exercise = Exercise.new(exercise_params)
|
@exercise = Exercise.new(exercise_params)
|
||||||
collect_set_and_unset_exercise_tags
|
collect_set_and_unset_exercise_tags
|
||||||
myparam = exercise_params
|
myparam = exercise_params.present? ? exercise_params : { }
|
||||||
checked_exercise_tags = @exercise_tags.select { | et | myparam[:tag_ids].include? et.tag.id.to_s }
|
checked_exercise_tags = @exercise_tags.select { | et | myparam[:tag_ids].include? et.tag.id.to_s }
|
||||||
removed_exercise_tags = @exercise_tags.reject { | et | myparam[:tag_ids].include? et.tag.id.to_s }
|
removed_exercise_tags = @exercise_tags.reject { | et | myparam[:tag_ids].include? et.tag.id.to_s }
|
||||||
|
|
||||||
@ -160,19 +160,21 @@ class ExercisesController < ApplicationController
|
|||||||
private :user_by_code_harbor_token
|
private :user_by_code_harbor_token
|
||||||
|
|
||||||
def exercise_params
|
def exercise_params
|
||||||
params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :allow_file_creation, :allow_auto_completion, :title, :expected_difficulty, files_attributes: file_attributes, :tag_ids => []).merge(user_id: current_user.id, user_type: current_user.class.name)
|
params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :allow_file_creation, :allow_auto_completion, :title, :expected_difficulty, files_attributes: file_attributes, :tag_ids => []).merge(user_id: current_user.id, user_type: current_user.class.name) if params[:exercise].present?
|
||||||
end
|
end
|
||||||
private :exercise_params
|
private :exercise_params
|
||||||
|
|
||||||
def handle_file_uploads
|
def handle_file_uploads
|
||||||
exercise_params[:files_attributes].try(:each) do |index, file_attributes|
|
if exercise_params
|
||||||
if file_attributes[:content].respond_to?(:read)
|
exercise_params[:files_attributes].try(:each) do |index, file_attributes|
|
||||||
file_params = params[:exercise][:files_attributes][index]
|
if file_attributes[:content].respond_to?(:read)
|
||||||
if FileType.find_by(id: file_attributes[:file_type_id]).try(:binary?)
|
file_params = params[:exercise][:files_attributes][index]
|
||||||
file_params[:content] = nil
|
if FileType.find_by(id: file_attributes[:file_type_id]).try(:binary?)
|
||||||
file_params[:native_file] = file_attributes[:content]
|
file_params[:content] = nil
|
||||||
else
|
file_params[:native_file] = file_attributes[:content]
|
||||||
file_params[:content] = file_attributes[:content].read
|
else
|
||||||
|
file_params[:content] = file_attributes[:content].read
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -364,7 +366,7 @@ class ExercisesController < ApplicationController
|
|||||||
query = "SELECT user_id, MAX(score) AS maximum_score, COUNT(id) AS runs
|
query = "SELECT user_id, MAX(score) AS maximum_score, COUNT(id) AS runs
|
||||||
FROM submissions WHERE exercise_id = #{@exercise.id} GROUP BY
|
FROM submissions WHERE exercise_id = #{@exercise.id} GROUP BY
|
||||||
user_id;"
|
user_id;"
|
||||||
ActiveRecord::Base.connection.execute(query).each do |tuple|
|
ApplicationRecord.connection.execute(query).each do |tuple|
|
||||||
user_statistics[tuple["user_id"].to_i] = tuple
|
user_statistics[tuple["user_id"].to_i] = tuple
|
||||||
end
|
end
|
||||||
render locals: {
|
render locals: {
|
||||||
|
@ -57,7 +57,7 @@ class ExternalUsersController < ApplicationController
|
|||||||
|
|
||||||
statistics = {}
|
statistics = {}
|
||||||
|
|
||||||
ActiveRecord::Base.connection.execute(working_time_query(params[:tag])).each do |tuple|
|
ApplicationRecord.connection.execute(working_time_query(params[:tag])).each do |tuple|
|
||||||
statistics[tuple["exercise_id"].to_i] = tuple
|
statistics[tuple["exercise_id"].to_i] = tuple
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,6 +89,6 @@ class FileTemplatesController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def file_template_params
|
def file_template_params
|
||||||
params[:file_template].permit(:name, :file_type_id, :content)
|
params[:file_template].permit(:name, :file_type_id, :content) if params[:file_template].present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ class FileTypesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def file_type_params
|
def file_type_params
|
||||||
params[:file_type].permit(:binary, :editor_mode, :executable, :file_extension, :name, :indent_size, :renderable).merge(user_id: current_user.id, user_type: current_user.class.name)
|
params[:file_type].permit(:binary, :editor_mode, :executable, :file_extension, :name, :indent_size, :renderable).merge(user_id: current_user.id, user_type: current_user.class.name) if params[:file_type].present?
|
||||||
end
|
end
|
||||||
private :file_type_params
|
private :file_type_params
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class HintsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def hint_params
|
def hint_params
|
||||||
params[:hint].permit(:locale, :message, :name, :regular_expression).merge(execution_environment_id: @execution_environment.id)
|
params[:hint].permit(:locale, :message, :name, :regular_expression).merge(execution_environment_id: @execution_environment.id) if params[:hint].present?
|
||||||
end
|
end
|
||||||
private :hint_params
|
private :hint_params
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class InternalUsersController < ApplicationController
|
|||||||
if @user.update(params[:internal_user].permit(:password, :password_confirmation))
|
if @user.update(params[:internal_user].permit(:password, :password_confirmation))
|
||||||
@user.change_password!(params[:internal_user][:password])
|
@user.change_password!(params[:internal_user][:password])
|
||||||
format.html { redirect_to(sign_in_path, notice: t('.success')) }
|
format.html { redirect_to(sign_in_path, notice: t('.success')) }
|
||||||
format.json { render(nothing: true, status: :ok) }
|
format.json { head :ok }
|
||||||
else
|
else
|
||||||
respond_with_invalid_object(format, object: @user, template: :reset_password)
|
respond_with_invalid_object(format, object: @user, template: :reset_password)
|
||||||
end
|
end
|
||||||
@ -66,7 +66,7 @@ class InternalUsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def internal_user_params
|
def internal_user_params
|
||||||
params[:internal_user].permit(:consumer_id, :email, :name, :role)
|
params[:internal_user].permit(:consumer_id, :email, :name, :role) if params[:internal_user].present?
|
||||||
end
|
end
|
||||||
private :internal_user_params
|
private :internal_user_params
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ class InternalUsersController < ApplicationController
|
|||||||
if @user.update(params[:internal_user].permit(:password, :password_confirmation))
|
if @user.update(params[:internal_user].permit(:password, :password_confirmation))
|
||||||
@user.activate!
|
@user.activate!
|
||||||
format.html { redirect_to(sign_in_path, notice: t('.success')) }
|
format.html { redirect_to(sign_in_path, notice: t('.success')) }
|
||||||
format.json { render(nothing: true, status: :ok) }
|
format.json { head :ok }
|
||||||
else
|
else
|
||||||
respond_with_invalid_object(format, object: @user, template: :activate)
|
respond_with_invalid_object(format, object: @user, template: :activate)
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ class InterventionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def intervention_params
|
def intervention_params
|
||||||
params[:intervention].permit(:name)
|
params[:intervention].permit(:name) if params[:intervention].present?
|
||||||
end
|
end
|
||||||
private :intervention_params
|
private :intervention_params
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class ProxyExercisesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def proxy_exercise_params
|
def proxy_exercise_params
|
||||||
params[:proxy_exercise].permit(:description, :title, :exercise_ids => [])
|
params[:proxy_exercise].permit(:description, :title, :exercise_ids => []) if params[:proxy_exercise].present?
|
||||||
end
|
end
|
||||||
private :proxy_exercise_params
|
private :proxy_exercise_params
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class SubmissionsController < ApplicationController
|
|||||||
if @file.native_file?
|
if @file.native_file?
|
||||||
send_file(@file.native_file.path, disposition: 'inline')
|
send_file(@file.native_file.path, disposition: 'inline')
|
||||||
else
|
else
|
||||||
render(text: @file.content)
|
render(plain: @file.content)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ class SubmissionsController < ApplicationController
|
|||||||
# probably add:
|
# probably add:
|
||||||
# ensure
|
# ensure
|
||||||
# #guarantee that the thread is releasing the DB connection after it is done
|
# #guarantee that the thread is releasing the DB connection after it is done
|
||||||
# ActiveRecord::Base.connectionpool.releaseconnection
|
# ApplicationRecord.connectionpool.releaseconnection
|
||||||
# end
|
# end
|
||||||
Thread.new { EventMachine.run } unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?
|
Thread.new { EventMachine.run } unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ class SubmissionsController < ApplicationController
|
|||||||
|
|
||||||
def set_file
|
def set_file
|
||||||
@file = @files.detect { |file| file.name_with_extension == params[:filename] }
|
@file = @files.detect { |file| file.name_with_extension == params[:filename] }
|
||||||
render(nothing: true, status: 404) unless @file
|
head :not_found unless @file
|
||||||
end
|
end
|
||||||
private :set_file
|
private :set_file
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ class SubmissionsController < ApplicationController
|
|||||||
DockerClient.destroy_container(container)
|
DockerClient.destroy_container(container)
|
||||||
rescue Docker::Error::NotFoundError
|
rescue Docker::Error::NotFoundError
|
||||||
ensure
|
ensure
|
||||||
render(nothing: true)
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
def store_error(stderr)
|
def store_error(stderr)
|
||||||
|
@ -56,7 +56,7 @@ class SubscriptionsController < ApplicationController
|
|||||||
def subscription_params
|
def subscription_params
|
||||||
current_user_id = current_user.try(:id)
|
current_user_id = current_user.try(:id)
|
||||||
current_user_class_name = current_user.try(:class).try(:name)
|
current_user_class_name = current_user.try(:class).try(:name)
|
||||||
params[:subscription].permit(:request_for_comment_id, :subscription_type).merge(user_id: current_user_id, user_type: current_user_class_name, deleted: false)
|
params[:subscription].permit(:request_for_comment_id, :subscription_type).merge(user_id: current_user_id, user_type: current_user_class_name, deleted: false) if params[:subscription].present?
|
||||||
end
|
end
|
||||||
private :subscription_params
|
private :subscription_params
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ class TagsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tag_params
|
def tag_params
|
||||||
params[:tag].permit(:name)
|
params[:tag].permit(:name) if params[:tag].present?
|
||||||
end
|
end
|
||||||
private :tag_params
|
private :tag_params
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class UserExerciseFeedbacksController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def uef_params
|
def uef_params
|
||||||
params[:user_exercise_feedback].permit(:feedback_text, :difficulty, :exercise_id, :user_estimated_worktime).merge(user_id: current_user.id, user_type: current_user.class.name)
|
params[:user_exercise_feedback].permit(:feedback_text, :difficulty, :exercise_id, :user_estimated_worktime).merge(user_id: current_user.id, user_type: current_user.class.name) if params[:user_exercise_feedback].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_inputs(uef_params)
|
def validate_inputs(uef_params)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
require 'oauth/request_proxy/action_controller_request'
|
||||||
|
|
||||||
module LtiHelper
|
module LtiHelper
|
||||||
def lti_outcome_service?(exercise_id, external_user_id, consumer_id)
|
def lti_outcome_service?(exercise_id, external_user_id, consumer_id)
|
||||||
return false if external_user_id == '' || consumer_id == ''
|
return false if external_user_id == '' || consumer_id == ''
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class AnomalyNotification < ActiveRecord::Base
|
class AnomalyNotification < ApplicationRecord
|
||||||
belongs_to :user, polymorphic: true
|
belongs_to :user, polymorphic: true
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
belongs_to :exercise_collection
|
belongs_to :exercise_collection
|
||||||
|
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
|
self.abstract_class = true
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
class CodeHarborLink < ActiveRecord::Base
|
class CodeHarborLink < ApplicationRecord
|
||||||
validates :oauth2token, presence: true
|
validates :oauth2token, presence: true
|
||||||
validates :user_id, presence: true
|
validates :user_id, presence: true
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ module CodeOcean
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class File < ActiveRecord::Base
|
class File < ApplicationRecord
|
||||||
include DefaultValues
|
include DefaultValues
|
||||||
|
|
||||||
DEFAULT_WEIGHT = 1.0
|
DEFAULT_WEIGHT = 1.0
|
||||||
@ -28,12 +28,11 @@ module CodeOcean
|
|||||||
before_validation :set_ancestor_values, if: :incomplete_descendent?
|
before_validation :set_ancestor_values, if: :incomplete_descendent?
|
||||||
|
|
||||||
belongs_to :context, polymorphic: true
|
belongs_to :context, polymorphic: true
|
||||||
belongs_to :execution_environment
|
belongs_to :file, class_name: 'CodeOcean::File', optional: true # This is only required for submissions and is validated below
|
||||||
belongs_to :file
|
|
||||||
alias_method :ancestor, :file
|
alias_method :ancestor, :file
|
||||||
belongs_to :file_type
|
belongs_to :file_type
|
||||||
|
|
||||||
has_many :files
|
has_many :files, class_name: 'CodeOcean::File'
|
||||||
has_many :testruns
|
has_many :testruns
|
||||||
has_many :comments
|
has_many :comments
|
||||||
alias_method :descendants, :files
|
alias_method :descendants, :files
|
||||||
@ -59,6 +58,7 @@ module CodeOcean
|
|||||||
validates :role, inclusion: {in: ROLES}
|
validates :role, inclusion: {in: ROLES}
|
||||||
validates :weight, if: :teacher_defined_test?, numericality: true, presence: true
|
validates :weight, if: :teacher_defined_test?, numericality: true, presence: true
|
||||||
validates :weight, absence: true, unless: :teacher_defined_test?
|
validates :weight, absence: true, unless: :teacher_defined_test?
|
||||||
|
validates :file, presence: true if :context.is_a?(Submission)
|
||||||
|
|
||||||
validates_with FileNameValidator, fields: [:name, :path, :file_type_id]
|
validates_with FileNameValidator, fields: [:name, :path, :file_type_id]
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Comment < ActiveRecord::Base
|
class Comment < ApplicationRecord
|
||||||
# inherit the creation module: encapsulates that this is a polymorphic user, offers some aliases and makes sure that all necessary attributes are set.
|
# inherit the creation module: encapsulates that this is a polymorphic user, offers some aliases and makes sure that all necessary attributes are set.
|
||||||
include Creation
|
include Creation
|
||||||
attr_accessor :username, :date, :updated, :editable
|
attr_accessor :username, :date, :updated, :editable
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Consumer < ActiveRecord::Base
|
class Consumer < ApplicationRecord
|
||||||
has_many :users
|
has_many :users
|
||||||
|
|
||||||
scope :with_users, -> { where('id IN (SELECT consumer_id FROM internal_users)') }
|
scope :with_users, -> { where('id IN (SELECT consumer_id FROM internal_users)') }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Error < ActiveRecord::Base
|
class Error < ApplicationRecord
|
||||||
belongs_to :execution_environment
|
belongs_to :execution_environment
|
||||||
|
|
||||||
scope :for_execution_environment, ->(execution_environment) { where(execution_environment_id: execution_environment.id) }
|
scope :for_execution_environment, ->(execution_environment) { where(execution_environment_id: execution_environment.id) }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class ErrorTemplate < ActiveRecord::Base
|
class ErrorTemplate < ApplicationRecord
|
||||||
belongs_to :execution_environment
|
belongs_to :execution_environment
|
||||||
has_and_belongs_to_many :error_template_attributes
|
has_and_belongs_to_many :error_template_attributes
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class ErrorTemplateAttribute < ActiveRecord::Base
|
class ErrorTemplateAttribute < ApplicationRecord
|
||||||
has_and_belongs_to_many :error_template
|
has_and_belongs_to_many :error_template
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
class Event < ActiveRecord::Base
|
class Event < ApplicationRecord
|
||||||
belongs_to :user, polymorphic: true
|
belongs_to :user, polymorphic: true
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
belongs_to :file
|
belongs_to :file, class_name: 'CodeOcean::File'
|
||||||
|
|
||||||
validates :category, presence: true
|
validates :category, presence: true
|
||||||
validates :data, presence: true
|
validates :data, presence: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require File.expand_path('../../../lib/active_model/validations/boolean_presence_validator', __FILE__)
|
require File.expand_path('../../../lib/active_model/validations/boolean_presence_validator', __FILE__)
|
||||||
|
|
||||||
class ExecutionEnvironment < ActiveRecord::Base
|
class ExecutionEnvironment < ApplicationRecord
|
||||||
include Creation
|
include Creation
|
||||||
include DefaultValues
|
include DefaultValues
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require File.expand_path('../../../lib/active_model/validations/boolean_presence_validator', __FILE__)
|
require File.expand_path('../../../lib/active_model/validations/boolean_presence_validator', __FILE__)
|
||||||
|
|
||||||
class Exercise < ActiveRecord::Base
|
class Exercise < ApplicationRecord
|
||||||
include Context
|
include Context
|
||||||
include Creation
|
include Creation
|
||||||
include DefaultValues
|
include DefaultValues
|
||||||
@ -23,8 +23,8 @@ class Exercise < ActiveRecord::Base
|
|||||||
accepts_nested_attributes_for :exercise_tags
|
accepts_nested_attributes_for :exercise_tags
|
||||||
has_many :user_exercise_feedbacks
|
has_many :user_exercise_feedbacks
|
||||||
|
|
||||||
has_many :external_users, source: :user, source_type: ExternalUser, through: :submissions
|
has_many :external_users, source: :user, source_type: 'ExternalUser', through: :submissions
|
||||||
has_many :internal_users, source: :user, source_type: InternalUser, through: :submissions
|
has_many :internal_users, source: :user, source_type: 'InternalUser', through: :submissions
|
||||||
alias_method :users, :external_users
|
alias_method :users, :external_users
|
||||||
|
|
||||||
scope :with_submissions, -> { where('id IN (SELECT exercise_id FROM submissions)') }
|
scope :with_submissions, -> { where('id IN (SELECT exercise_id FROM submissions)') }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class ExerciseCollection < ActiveRecord::Base
|
class ExerciseCollection < ApplicationRecord
|
||||||
include TimeHelper
|
include TimeHelper
|
||||||
|
|
||||||
has_many :exercise_collection_items, dependent: :delete_all
|
has_many :exercise_collection_items, dependent: :delete_all
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class ExerciseCollectionItem < ActiveRecord::Base
|
class ExerciseCollectionItem < ApplicationRecord
|
||||||
belongs_to :exercise_collection
|
belongs_to :exercise_collection
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class ExerciseTag < ActiveRecord::Base
|
class ExerciseTag < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :tag
|
belongs_to :tag
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class ExternalUser < ActiveRecord::Base
|
class ExternalUser < ApplicationRecord
|
||||||
include User
|
include User
|
||||||
|
|
||||||
validates :consumer_id, presence: true
|
validates :consumer_id, presence: true
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class FileTemplate < ActiveRecord::Base
|
class FileTemplate < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :file_type
|
belongs_to :file_type
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require File.expand_path('../../../lib/active_model/validations/boolean_presence_validator', __FILE__)
|
require File.expand_path('../../../lib/active_model/validations/boolean_presence_validator', __FILE__)
|
||||||
|
|
||||||
class FileType < ActiveRecord::Base
|
class FileType < ApplicationRecord
|
||||||
include Creation
|
include Creation
|
||||||
include DefaultValues
|
include DefaultValues
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ class FileType < ActiveRecord::Base
|
|||||||
after_initialize :set_default_values
|
after_initialize :set_default_values
|
||||||
|
|
||||||
has_many :execution_environments
|
has_many :execution_environments
|
||||||
has_many :files
|
has_many :files, class_name: 'CodeOcean::File'
|
||||||
has_many :file_templates
|
has_many :file_templates
|
||||||
|
|
||||||
validates :binary, boolean_presence: true
|
validates :binary, boolean_presence: true
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Hint < ActiveRecord::Base
|
class Hint < ApplicationRecord
|
||||||
belongs_to :execution_environment
|
belongs_to :execution_environment
|
||||||
|
|
||||||
validates :execution_environment_id, presence: true
|
validates :execution_environment_id, presence: true
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class InternalUser < ActiveRecord::Base
|
class InternalUser < ApplicationRecord
|
||||||
include User
|
include User
|
||||||
|
|
||||||
authenticates_with_sorcery!
|
authenticates_with_sorcery!
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
class Intervention < ActiveRecord::Base
|
class Intervention < ApplicationRecord
|
||||||
|
|
||||||
has_many :user_exercise_interventions
|
has_many :user_exercise_interventions
|
||||||
has_many :users, through: :user_exercise_interventions, source_type: "ExternalUser"
|
has_many :users, through: :user_exercise_interventions, source_type: 'ExternalUser'
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
name
|
name
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class LtiParameter < ActiveRecord::Base
|
class LtiParameter < ApplicationRecord
|
||||||
belongs_to :consumer, foreign_key: "consumers_id"
|
belongs_to :consumer, foreign_key: "consumers_id"
|
||||||
belongs_to :exercise, foreign_key: "exercises_id"
|
belongs_to :exercise, foreign_key: "exercises_id"
|
||||||
belongs_to :external_user, foreign_key: "external_users_id"
|
belongs_to :external_user, foreign_key: "external_users_id"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class ProxyExercise < ActiveRecord::Base
|
class ProxyExercise < ApplicationRecord
|
||||||
|
|
||||||
after_initialize :generate_token
|
after_initialize :generate_token
|
||||||
after_initialize :set_reason
|
after_initialize :set_reason
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# todo: reference to lti_param_model
|
# todo: reference to lti_param_model
|
||||||
class RemoteEvaluationMapping < ActiveRecord::Base
|
class RemoteEvaluationMapping < ApplicationRecord
|
||||||
before_create :generate_token, unless: :validation_token?
|
before_create :generate_token, unless: :validation_token?
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class RequestForComment < ActiveRecord::Base
|
class RequestForComment < ApplicationRecord
|
||||||
include Creation
|
include Creation
|
||||||
belongs_to :submission
|
belongs_to :submission
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Search < ActiveRecord::Base
|
class Search < ApplicationRecord
|
||||||
belongs_to :user, polymorphic: true
|
belongs_to :user, polymorphic: true
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
end
|
end
|
@ -1,7 +1,6 @@
|
|||||||
class StructuredError < ActiveRecord::Base
|
class StructuredError < ApplicationRecord
|
||||||
belongs_to :error_template
|
belongs_to :error_template
|
||||||
belongs_to :submission
|
belongs_to :submission
|
||||||
belongs_to :file, class_name: 'CodeOcean::File'
|
|
||||||
|
|
||||||
has_many :structured_error_attributes
|
has_many :structured_error_attributes
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class StructuredErrorAttribute < ActiveRecord::Base
|
class StructuredErrorAttribute < ApplicationRecord
|
||||||
belongs_to :structured_error
|
belongs_to :structured_error
|
||||||
belongs_to :error_template_attribute
|
belongs_to :error_template_attribute
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Submission < ActiveRecord::Base
|
class Submission < ApplicationRecord
|
||||||
include Context
|
include Context
|
||||||
include Creation
|
include Creation
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Subscription < ActiveRecord::Base
|
class Subscription < ApplicationRecord
|
||||||
belongs_to :user, polymorphic: true
|
belongs_to :user, polymorphic: true
|
||||||
belongs_to :request_for_comment
|
belongs_to :request_for_comment
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Tag < ActiveRecord::Base
|
class Tag < ApplicationRecord
|
||||||
|
|
||||||
has_many :exercise_tags
|
has_many :exercise_tags
|
||||||
has_many :exercises, through: :exercise_tags
|
has_many :exercises, through: :exercise_tags
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Testrun < ActiveRecord::Base
|
class Testrun < ApplicationRecord
|
||||||
belongs_to :file, class_name: 'CodeOcean::File'
|
belongs_to :file, class_name: 'CodeOcean::File'
|
||||||
belongs_to :submission
|
belongs_to :submission
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class UserExerciseFeedback < ActiveRecord::Base
|
class UserExerciseFeedback < ApplicationRecord
|
||||||
include Creation
|
include Creation
|
||||||
|
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class UserExerciseIntervention < ActiveRecord::Base
|
class UserExerciseIntervention < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :user, polymorphic: true
|
belongs_to :user, polymorphic: true
|
||||||
belongs_to :intervention
|
belongs_to :intervention
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class UserProxyExerciseExercise < ActiveRecord::Base
|
class UserProxyExerciseExercise < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :user, polymorphic: true
|
belongs_to :user, polymorphic: true
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
- content_for :head do
|
|
||||||
= javascript_include_tag(asset_path('vis.min.js', type: :javascript))
|
|
||||||
= stylesheet_link_tag(asset_path('vis.min.css', type: :stylesheet))
|
|
||||||
|
|
||||||
h1 = t('breadcrumbs.dashboard.show')
|
h1 = t('breadcrumbs.dashboard.show')
|
||||||
|
|
||||||
h2 Version
|
h2 Version
|
||||||
|
@ -4,4 +4,4 @@ li.dropdown
|
|||||||
span.caret
|
span.caret
|
||||||
ul.dropdown-menu role='menu'
|
ul.dropdown-menu role='menu'
|
||||||
- I18n.available_locales.sort_by { |locale| t("locales.#{locale}") }.each do |locale|
|
- I18n.available_locales.sort_by { |locale| t("locales.#{locale}") }.each do |locale|
|
||||||
li = link_to(t("locales.#{locale}"), url_for(params.merge(locale: locale)))
|
li = link_to(t("locales.#{locale}"), url_for(params.permit!.merge(locale: locale)))
|
||||||
|
@ -5,12 +5,8 @@ html lang='en'
|
|||||||
meta name='viewport' content='width=device-width, initial-scale=1'
|
meta name='viewport' content='width=device-width, initial-scale=1'
|
||||||
title = application_name
|
title = application_name
|
||||||
link href=asset_path('favicon.png') rel='icon' type='image/png'
|
link href=asset_path('favicon.png') rel='icon' type='image/png'
|
||||||
= stylesheet_link_tag(asset_path('bootstrap.min.css', type: :stylesheet))
|
|
||||||
= stylesheet_link_tag(asset_path('font-awesome.min.css', type: :stylesheet))
|
|
||||||
= stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track' => true)
|
= stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track' => true)
|
||||||
= javascript_include_tag('application', 'data-turbolinks-track' => true)
|
= javascript_include_tag('application', 'data-turbolinks-track' => true)
|
||||||
= javascript_include_tag(asset_path('underscore-min.js', type: :javascript))
|
|
||||||
= javascript_include_tag(asset_path('bootstrap.min.js', type: :javascript))
|
|
||||||
= yield(:head)
|
= yield(:head)
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
body
|
body
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
- content_for :head do
|
|
||||||
= javascript_include_tag(asset_path('vis.min.js', type: :javascript))
|
|
||||||
= stylesheet_link_tag(asset_path('vis.min.css', type: :stylesheet))
|
|
||||||
|
|
||||||
.group
|
.group
|
||||||
.title
|
.title
|
||||||
h1 = t("statistics.graphs.#{resource}_activity")
|
h1 = t("statistics.graphs.#{resource}_activity")
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
- content_for :head do
|
|
||||||
= javascript_include_tag(asset_path('vis.min.js', type: :javascript))
|
|
||||||
= stylesheet_link_tag(asset_path('vis.min.css', type: :stylesheet))
|
|
||||||
|
|
||||||
.group
|
.group
|
||||||
.title
|
.title
|
||||||
h1 = t('.user_activity')
|
h1 = t('.user_activity')
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||||
load Gem.bin_path('bundler', 'bundle')
|
load Gem.bin_path('bundler', 'bundle')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rails/commands'
|
require 'rails/commands'
|
||||||
|
33
bin/setup
33
bin/setup
@ -1,29 +1,36 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require 'pathname'
|
require 'fileutils'
|
||||||
|
include FileUtils
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
|
|
||||||
Dir.chdir APP_ROOT do
|
def system!(*args)
|
||||||
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
|
end
|
||||||
|
|
||||||
|
chdir APP_ROOT do
|
||||||
# This script is a starting point to setup your application.
|
# This script is a starting point to setup your application.
|
||||||
# Add necessary setup steps to this file:
|
# Add necessary setup steps to this file.
|
||||||
|
|
||||||
puts "== Installing dependencies =="
|
puts '== Installing dependencies =='
|
||||||
system "gem install bundler --conservative"
|
system! 'gem install bundler --conservative'
|
||||||
system "bundle check || bundle install"
|
system('bundle check') || system!('bundle install')
|
||||||
|
|
||||||
|
# Install JavaScript dependencies if using Yarn
|
||||||
|
# system('bin/yarn')
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
# puts "\n== Copying sample files =="
|
||||||
# unless File.exist?("config/database.yml")
|
# unless File.exist?('config/database.yml')
|
||||||
# system "cp config/database.yml.sample config/database.yml"
|
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||||
# end
|
# end
|
||||||
|
|
||||||
puts "\n== Preparing database =="
|
puts "\n== Preparing database =="
|
||||||
system "bin/rake db:setup"
|
system! 'bin/rails db:setup'
|
||||||
|
|
||||||
puts "\n== Removing old logs and tempfiles =="
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
system "rm -f log/*"
|
system! 'bin/rails log:clear tmp:clear'
|
||||||
system "rm -rf tmp/cache"
|
|
||||||
|
|
||||||
puts "\n== Restarting application server =="
|
puts "\n== Restarting application server =="
|
||||||
system "touch tmp/restart.txt"
|
system! 'bin/rails restart'
|
||||||
end
|
end
|
||||||
|
31
bin/update
Executable file
31
bin/update
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require 'fileutils'
|
||||||
|
include FileUtils
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
|
|
||||||
|
def system!(*args)
|
||||||
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
|
end
|
||||||
|
|
||||||
|
chdir APP_ROOT do
|
||||||
|
# This script is a way to update your development environment automatically.
|
||||||
|
# Add necessary update steps to this file.
|
||||||
|
|
||||||
|
puts '== Installing dependencies =='
|
||||||
|
system! 'gem install bundler --conservative'
|
||||||
|
system('bundle check') || system!('bundle install')
|
||||||
|
|
||||||
|
# Install JavaScript dependencies if using Yarn
|
||||||
|
# system('bin/yarn')
|
||||||
|
|
||||||
|
puts "\n== Updating database =="
|
||||||
|
system! 'bin/rails db:migrate'
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system! 'bin/rails log:clear tmp:clear'
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system! 'bin/rails restart'
|
||||||
|
end
|
11
bin/yarn
Executable file
11
bin/yarn
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
|
Dir.chdir(APP_ROOT) do
|
||||||
|
begin
|
||||||
|
exec "yarnpkg", *ARGV
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
$stderr.puts "Yarn executable was not detected in the system."
|
||||||
|
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
require File.expand_path('../boot', __FILE__)
|
require_relative 'boot'
|
||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
|
|
||||||
@ -8,9 +8,13 @@ Bundler.require(*Rails.groups)
|
|||||||
|
|
||||||
module CodeOcean
|
module CodeOcean
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
|
config.load_defaults 5.0
|
||||||
|
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration can go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded after loading
|
||||||
|
# the framework and any gems in your application.
|
||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
@ -21,23 +25,8 @@ module CodeOcean
|
|||||||
# config.i18n.default_locale = :de
|
# config.i18n.default_locale = :de
|
||||||
config.i18n.available_locales = [:de, :en]
|
config.i18n.available_locales = [:de, :en]
|
||||||
|
|
||||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
|
||||||
config.active_record.raise_in_transactional_callbacks = true
|
|
||||||
|
|
||||||
config.autoload_paths << Rails.root.join('lib')
|
config.autoload_paths << Rails.root.join('lib')
|
||||||
config.eager_load_paths << Rails.root.join('lib')
|
config.eager_load_paths << Rails.root.join('lib')
|
||||||
config.assets.precompile += %w( markdown-buttons.png )
|
config.assets.precompile += %w( markdown-buttons.png )
|
||||||
|
|
||||||
#config.active_record.schema_format = :sql
|
|
||||||
|
|
||||||
case (RUBY_ENGINE)
|
|
||||||
when 'ruby'
|
|
||||||
# ...
|
|
||||||
#this is enabled in prod for testing
|
|
||||||
config.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement
|
|
||||||
when 'jruby'
|
|
||||||
# plattform specific
|
|
||||||
java.lang.Class.for_name('javax.crypto.JceSecurity').get_declared_field('isRestricted').tap{|f| f.accessible = true; f.set nil, false}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||||
|
|
||||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||||
|
# require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
|
||||||
|
10
config/cable.yml
Normal file
10
config/cable.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
development:
|
||||||
|
adapter: async
|
||||||
|
|
||||||
|
test:
|
||||||
|
adapter: async
|
||||||
|
|
||||||
|
production:
|
||||||
|
adapter: redis
|
||||||
|
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||||
|
channel_prefix: code_ocean_production
|
@ -6,7 +6,7 @@ default: &default
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
flowr:
|
flowr:
|
||||||
enabled: true
|
enabled: false
|
||||||
url: http://example.org:3000/api/exceptioninfo?id=&lang=auto
|
url: http://example.org:3000/api/exceptioninfo?id=&lang=auto
|
||||||
code_pilot:
|
code_pilot:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# Load the Rails application.
|
# Load the Rails application.
|
||||||
require File.expand_path('../application', __FILE__)
|
require_relative 'application'
|
||||||
|
|
||||||
|
# LTI 1.x uses OAuth 1.0
|
||||||
|
OAUTH_10_SUPPORT = true
|
||||||
|
|
||||||
# Initialize the Rails application.
|
# Initialize the Rails application.
|
||||||
Rails.application.initialize!
|
Rails.application.initialize!
|
||||||
|
@ -11,21 +11,41 @@ Rails.application.configure do
|
|||||||
# Do not eager load code on boot.
|
# Do not eager load code on boot.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
|
||||||
|
# Enable/disable caching. By default caching is disabled.
|
||||||
config.action_mailer.perform_deliveries = false
|
# Run rails dev:cache to toggle caching.
|
||||||
|
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
|
config.cache_store = :memory_store
|
||||||
|
config.public_file_server.headers = {
|
||||||
|
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
config.cache_store = :null_store
|
||||||
|
end
|
||||||
|
|
||||||
|
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||||
|
config.active_storage.service = :local
|
||||||
|
|
||||||
# Don't care if the mailer can't send.
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger.
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
# Raise an error on page load if there are pending migrations.
|
# Raise an error on page load if there are pending migrations.
|
||||||
config.active_record.migration_error = :page_load
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
|
# Highlight code that triggered database queries in logs.
|
||||||
|
config.active_record.verbose_query_logs = true
|
||||||
|
|
||||||
# Debug mode disables concatenation and preprocessing of assets.
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
# This option may cause significant delays in view rendering with a large
|
# This option may cause significant delays in view rendering with a large
|
||||||
# number of complex assets.
|
# number of complex assets.
|
||||||
@ -48,6 +68,7 @@ Rails.application.configure do
|
|||||||
|
|
||||||
BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP']
|
BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP']
|
||||||
|
|
||||||
# Delete middleware in order to allow concurrent requests.
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||||
config.middleware.delete(Rack::Lock)
|
# routes, locales, etc. This feature depends on the listen gem.
|
||||||
|
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||||
end
|
end
|
||||||
|
@ -14,15 +14,13 @@ Rails.application.configure do
|
|||||||
config.consider_all_requests_local = false
|
config.consider_all_requests_local = false
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
||||||
# Add `rack-cache` to your Gemfile before enabling this.
|
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
||||||
# For large-scale production use, consider using a caching reverse proxy like
|
# config.require_master_key = true
|
||||||
# NGINX, varnish or squid.
|
|
||||||
# config.action_dispatch.rack_cache = true
|
|
||||||
|
|
||||||
# Disable serving static files from the `/public` folder by default since
|
# Disable serving static files from the `/public` folder by default since
|
||||||
# Apache or NGINX already handles this.
|
# Apache or NGINX already handles this.
|
||||||
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||||
|
|
||||||
# Compress JavaScripts and CSS.
|
# Compress JavaScripts and CSS.
|
||||||
config.assets.js_compressor = :uglifier
|
config.assets.js_compressor = :uglifier
|
||||||
@ -37,10 +35,21 @@ Rails.application.configure do
|
|||||||
|
|
||||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
|
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files.
|
# Specifies the header that your server uses for sending files.
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||||
|
|
||||||
|
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||||
|
config.active_storage.service = :local
|
||||||
|
|
||||||
|
# Mount Action Cable outside main process or domain
|
||||||
|
# config.action_cable.mount_path = nil
|
||||||
|
# config.action_cable.url = 'wss://example.com/cable'
|
||||||
|
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
# config.force_ssl = true
|
# config.force_ssl = true
|
||||||
|
|
||||||
@ -49,16 +58,16 @@ Rails.application.configure do
|
|||||||
config.log_level = :error
|
config.log_level = :error
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
# Prepend all log lines with the following tags.
|
||||||
# config.log_tags = [ :subdomain, :uuid ]
|
# config.log_tags = [ :subdomain, :uuid, :request_id ]
|
||||||
|
|
||||||
# Use a different logger for distributed setups.
|
|
||||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
||||||
|
|
||||||
# Use a different cache store in production.
|
# Use a different cache store in production.
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
# config.active_job.queue_adapter = :resque
|
||||||
|
# config.active_job.queue_name_prefix = "code_ocean_#{Rails.env}"
|
||||||
|
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
# Ignore bad email addresses and do not raise email delivery errors.
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
@ -74,6 +83,16 @@ Rails.application.configure do
|
|||||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
config.log_formatter = ::Logger::Formatter.new
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups.
|
||||||
|
# require 'syslog/logger'
|
||||||
|
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||||
|
|
||||||
|
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||||
|
logger = ActiveSupport::Logger.new(STDOUT)
|
||||||
|
logger.formatter = config.log_formatter
|
||||||
|
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||||
|
end
|
||||||
|
|
||||||
# Do not dump schema after migrations.
|
# Do not dump schema after migrations.
|
||||||
config.active_record.dump_schema_after_migration = false
|
config.active_record.dump_schema_after_migration = false
|
||||||
end
|
end
|
||||||
|
@ -12,9 +12,11 @@ Rails.application.configure do
|
|||||||
# preloads Rails for running tests, you may have to set it to true.
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
# Configure static file server for tests with Cache-Control for performance.
|
# Configure public file server for tests with Cache-Control for performance.
|
||||||
config.serve_static_files = true
|
config.public_file_server.enabled = true
|
||||||
config.static_cache_control = 'public, max-age=3600'
|
config.public_file_server.headers = {
|
||||||
|
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
||||||
|
}
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports and disable caching.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
@ -26,6 +28,11 @@ Rails.application.configure do
|
|||||||
# Disable request forgery protection in test environment.
|
# Disable request forgery protection in test environment.
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
# Store uploaded files on the local file system in a temporary directory
|
||||||
|
config.active_storage.service = :test
|
||||||
|
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
# Tell Action Mailer not to deliver emails to the real world.
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
|
8
config/initializers/application_controller_renderer.rb
Normal file
8
config/initializers/application_controller_renderer.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# ActiveSupport::Reloader.to_prepare do
|
||||||
|
# ApplicationController.renderer.defaults.merge!(
|
||||||
|
# http_host: 'example.org',
|
||||||
|
# https: false
|
||||||
|
# )
|
||||||
|
# end
|
@ -1,12 +1,17 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Version of your assets, change this if you want to expire all your assets.
|
Rails.application.config.tap do |config|
|
||||||
Rails.application.config.assets.version = '1.0'
|
|
||||||
|
|
||||||
# Add additional assets to the asset load path
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
# Rails.application.config.assets.paths << Emoji.images_path
|
config.assets.version = '1.0'
|
||||||
|
|
||||||
# Precompile additional assets.
|
# Add additional assets to the asset load path.
|
||||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
# config.assets.paths << Emoji.images_path
|
||||||
# Rails.application.config.assets.precompile += %w( search.js )
|
# Add Yarn node_modules folder to the asset load path.
|
||||||
Rails.application.config.assets.precompile += %w( markdown-buttons.png )
|
# config.assets.paths << Rails.root.join('node_modules')
|
||||||
|
|
||||||
|
# Precompile additional assets.
|
||||||
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||||
|
# folder are already added.
|
||||||
|
# config.assets.precompile += %w( admin.js admin.css )
|
||||||
|
end
|
||||||
|
25
config/initializers/content_security_policy.rb
Normal file
25
config/initializers/content_security_policy.rb
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Define an application-wide content security policy
|
||||||
|
# For further information see the following documentation
|
||||||
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
||||||
|
|
||||||
|
# Rails.application.config.content_security_policy do |policy|
|
||||||
|
# policy.default_src :self, :https
|
||||||
|
# policy.font_src :self, :https, :data
|
||||||
|
# policy.img_src :self, :https, :data
|
||||||
|
# policy.object_src :none
|
||||||
|
# policy.script_src :self, :https
|
||||||
|
# policy.style_src :self, :https
|
||||||
|
|
||||||
|
# # Specify URI for violation reports
|
||||||
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||||
|
# end
|
||||||
|
|
||||||
|
# If you are using UJS then enable automatic nonce generation
|
||||||
|
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
||||||
|
|
||||||
|
# Report CSP violations to a specified URI
|
||||||
|
# For further information see the following documentation:
|
||||||
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
||||||
|
# Rails.application.config.content_security_policy_report_only = true
|
@ -1,3 +1,5 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Specify a serializer for the signed and encrypted cookie jars.
|
||||||
|
# Valid options are :json, :marshal, and :hybrid.
|
||||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
DockerClient.initialize_environment unless Rails.env.test? && `which docker`.blank?
|
DockerClient.initialize_environment unless Rails.env.test? && `which docker`.blank?
|
||||||
|
|
||||||
if ActiveRecord::Base.connection.tables.present? && DockerContainerPool.config[:active]
|
if ApplicationRecord.connection.tables.present? && DockerContainerPool.config[:active]
|
||||||
DockerContainerPool.start_refill_task
|
DockerContainerPool.start_refill_task
|
||||||
at_exit { DockerContainerPool.clean_up }
|
at_exit { DockerContainerPool.clean_up }
|
||||||
end
|
end
|
||||||
|
20
config/initializers/new_framework_defaults.rb
Normal file
20
config/initializers/new_framework_defaults.rb
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file contains migration options to ease your Rails 5.0 upgrade.
|
||||||
|
#
|
||||||
|
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||||
|
#
|
||||||
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
|
|
||||||
|
# Enable per-form CSRF tokens. Previous versions had false.
|
||||||
|
Rails.application.config.action_controller.per_form_csrf_tokens = false
|
||||||
|
|
||||||
|
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
||||||
|
Rails.application.config.action_controller.forgery_protection_origin_check = false
|
||||||
|
|
||||||
|
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
||||||
|
# Previous versions had false.
|
||||||
|
ActiveSupport.to_time_preserves_timezone = false
|
||||||
|
|
||||||
|
# Require `belongs_to` associations by default. Previous versions had false.
|
||||||
|
Rails.application.config.active_record.belongs_to_required_by_default = false
|
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file contains migration options to ease your Rails 5.1 upgrade.
|
||||||
|
#
|
||||||
|
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||||
|
#
|
||||||
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
|
|
||||||
|
# Make `form_with` generate non-remote forms.
|
||||||
|
Rails.application.config.action_view.form_with_generates_remote_forms = false
|
||||||
|
|
||||||
|
# Unknown asset fallback will return the path passed in when the given
|
||||||
|
# asset is not present in the asset pipeline.
|
||||||
|
# Rails.application.config.assets.unknown_asset_fallback = false
|
38
config/initializers/new_framework_defaults_5_2.rb
Normal file
38
config/initializers/new_framework_defaults_5_2.rb
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file contains migration options to ease your Rails 5.2 upgrade.
|
||||||
|
#
|
||||||
|
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||||
|
#
|
||||||
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
|
|
||||||
|
# Make Active Record use stable #cache_key alongside new #cache_version method.
|
||||||
|
# This is needed for recyclable cache keys.
|
||||||
|
# Rails.application.config.active_record.cache_versioning = true
|
||||||
|
|
||||||
|
# Use AES-256-GCM authenticated encryption for encrypted cookies.
|
||||||
|
# Also, embed cookie expiry in signed or encrypted cookies for increased security.
|
||||||
|
#
|
||||||
|
# This option is not backwards compatible with earlier Rails versions.
|
||||||
|
# It's best enabled when your entire app is migrated and stable on 5.2.
|
||||||
|
#
|
||||||
|
# Existing cookies will be converted on read then written with the new scheme.
|
||||||
|
# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true
|
||||||
|
|
||||||
|
# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages
|
||||||
|
# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true.
|
||||||
|
# Rails.application.config.active_support.use_authenticated_message_encryption = true
|
||||||
|
|
||||||
|
# Add default protection from forgery to ActionController::Base instead of in
|
||||||
|
# ApplicationController.
|
||||||
|
# Rails.application.config.action_controller.default_protect_from_forgery = true
|
||||||
|
|
||||||
|
# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and
|
||||||
|
# 'f' after migrating old data.
|
||||||
|
# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
|
||||||
|
|
||||||
|
# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header.
|
||||||
|
# Rails.application.config.active_support.use_sha1_digests = true
|
||||||
|
|
||||||
|
# Make `form_with` generate id attributes for any generated HTML tags.
|
||||||
|
# Rails.application.config.action_view.form_with_generates_ids = true
|
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
ActiveSupport.on_load(:action_controller) do
|
ActiveSupport.on_load(:action_controller) do
|
||||||
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
wrap_parameters format: [:json]
|
||||||
end
|
end
|
||||||
|
|
||||||
# To enable root element in JSON for ActiveRecord objects.
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
# ActiveSupport.on_load(:active_record) do
|
# ActiveSupport.on_load(:active_record) do
|
||||||
# self.include_root_in_json = true
|
# self.include_root_in_json = true
|
||||||
# end
|
# end
|
||||||
|
34
config/puma.rb
Normal file
34
config/puma.rb
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Puma can serve each request in a thread from an internal thread pool.
|
||||||
|
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||||
|
# Any libraries that use thread pools should be configured to match
|
||||||
|
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||||
|
# and maximum; this matches the default thread size of Active Record.
|
||||||
|
#
|
||||||
|
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
||||||
|
threads threads_count, threads_count
|
||||||
|
|
||||||
|
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||||
|
#
|
||||||
|
port ENV.fetch("PORT") { 3000 }
|
||||||
|
|
||||||
|
# Specifies the `environment` that Puma will run in.
|
||||||
|
#
|
||||||
|
environment ENV.fetch("RAILS_ENV") { "development" }
|
||||||
|
|
||||||
|
# Specifies the number of `workers` to boot in clustered mode.
|
||||||
|
# Workers are forked webserver processes. If using threads and workers together
|
||||||
|
# the concurrency of the application would be max `threads` * `workers`.
|
||||||
|
# Workers do not work on JRuby or Windows (both of which do not support
|
||||||
|
# processes).
|
||||||
|
#
|
||||||
|
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||||
|
|
||||||
|
# Use the `preload_app!` method when specifying a `workers` number.
|
||||||
|
# This directive tells Puma to first boot the application and load code
|
||||||
|
# before forking the application. This takes advantage of Copy On Write
|
||||||
|
# process behavior so workers use less memory.
|
||||||
|
#
|
||||||
|
# preload_app!
|
||||||
|
|
||||||
|
# Allow puma to be restarted by `rails restart` command.
|
||||||
|
plugin :tmp_restart
|
@ -5,18 +5,28 @@
|
|||||||
|
|
||||||
# Make sure the secret is at least 30 characters and all random,
|
# Make sure the secret is at least 30 characters and all random,
|
||||||
# no regular words or you'll be exposed to dictionary attacks.
|
# no regular words or you'll be exposed to dictionary attacks.
|
||||||
# You can use `rake secret` to generate a secure secret key.
|
# You can use `rails secret` to generate a secure secret key.
|
||||||
|
|
||||||
# Make sure the secrets in this file are kept private
|
# Make sure the secrets in this file are kept private
|
||||||
# if you're sharing your code publicly.
|
# if you're sharing your code publicly.
|
||||||
|
|
||||||
|
# Shared secrets are available across all environments.
|
||||||
|
|
||||||
|
# shared:
|
||||||
|
# api_key: a1B2c3D4e5F6
|
||||||
|
|
||||||
|
# Environmental secrets are only available for that specific environment.
|
||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: CHANGE_ME
|
secret_key_base: CHANGE_ME
|
||||||
|
|
||||||
test:
|
test:
|
||||||
secret_key_base: CHANGE_ME
|
secret_key_base: CHANGE_ME
|
||||||
|
|
||||||
# Do not keep production secrets in the repository,
|
# Do not keep production secrets in the unencrypted secrets file.
|
||||||
# instead read values from the environment.
|
# Instead, either read values from the environment.
|
||||||
|
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
|
||||||
|
# and move the `production:` environment over there.
|
||||||
|
|
||||||
production:
|
production:
|
||||||
secret_key_base: CHANGE_ME
|
secret_key_base: CHANGE_ME
|
||||||
|
6
config/spring.rb
Normal file
6
config/spring.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
%w(
|
||||||
|
.ruby-version
|
||||||
|
.rbenv-vars
|
||||||
|
tmp/restart.txt
|
||||||
|
tmp/caching-dev.txt
|
||||||
|
).each { |path| Spring.watch(path) }
|
34
config/storage.yml
Normal file
34
config/storage.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
test:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("tmp/storage") %>
|
||||||
|
|
||||||
|
local:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("storage") %>
|
||||||
|
|
||||||
|
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
||||||
|
# amazon:
|
||||||
|
# service: S3
|
||||||
|
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
||||||
|
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
||||||
|
# region: us-east-1
|
||||||
|
# bucket: your_own_bucket
|
||||||
|
|
||||||
|
# Remember not to checkin your GCS keyfile to a repository
|
||||||
|
# google:
|
||||||
|
# service: GCS
|
||||||
|
# project: your_project
|
||||||
|
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
||||||
|
# bucket: your_own_bucket
|
||||||
|
|
||||||
|
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
||||||
|
# microsoft:
|
||||||
|
# service: AzureStorage
|
||||||
|
# storage_account_name: your_account_name
|
||||||
|
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
||||||
|
# container: your_container_name
|
||||||
|
|
||||||
|
# mirror:
|
||||||
|
# service: Mirror
|
||||||
|
# primary: local
|
||||||
|
# mirrors: [ amazon, google, microsoft ]
|
@ -4,7 +4,7 @@ class CreateLtiParameters < ActiveRecord::Migration
|
|||||||
t.belongs_to :external_users
|
t.belongs_to :external_users
|
||||||
t.belongs_to :consumers
|
t.belongs_to :consumers
|
||||||
t.belongs_to :exercises
|
t.belongs_to :exercises
|
||||||
t.jsonb :lti_parameters, null: false, default: '{}'
|
t.jsonb :lti_parameters, null: false, default: {}
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -18,7 +18,7 @@ end
|
|||||||
|
|
||||||
# delete all present records
|
# delete all present records
|
||||||
Rails.application.eager_load!
|
Rails.application.eager_load!
|
||||||
(ActiveRecord::Base.descendants - [ActiveRecord::SchemaMigration]).each(&:delete_all)
|
(ApplicationRecord.descendants - [ActiveRecord::SchemaMigration]).each(&:delete_all)
|
||||||
|
|
||||||
# delete file uploads
|
# delete file uploads
|
||||||
FileUtils.rm_rf(Rails.root.join('public', 'uploads'))
|
FileUtils.rm_rf(Rails.root.join('public', 'uploads'))
|
||||||
|
@ -272,7 +272,7 @@ class DockerClient
|
|||||||
end
|
end
|
||||||
#ensure
|
#ensure
|
||||||
# guarantee that the thread is releasing the DB connection after it is done
|
# guarantee that the thread is releasing the DB connection after it is done
|
||||||
# ActiveRecord::Base.connectionpool.releaseconnection
|
# ApplicationRecord.connectionpool.releaseconnection
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
######## VERSION INFORMATION ########
|
######## VERSION INFORMATION ########
|
||||||
|
|
||||||
postgres_version=10
|
postgres_version=10
|
||||||
ruby_version=2.3.6
|
ruby_version=2.5.1
|
||||||
rails_version=4.2.10
|
rails_version=5.2.1
|
||||||
|
|
||||||
########## INSTALL SCRIPT ###########
|
########## INSTALL SCRIPT ###########
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ describe Lti do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#store_lti_session_data' do
|
describe '#store_lti_session_data' do
|
||||||
let(:parameters) { {} }
|
let(:parameters) { ActionController::Parameters.new({}) }
|
||||||
|
|
||||||
it 'stores data in the session' do
|
it 'stores data in the session' do
|
||||||
controller.instance_variable_set(:@current_user, FactoryBot.create(:external_user))
|
controller.instance_variable_set(:@current_user, FactoryBot.create(:external_user))
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user