From 3f236c7a0e544db94ef822f120d649ac5ee958f7 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 25 Jun 2026 04:34:24 +0200 Subject: Upgrade to Rails 4.2.11.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump rails 3.2.22.5 → 4.2.11.3 - Replace globalize3 with globalize ~> 5.0 (gem renamed at 5.0) - Upgrade routing-filter ~> 0.3 → ~> 0.6 - Upgrade sass-rails, coffee-rails to 4.x - Upgrade awesome_nested_set 2.x → 3.x (Rails 4 required) - Add jquery-rails for UJS support - Pin nokogiri ~> 1.10.10, loofah ~> 2.20.0, rails-html-sanitizer ~> 1.4.4 - Add config/secrets.yml (gitignored), eager_load, serve_static_files - Fix routes: add via: to all match calls, remove legacy catch-all routes - Add admin named route, fix rvm dotfiles - Fix ActiveRecord::FixtureSet rename in test_helper - Set active_support.test_order and active_record.raise_in_transactional_callbacks --- .gitignore | 6 +- .ruby-gemset | 1 + .ruby-version | 1 + Gemfile | 23 ++-- Gemfile.lock | 221 +++++++++++++++++++++---------------- bin/bundle | 3 + bin/rails | 31 +----- bin/rake | 4 + bin/setup | 29 +++++ config/application.rb | 2 +- config/environments/development.rb | 3 +- config/environments/production.rb | 1 + config/environments/test.rb | 25 ++--- config/routes.rb | 20 ++-- test/test_helper.rb | 2 +- 15 files changed, 204 insertions(+), 168 deletions(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version create mode 100755 bin/bundle create mode 100755 bin/rake create mode 100755 bin/setup diff --git a/.gitignore b/.gitignore index 26b8198..834939f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,8 @@ public/system vendor/plugins/paperclip/tmp db/sphinx config/*.sphinx.conf -tmp \ No newline at end of file +tmpconfig/database.yml +config/database.yml +config/initializers/secret_token.rb +tmp/ +config/secrets.yml diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..c100f88 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +rails3-upgrade diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..5304f06 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.4.10 diff --git a/Gemfile b/Gemfile index 594f94e..f00395b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,26 +1,29 @@ source 'https://rubygems.org' -gem 'rails', '3.2.22.5' +gem 'rails', '4.2.11.3' gem 'pg', '~> 0.17.0' -# from your vendor/plugins, now as gems: gem 'acts-as-taggable-on', '~> 3.5' -gem 'awesome_nested_set', '~> 2.1' +gem 'awesome_nested_set', '~> 3.1' gem 'acts_as_list' -gem 'globalize3', '~> 0.3.0' -gem 'routing-filter', '~> 0.3' +gem 'globalize', '~> 5.0' +gem 'routing-filter', '~> 0.6' gem 'paperclip', '~> 3.5' gem 'will_paginate', '~> 3.0' gem 'exception_notification' gem 'libxml-ruby', :require => 'xml' -# gem 'thinking-sphinx', '1.5.0', :require => 'thinking_sphinx' +gem 'nokogiri', '~> 1.10.10' +gem 'loofah', '~> 2.20.0' +gem 'rails-html-sanitizer', '~> 1.4.4' +gem 'jquery-rails' + gem 'unicorn', '~> 1.1' group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' + gem 'sass-rails', '~> 4.0' + gem 'coffee-rails', '~> 4.0' gem 'uglifier', '>= 1.0.3' end @@ -28,5 +31,5 @@ group :test do gem 'test-unit', '~> 3.5' end -gem 'chaos_calendar', :git => 'https://github.com/erdgeist/chaoscalendar.git', :require => 'chaos_calendar', :branch => 'erdgeist-ruby1.9' - +gem 'chaos_calendar', :git => 'https://github.com/erdgeist/chaoscalendar.git', + :require => 'chaos_calendar', :branch => 'erdgeist-ruby1.9' diff --git a/Gemfile.lock b/Gemfile.lock index 34e0133..6350f67 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,136 +8,157 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.22.5) - actionpack (= 3.2.22.5) - mail (~> 2.5.4) - actionpack (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) + actionmailer (4.2.11.3) + actionpack (= 4.2.11.3) + actionview (= 4.2.11.3) + activejob (= 4.2.11.3) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.11.3) + actionview (= 4.2.11.3) + activesupport (= 4.2.11.3) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.11.3) + activesupport (= 4.2.11.3) + builder (~> 3.1) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) - activerecord (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - activesupport (3.2.22.5) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (4.2.11.3) + activesupport (= 4.2.11.3) + globalid (>= 0.3.0) + activemodel (4.2.11.3) + activesupport (= 4.2.11.3) + builder (~> 3.1) + activerecord (4.2.11.3) + activemodel (= 4.2.11.3) + activesupport (= 4.2.11.3) + arel (~> 6.0) + activesupport (4.2.11.3) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) acts-as-taggable-on (3.5.0) activerecord (>= 3.2, < 5) - acts_as_list (0.9.19) - activerecord (>= 3.0) - arel (3.0.3) - awesome_nested_set (2.1.6) - activerecord (>= 3.0.0) - builder (3.0.4) + acts_as_list (1.1.0) + activerecord (>= 4.2) + arel (6.0.4) + awesome_nested_set (3.9.0) + activerecord (>= 4.0.0, < 8.2) + builder (3.3.0) climate_control (0.2.0) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) - coffee-rails (3.2.2) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (~> 3.2.0) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.3.7) + crass (1.0.6) erubis (2.7.0) - exception_notification (4.1.1) - actionmailer (>= 3.0.4) - activesupport (>= 3.0.4) + exception_notification (4.4.3) + actionmailer (>= 4.0, < 7) + activesupport (>= 4.0, < 7) execjs (2.9.0) - ffi (1.15.5) - globalize3 (0.3.1) - activemodel (>= 3.0.0) - activerecord (>= 3.0.0) - paper_trail (~> 2) + globalid (0.4.2) + activesupport (>= 4.2.0) + globalize (5.3.1) + activemodel (>= 4.2, < 6.1) + activerecord (>= 4.2, < 6.1) + request_store (~> 1.0) hike (1.2.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - journey (1.0.4) - json (1.8.6) + jquery-rails (4.6.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) libxml-ruby (3.1.0) - mail (2.5.5) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) + logger (1.5.3) + loofah (2.20.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + mime-types (3.7.0) + logger + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2026.0414) + mini_mime (1.1.2) + mini_portile2 (2.4.0) + minitest (5.15.0) multi_json (1.15.0) - paper_trail (2.7.2) - activerecord (~> 3.0) - railties (~> 3.0) + nokogiri (1.10.10) + mini_portile2 (~> 2.4.0) paperclip (3.5.4) activemodel (>= 3.0.0) activesupport (>= 3.0.0) cocaine (~> 0.5.3) mime-types pg (0.17.1) - polyglot (0.3.5) power_assert (3.0.1) - rack (1.4.7) - rack-cache (1.15.0) - rack (>= 0.4) - rack-ssl (1.3.4) - rack + rack (1.6.13) rack-test (0.6.3) rack (>= 1.0) - rails (3.2.22.5) - actionmailer (= 3.2.22.5) - actionpack (= 3.2.22.5) - activerecord (= 3.2.22.5) - activeresource (= 3.2.22.5) - activesupport (= 3.2.22.5) - bundler (~> 1.0) - railties (= 3.2.22.5) - railties (3.2.22.5) - actionpack (= 3.2.22.5) - activesupport (= 3.2.22.5) - rack-ssl (~> 1.3.2) + rails (4.2.11.3) + actionmailer (= 4.2.11.3) + actionpack (= 4.2.11.3) + actionview (= 4.2.11.3) + activejob (= 4.2.11.3) + activemodel (= 4.2.11.3) + activerecord (= 4.2.11.3) + activesupport (= 4.2.11.3) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.11.3) + sprockets-rails + rails-deprecated_sanitizer (1.0.4) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) + railties (4.2.11.3) + actionpack (= 4.2.11.3) + activesupport (= 4.2.11.3) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) + thor (>= 0.18.1, < 2.0) rake (13.4.2) - rb-fsevent (0.11.2) - rb-inotify (0.10.1) - ffi (~> 1.0) - rdoc (3.12.2) - json (~> 1.4) - routing-filter (0.4.0.1) - actionpack (< 4.2) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - sprockets (2.2.3) + request_store (1.7.0) + rack (>= 1.4) + routing-filter (0.6.3) + actionpack (>= 4.2) + activesupport (>= 4.2) + sass (3.2.19) + sass-rails (4.0.5) + railties (>= 4.0.0, < 5.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 3.0) + sprockets-rails (~> 2.0) + sprockets (2.12.5) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) test-unit (3.7.8) power_assert thor (1.2.2) + thread_safe (0.3.6) tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.62) + tzinfo (1.2.11) + thread_safe (~> 0.1) uglifier (4.2.1) execjs (>= 0.3.0, < 3) unicorn (1.1.7) @@ -150,17 +171,21 @@ PLATFORMS DEPENDENCIES acts-as-taggable-on (~> 3.5) acts_as_list - awesome_nested_set (~> 2.1) + awesome_nested_set (~> 3.1) chaos_calendar! - coffee-rails (~> 3.2.1) + coffee-rails (~> 4.0) exception_notification - globalize3 (~> 0.3.0) + globalize (~> 5.0) + jquery-rails libxml-ruby + loofah (~> 2.20.0) + nokogiri (~> 1.10.10) paperclip (~> 3.5) pg (~> 0.17.0) - rails (= 3.2.22.5) - routing-filter (~> 0.3) - sass-rails (~> 3.2.3) + rails (= 4.2.11.3) + rails-html-sanitizer (~> 1.4.4) + routing-filter (~> 0.6) + sass-rails (~> 4.0) test-unit (~> 3.5) uglifier (>= 1.0.3) unicorn (~> 1.1) diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 7fd59cc..5191e69 100755 --- a/bin/rails +++ b/bin/rails @@ -1,29 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rails' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("railties", "rails") +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/config/application.rb b/config/application.rb index cb92166..1a7f32b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -56,6 +56,6 @@ module Cccms config.i18n.default_locale = :de config.filter_parameters += [:password, :password_confirmation] - config.serve_static_assets = true + config.serve_static_files = true end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 94f216f..3813cab 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -17,5 +17,6 @@ Cccms::Application.configure do config.action_mailer.raise_delivery_errors = false config.active_support.deprecation = :log - config.serve_static_assets = true + config.serve_static_files = true + config.eager_load = false end diff --git a/config/environments/production.rb b/config/environments/production.rb index 2f933de..6f2c5bd 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -13,6 +13,7 @@ Cccms::Application.configure do config.log_level = :info config.active_support.deprecation = :notify + config.eager_load = false # Use a different logger for distributed setups # config.logger = SyslogLogger.new diff --git a/config/environments/test.rb b/config/environments/test.rb index 728e147..3b2413e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,32 +1,23 @@ -# Settings specified here will take precedence over those in config/environment.rb - Cccms::Application.configure do - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + # config.whiny_nils = true # removed in Rails 4 - # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false - # Disable request forgery protection in test environment config.action_controller.allow_forgery_protection = false - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql + config.active_support.deprecation = :log + config.active_support.test_order = :sorted + + config.active_record.raise_in_transactional_callbacks = true - config.active_support.deprecation = :raise + config.eager_load = false + config.serve_static_files = true + config.static_cache_control = "public, max-age=3600" end diff --git a/config/routes.rb b/config/routes.rb index 5e3eb3f..4a440c1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,10 +31,11 @@ Cccms::Application.routes.draw do end end - match '/logout' => 'sessions#destroy', :as => :logout - match '/login' => 'sessions#new', :as => :login - match 'admin/search' => 'admin#search', :as => :admin_search - match 'search' => 'search#index', :as => :search + match '/logout' => 'sessions#destroy', :as => :logout, :via => :delete + match '/login' => 'sessions#new', :as => :login, :via => :get + match 'admin' => 'admin#index', :as => :admin, :via => :get + match 'admin/search' => 'admin#search', :as => :admin_search, :via => :get + match 'search' => 'search#index', :as => :search, :via => :get resources :users @@ -46,12 +47,9 @@ Cccms::Application.routes.draw do resource :session - match 'rss/:action' => 'rss#index', :as => :rss - match 'rss/:action.:format' => 'rss#index' + match 'rss/:action' => 'rss#index', :as => :rss, :via => [:get, :post] + match 'rss/:action.:format' => 'rss#index', :via => [:get, :post] - match '/:controller(/:action(/:id))' - match '/:controller(/:action(/:id.:format))' - - match 'galleries/*page_path' => 'content#render_gallery' - match '/*page_path' => 'content#render_page', :as => :content + match 'galleries/*page_path' => 'content#render_gallery', :via => :get + match '/*page_path' => 'content#render_page', :as => :content, :via => :get end diff --git a/test/test_helper.rb b/test/test_helper.rb index 27e1f0d..549f594 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'rails/test_help' module ActiveRecord - class Fixtures + class FixtureSet class << self alias_method :original_create_fixtures, :create_fixtures def create_fixtures(*args) -- cgit v1.3