updated to Rails 4.2

This commit is contained in:
Hauke Klement
2015-02-18 10:41:26 +01:00
parent fcc5a85a76
commit 56acd4c3c3
16 changed files with 199 additions and 132 deletions

View File

@@ -1,13 +1,6 @@
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@@ -28,6 +21,9 @@ module CodeOcean
# config.i18n.default_locale = :de
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.eager_load_paths << Rails.root.join('lib')
end

View File

@@ -1,4 +1,3 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' # Set up gems listed in the Gemfile.

View File

@@ -13,8 +13,6 @@ Rails.application.configure do
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.perform_deliveries = true
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
@@ -24,6 +22,15 @@ Rails.application.configure do
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.

View File

@@ -16,11 +16,13 @@ Rails.application.configure do
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@@ -29,21 +31,22 @@ Rails.application.configure do
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# 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-Accel-Redirect' # for nginx
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
@@ -55,11 +58,7 @@ Rails.application.configure do
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# config.action_controller.asset_host = 'http://assets.example.com'
# 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.
@@ -72,9 +71,6 @@ Rails.application.configure do
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

View File

@@ -12,8 +12,8 @@ Rails.application.configure do
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
@@ -31,6 +31,9 @@ Rails.application.configure do
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Randomize the order test cases are executed.
config.active_support.test_order = :random
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

View File

@@ -0,0 +1,11 @@
# 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.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )

View File

@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_hands-on-programming_session'
Rails.application.config.session_store :cookie_store, key: '_CodeOcean_session'

View File

@@ -1,20 +1,20 @@
FILENAME_REGEXP = /[\w\.]+/ unless Kernel.const_defined?(:FILENAME_REGEXP)
Rails.application.routes.draw do
root to: 'application#welcome'
root 'application#welcome'
namespace :admin do
get 'dashboard', to: 'dashboard#show'
get 'dashboard' => 'dashboard#show'
end
get '/help', to: 'application#help'
get '/help' => 'application#help'
resources :consumers
resources :execution_environments do
member do
get :shell
post 'shell', as: :execute_command, to: :execute_command
post 'shell' => :execute_command, as: :execute_command
end
resources :errors, only: [:create, :index, :show]
@@ -40,29 +40,29 @@ Rails.application.routes.draw do
resources :internal_users do
member do
match 'activate', to: 'internal_users#activate', via: [:get, :patch, :put]
match 'reset_password', to: 'internal_users#reset_password', via: [:get, :patch, :put]
match 'activate' => 'internal_users#activate', via: [:get, :patch, :put]
match 'reset_password' => 'internal_users#reset_password', via: [:get, :patch, :put]
end
end
match '/forgot_password', as: 'forgot_password', to: 'internal_users#forgot_password', via: [:get, :post]
match '/forgot_password' => 'internal_users#forgot_password', as: 'forgot_password', via: [:get, :post]
resources :sessions, only: [:create, :destroy, :new]
post '/lti/launch', as: 'lti_launch', to: 'sessions#create_through_lti'
get '/lti/return', as: 'lti_return', to: 'sessions#destroy_through_lti'
get '/sign_in', as: 'sign_in', to: 'sessions#new'
delete '/sign_out', as: 'sign_out', to: 'sessions#destroy'
post '/lti/launch' => 'sessions#create_through_lti', as: 'lti_launch'
get '/lti/return' => 'sessions#destroy_through_lti', as: 'lti_return'
get '/sign_in' => 'sessions#new', as: 'sign_in'
delete '/sign_out' => 'sessions#destroy', as: 'sign_out'
resources :submissions, only: [:create, :index, :show] do
member do
get 'download/:filename', as: :download, constraints: {filename: FILENAME_REGEXP}, to: :download_file
get 'render/:filename', as: :render, constraints: {filename: FILENAME_REGEXP}, to: :render_file
get 'run/:filename', as: :run, constraints: {filename: FILENAME_REGEXP}, to: :run
get 'download/:filename' => :download_file, as: :download, constraints: {filename: FILENAME_REGEXP}
get 'render/:filename' => :render_file, as: :render, constraints: {filename: FILENAME_REGEXP}
get 'run/:filename' => :run, as: :run, constraints: {filename: FILENAME_REGEXP}
get :score
get :statistics
post :stop
get 'test/:filename', as: :test, constraints: {filename: FILENAME_REGEXP}, to: :test
get 'test/:filename' => :test, as: :test, constraints: {filename: FILENAME_REGEXP}
end
end