From 3e7497a1445856788f0b881c8298942df9a942c7 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 00:59:18 +0200 Subject: [PATCH 01/10] Upgrade to Rails 5 --- Gemfile | 19 +- Gemfile.lock | 605 ++++++++++-------- app/helpers/theme_helper.rb | 2 +- app/models/answer.rb | 2 +- app/models/application_record.rb | 5 + app/models/comment.rb | 2 +- app/models/comment_smile.rb | 2 +- app/models/group.rb | 2 +- app/models/group_member.rb | 2 +- app/models/inbox.rb | 2 +- app/models/moderation_comment.rb | 2 +- app/models/moderation_vote.rb | 2 +- app/models/notification.rb | 2 +- app/models/question.rb | 2 +- app/models/relationship.rb | 2 +- app/models/report.rb | 2 +- app/models/service.rb | 2 +- app/models/smile.rb | 2 +- app/models/subscription.rb | 2 +- app/models/theme.rb | 2 +- app/models/user.rb | 2 +- app/views/inbox/show.html.haml | 2 +- bin/rails | 2 +- bin/setup | 29 +- bin/update | 29 + config/application.rb | 17 +- config/boot.rb | 5 +- config/cable.yml | 9 + config/environment.rb | 2 +- config/environments/development.rb | 32 +- config/environments/production.rb | 67 +- config/environments/test.rb | 9 +- .../application_controller_renderer.rb | 8 + config/initializers/assets.rb | 3 + config/initializers/cookies_serializer.rb | 4 +- config/initializers/haml.rb | 1 - config/initializers/new_framework_defaults.rb | 25 + config/initializers/wrap_parameters.rb | 4 +- config/puma.rb | 47 ++ config/secrets.yml | 2 +- config/spring.rb | 6 + 41 files changed, 573 insertions(+), 395 deletions(-) create mode 100644 app/models/application_record.rb create mode 100755 bin/update create mode 100644 config/cable.yml create mode 100644 config/initializers/application_controller_renderer.rb delete mode 100644 config/initializers/haml.rb create mode 100644 config/initializers/new_framework_defaults.rb create mode 100644 config/puma.rb create mode 100644 config/spring.rb diff --git a/Gemfile b/Gemfile index 70ae8baa..c300130a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,24 +1,24 @@ source 'https://rubygems.org' source 'https://rails-assets.org' -gem 'rails', '~> 4.2.11', '>= 4.2.11.1' -gem 'rails-i18n' +gem 'rails', '~> 5.0.7', '>= 5.0.7.2' +gem 'rails-i18n', '~> 5.0' gem 'i18n-js', '= 3.0.0.rc10' gem 'pg' -gem 'sass-rails', '~> 4.0.3' +gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' -gem 'coffee-rails', '~> 4.1.0' +gem 'coffee-rails', '~> 4.1' gem 'jquery-rails' gem 'turbolinks', '~> 2.5.3' gem 'jquery-turbolinks' -gem 'jbuilder', '~> 2.2.4' +gem 'jbuilder', '~> 2.10' gem 'sdoc', '~> 0.4.1', group: :doc gem 'bcrypt', '~> 3.1.7' -gem 'haml', '~> 4.0' +gem 'haml', '~> 5.0' gem 'bootstrap-sass', '~> 3.4.0' gem 'bootswatch-rails' gem 'sweetalert-rails' @@ -30,7 +30,7 @@ gem 'devise-async', git: "https://github.com/mhfs/devise-async.git", ref: "devis gem 'bootstrap_form' gem 'font-kit-rails' gem 'nprogress-rails' -gem 'font-awesome-rails', '~> 4.3.0.0' +gem 'font-awesome-rails', '~> 4.7.0' gem 'rails-assets-growl' gem 'rails-assets-jquery', '~> 2.2.0' gem "paperclip", "~> 4.2" @@ -51,8 +51,7 @@ gem 'rails_admin' gem 'pghero' gem 'newrelic_rpm' -gem 'sidekiq' -gem 'sinatra', require: false +gem 'sidekiq', "< 6" # remove version constraint once we have redis 5 gem 'questiongenerator', git: 'https://github.com/retrospring/questiongenerator.git' @@ -97,7 +96,7 @@ end group :development, :test do gem 'rake' gem 'puma' - gem 'rspec-rails', '~> 3.5' + gem 'rspec-rails', '~> 3.9' gem 'factory_girl_rails', require: false gem 'faker' gem 'capybara' diff --git a/Gemfile.lock b/Gemfile.lock index 75f11229..c0d7faeb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,103 +16,112 @@ GEM remote: https://rubygems.org/ remote: https://rails-assets.org/ specs: - CFPropertyList (2.3.5) - actionmailer (4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) + CFPropertyList (2.3.6) + actioncable (5.0.7.2) + actionpack (= 5.0.7.2) + nio4r (>= 1.2, < 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.1) - actionview (= 4.2.11.1) - activesupport (= 4.2.11.1) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.7.2) + actionview (= 5.0.7.2) + activesupport (= 5.0.7.2) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.1) - activesupport (= 4.2.11.1) + actionview (5.0.7.2) + activesupport (= 5.0.7.2) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.11.1) - activesupport (= 4.2.11.1) - globalid (>= 0.3.0) - activemodel (4.2.11.1) - activesupport (= 4.2.11.1) + activejob (5.0.7.2) + activesupport (= 5.0.7.2) + globalid (>= 0.3.6) + activemodel (5.0.7.2) + activesupport (= 5.0.7.2) + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) builder (~> 3.1) - activerecord (4.2.11.1) - activemodel (= 4.2.11.1) - activesupport (= 4.2.11.1) - arel (~> 6.0) - activesupport (4.2.11.1) - i18n (~> 0.7) + activerecord (5.0.7.2) + activemodel (= 5.0.7.2) + activesupport (= 5.0.7.2) + arel (~> 7.0) + activesupport (5.0.7.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.1) - public_suffix (~> 2.0, >= 2.0.2) - airbrussh (1.1.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - arel (6.0.4) - autoprefixer-rails (9.5.0) + arel (7.1.4) + autoprefixer-rails (9.7.6) execjs - bcrypt (3.1.12) - better_errors (2.1.1) + bcrypt (3.1.13) + better_errors (2.6.0) coderay (>= 1.0.0) - erubis (>= 2.6.6) + erubi (>= 1.0.0) rack (>= 0.9.0) - binding_of_caller (0.7.2) + binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) bootstrap3-datetimepicker-rails (4.7.14) momentjs-rails (>= 2.8.1) - bootstrap_form (2.6.0) + bootstrap_form (4.4.0) + actionpack (>= 5.0) + activemodel (>= 5.0) bootswatch-rails (3.3.5) railties (>= 3.1) - brakeman (3.6.1) + brakeman (4.8.1) buftok (0.2.0) - builder (3.2.3) - byebug (9.0.6) - capistrano (3.8.0) + builder (3.2.4) + byebug (11.1.2) + capistrano (3.13.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.2.0) + capistrano-bundler (1.6.0) capistrano (~> 3.1) - sshkit (~> 1.2) - capistrano-rails (1.2.3) + capistrano-rails (1.4.0) capistrano (~> 3.1) capistrano-bundler (~> 1.1) - capybara (2.13.0) + capybara (3.32.1) addressable - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) climate_control (0.2.0) cliver (0.3.2) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) - coderay (1.1.1) - coffee-rails (4.1.1) + coderay (1.1.2) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) colorize (0.8.1) - concurrent-ruby (1.0.5) - connection_pool (2.2.1) - crass (1.0.4) - database_cleaner (1.5.3) - debug_inspector (0.0.2) + concurrent-ruby (1.1.6) + connection_pool (2.2.2) + crass (1.0.6) + database_cleaner (1.8.4) + debug_inspector (0.0.3) delayed_paperclip (3.0.1) activejob (>= 4.2) paperclip (>= 3.3) @@ -122,44 +131,52 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.1.2) + devise-i18n (1.9.1) + devise (>= 4.7.1) diff-lcs (1.3) - docile (1.1.5) - domain_name (0.5.20170223) + docile (1.3.2) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) + dry-inflector (0.2.0) equalizer (0.0.11) + erubi (1.9.0) erubis (2.7.0) excon (0.73.0) execjs (2.7.0) - factory_girl (4.8.0) + factory_girl (4.9.0) activesupport (>= 3.0.0) - factory_girl_rails (4.8.0) - factory_girl (~> 4.8.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) railties (>= 3.0.0) fake_email_validator (1.0.11) activemodel mail - faker (1.7.3) - i18n (~> 0.5) - faraday (0.11.0) + faker (2.2.1) + i18n (>= 0.8) + faraday (0.9.2) multipart-post (>= 1.2, < 3) - faraday_middleware (0.11.0.1) - faraday (>= 0.7.4, < 1.0) - ffi (1.10.0) + faraday_middleware (0.9.2) + faraday (>= 0.7.4, < 0.10) + ffi (1.12.2) + ffi-compiler (1.0.1) + ffi (>= 1.0.0) + rake fission (0.5.0) CFPropertyList (~> 2.2) - fog (1.40.0) + fog (1.41.0) fog-aliyun (>= 0.1.0) fog-atmos fog-aws (>= 0.6.0) fog-brightbox (~> 0.4) fog-cloudatcost (~> 0.1.0) - fog-core (~> 1.43) + fog-core (~> 1.45) fog-digitalocean (>= 0.3.0) fog-dnsimple (~> 1.0) fog-dynect (~> 0.0.2) fog-ecloud (~> 0.1) fog-google (<= 0.1.0) + fog-internet-archive + fog-joyent fog-json fog-local fog-openstack @@ -180,36 +197,37 @@ GEM fog-xml (~> 0.1.1) ipaddress (~> 0.5) json (>= 1.8, < 2.0) - fog-aliyun (0.1.0) - fog-core (~> 1.27) - fog-json (~> 1.0) + fog-aliyun (0.3.8) + fog-core + fog-json ipaddress (~> 0.8) xml-simple (~> 1.1) fog-atmos (0.1.0) fog-core fog-xml - fog-aws (1.3.0) + fog-aws (2.0.1) fog-core (~> 1.38) fog-json (~> 1.0) fog-xml (~> 0.1) ipaddress (~> 0.8) - fog-brightbox (0.11.0) - fog-core (~> 1.22) + fog-brightbox (0.16.1) + dry-inflector + fog-core fog-json - inflecto (~> 0.0.2) + mime-types fog-cloudatcost (0.1.2) fog-core (~> 1.36) fog-json (~> 1.0) fog-xml (~> 0.1) ipaddress (~> 0.8) - fog-core (1.43.0) + fog-core (1.45.0) builder - excon (~> 0.49) + excon (~> 0.58) formatador (~> 0.2) - fog-digitalocean (0.3.0) - fog-core (~> 1.42) - fog-json (>= 1.0) - fog-xml (>= 0.1) + fog-digitalocean (0.4.0) + fog-core + fog-json + fog-xml ipaddress (>= 0.5) fog-dnsimple (1.0.0) fog-core (~> 1.38) @@ -225,23 +243,30 @@ GEM fog-core fog-json fog-xml - fog-json (1.0.2) - fog-core (~> 1.0) + fog-internet-archive (0.0.1) + fog-core + fog-json + fog-xml + fog-joyent (0.0.1) + fog-core (~> 1.42) + fog-json (>= 1.0) + fog-json (1.2.0) + fog-core multi_json (~> 1.10) - fog-local (0.3.1) - fog-core (~> 1.27) - fog-openstack (0.1.20) - fog-core (>= 1.40) + fog-local (0.6.0) + fog-core (>= 1.27, < 3.0) + fog-openstack (0.3.10) + fog-core (>= 1.45, <= 2.1.0) fog-json (>= 1.0) ipaddress (>= 0.8) - fog-powerdns (0.1.1) - fog-core (~> 1.27) - fog-json (~> 1.0) - fog-xml (~> 0.1) - fog-profitbricks (3.0.0) + fog-powerdns (0.2.0) + fog-core + fog-json + fog-xml + fog-profitbricks (4.1.1) fog-core (~> 1.42) fog-json (~> 1.0) - fog-rackspace (0.1.4) + fog-rackspace (0.1.6) fog-core (>= 1.35) fog-json (>= 1.0) fog-xml (>= 0.1) @@ -275,64 +300,67 @@ GEM fog-voxel (0.1.0) fog-core fog-xml - fog-vsphere (1.9.0) + fog-vsphere (3.3.0) fog-core - rbvmomi (~> 1.9) - fog-xenserver (0.3.0) + rbvmomi (>= 1.9, < 3) + fog-xenserver (1.0.0) fog-core fog-xml + xmlrpc fog-xml (0.1.3) fog-core nokogiri (>= 1.5.11, < 2.0.0) - font-awesome-rails (4.3.0.0) - railties (>= 3.2, < 5.0) + font-awesome-rails (4.7.0.5) + railties (>= 3.2, < 6.1) font-kit-rails (1.2.0) rails - foreman (0.84.0) - thor (~> 0.19.1) + foreman (0.87.1) formatador (0.2.5) globalid (0.4.2) activesupport (>= 4.2.0) - guard (2.14.1) + guard (2.16.2) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) - lumberjack (~> 1.0) + lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) pry (>= 0.9.12) shellany (~> 0.0) thor (>= 0.18.1) - guard-brakeman (0.8.3) + guard-brakeman (0.8.6) brakeman (>= 2.1.1) guard (>= 2.0.0) - haml (4.0.7) + guard-compat (~> 1.0) + guard-compat (1.2.1) + haml (5.1.2) + temple (>= 0.8.0) tilt hashie (4.1.0) - hike (1.2.3) - http (2.2.1) + http (4.4.1) addressable (~> 2.3) http-cookie (~> 1.0) - http-form_data (~> 1.0.1) - http_parser.rb (~> 0.6.0) + http-form_data (~> 2.2) + http-parser (~> 1.2.0) http-cookie (1.0.3) domain_name (~> 0.5) - http-form_data (1.0.1) + http-form_data (2.3.0) + http-parser (1.2.1) + ffi-compiler (>= 1.0, < 2.0) http_parser.rb (0.6.0) - httparty (0.14.0) + httparty (0.18.0) + mime-types (~> 3.0) multi_xml (>= 0.5.2) i18n (0.9.5) concurrent-ruby (~> 1.0) i18n-js (3.0.0.rc10) i18n (~> 0.6) - inflecto (0.0.2) ipaddress (0.8.3) - jbuilder (2.2.16) - activesupport (>= 3.0.0, < 5) - multi_json (~> 1.2) - jquery-minicolors-rails (2.2.3.1) + jbuilder (2.10.0) + activesupport (>= 5.0.0) + jquery-minicolors-rails (2.2.6.2) jquery-rails rails (>= 3.2.8) - jquery-rails (4.3.1) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -354,52 +382,54 @@ GEM activerecord kaminari-core (= 1.2.0) kaminari-core (1.2.0) - kgio (2.11.0) - launchy (2.4.3) - addressable (~> 2.3) - letter_opener (1.4.1) + kgio (2.11.3) + launchy (2.5.0) + addressable (~> 2.7) + letter_opener (1.7.0) launchy (~> 2.2) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) + listen (3.2.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) loofah (2.5.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.0.11) - mail (2.6.4) - mime-types (>= 1.16, < 4) + lumberjack (1.2.4) + mail (2.7.1) + mini_mime (>= 0.1.1) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) - method_source (0.8.2) - mime-types (3.1) + method_source (1.0.0) + mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) + mime-types-data (3.2019.1009) mimemagic (0.3.0) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - momentjs-rails (2.17.1) + minitest (5.14.0) + momentjs-rails (2.20.1) railties (>= 3.1) - multi_json (1.12.1) + multi_json (1.14.1) multi_xml (0.6.0) - multipart-post (2.0.0) + multipart-post (2.1.1) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) naught (1.1.0) nenv (0.3.0) nested_form (0.3.2) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (4.1.0) - newrelic_rpm (4.2.0.334) + net-scp (2.0.0) + net-ssh (>= 2.6.5, < 6.0.0) + net-ssh (5.2.0) + newrelic_rpm (6.10.0.364) nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) - nokogumbo (2.0.1) + nokogumbo (2.0.2) nokogiri (~> 1.8, >= 1.8.4) - notiffany (0.1.1) + notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) nprogress-rails (0.2.0.2) - oauth (0.5.1) + oauth (0.5.4) omniauth (1.9.1) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) @@ -412,6 +442,7 @@ GEM omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack + optimist (3.0.0) orm_adapter (0.5.0) paperclip (4.3.7) activemodel (>= 3.2.0) @@ -419,201 +450,206 @@ GEM cocaine (~> 0.5.5) mime-types mimemagic (= 0.3.0) - pg (0.20.0) - pghero (1.6.4) - activerecord - poltergeist (1.14.0) - capybara (~> 2.1) + pg (1.2.3) + pghero (2.4.2) + activerecord (>= 5) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) cliver (~> 0.3.1) websocket-driver (>= 0.2.0) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - public_suffix (2.0.5) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.4) puma (4.3.3) nio4r (~> 2.0) - rack (1.6.13) + rack (2.0.9) rack-pjax (1.1.0) nokogiri (~> 1.5) rack (>= 1.1) - rack-protection (1.5.5) + rack-protection (2.0.8.1) rack rack-test (0.6.3) rack (>= 1.0) - rails (4.2.11.1) - actionmailer (= 4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - activemodel (= 4.2.11.1) - activerecord (= 4.2.11.1) - activesupport (= 4.2.11.1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.1) - sprockets-rails - rails-assets-growl (1.3.2) + rails (5.0.7.2) + actioncable (= 5.0.7.2) + actionmailer (= 5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + activemodel (= 5.0.7.2) + activerecord (= 5.0.7.2) + activesupport (= 5.0.7.2) + bundler (>= 1.3.0) + railties (= 5.0.7.2) + sprockets-rails (>= 2.0.0) + rails-assets-growl (1.3.5) rails-assets-jquery rails-assets-jquery (2.2.4) - rails-deprecated_sanitizer (1.0.3) - 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.0.4) - loofah (~> 2.2, >= 2.2.2) - rails-i18n (4.0.9) - i18n (~> 0.7) - railties (~> 4.0) - rails_admin (1.4.3) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + rails-i18n (5.1.3) + i18n (>= 0.7, < 2) + railties (>= 5.0, < 6) + rails_admin (2.0.2) + activemodel-serializers-xml (>= 1.0) builder (~> 3.1) - coffee-rails (~> 4.0) - font-awesome-rails (>= 3.0, < 5) haml (>= 4.0, < 6) jquery-rails (>= 3.0, < 5) jquery-ui-rails (>= 5.0, < 7) kaminari (>= 0.14, < 2.0) nested_form (~> 0.3) rack-pjax (>= 0.7) - rails (>= 4.0, < 6) + rails (>= 5.0, < 7) remotipart (~> 1.3) - sass-rails (>= 4.0, < 6) - railties (4.2.11.1) - actionpack (= 4.2.11.1) - activesupport (= 4.2.11.1) + sassc-rails (>= 1.3, < 3) + railties (5.0.7.2) + actionpack (= 5.0.7.2) + activesupport (= 5.0.7.2) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - raindrops (0.18.0) + raindrops (0.19.1) rake (13.0.1) - rb-fsevent (0.9.8) - rb-inotify (0.9.8) - ffi (>= 0.5.0) - rbvmomi (1.10.0) + rb-fsevent (0.10.3) + rb-inotify (0.10.1) + ffi (~> 1.0) + rbvmomi (2.4.1) builder (~> 3.0) json (>= 1.8) nokogiri (~> 1.5) - trollop (~> 2.1) + optimist (~> 3.0) rdoc (4.3.0) - redcarpet (3.4.0) - redis (3.3.3) + redcarpet (3.5.0) + redis (4.1.3) + regexp_parser (1.7.0) remotipart (1.4.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - rollbar (2.14.1) - multi_json - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) + rollbar (2.24.0) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) + rspec-expectations (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-rails (3.5.2) + rspec-support (~> 3.9.0) + rspec-rails (3.9.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) - ruby-progressbar (1.8.1) - ruby_dep (1.5.0) - sanitize (5.0.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-support (~> 3.9.0) + rspec-support (3.9.2) + ruby-progressbar (1.10.1) + ruby2_keywords (0.0.2) + sanitize (5.1.0) crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) - 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) - sassc (2.0.1) + 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 (5.0.7) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + sassc (2.3.0) ffi (~> 1.9) - rake + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) shellany (0.0.1) - sidekiq (4.2.10) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) + sidekiq (5.2.8) + connection_pool (~> 2.2, >= 2.2.2) + rack (< 2.1.0) rack-protection (>= 1.5.0) - redis (~> 3.2, >= 3.2.1) + redis (>= 3.3.5, < 5) simple_oauth (0.3.1) - simplecov (0.14.1) - docile (~> 1.1.0) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) - simplecov-json (0.2) + simplecov (0.18.5) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) + simplecov-json (0.2.1) json simplecov simplecov-rcov (0.2.3) simplecov (>= 0.4.1) - sinatra (1.4.8) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) - slop (3.6.0) + sinatra (2.0.8.1) + mustermann (~> 1.0) + rack (~> 2.0) + rack-protection (= 2.0.8.1) + tilt (~> 2.0) spring (1.3.6) - 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) - sshkit (1.13.1) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sshkit (1.21.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) sweetalert-rails (1.1.3) railties (>= 3.1.0) - thor (0.19.4) + temple (0.8.2) + thor (1.0.1) thread_safe (0.3.6) - tilt (1.4.1) + tilt (2.0.10) tiny-color-rails (0.0.2) railties (>= 3.0) - trollop (2.1.2) - tumblr_client (0.8.2) - faraday (>= 0.8) - faraday_middleware (>= 0.8) + tumblr_client (0.8.5) + faraday (~> 0.9.0) + faraday_middleware (~> 0.9.0) json mime-types oauth simple_oauth - turbolinks (2.5.3) + turbolinks (2.5.4) coffee-rails twemoji-rails (1.2.1.3) railties (>= 3.0.0) - twitter (6.1.0) - addressable (~> 2.5) + twitter (7.0.0) + addressable (~> 2.3) buftok (~> 0.2.0) - equalizer (= 0.0.11) - faraday (~> 0.11.0) - http (~> 2.1) + equalizer (~> 0.0.11) + http (~> 4.0) + http-form_data (~> 2.0) http_parser.rb (~> 0.6.0) - memoizable (~> 0.4.2) - naught (~> 1.1) - simple_oauth (~> 0.3.1) - tzinfo (1.2.5) + memoizable (~> 0.4.0) + multipart-post (~> 2.0) + naught (~> 1.0) + simple_oauth (~> 0.3.0) + tzinfo (1.2.7) thread_safe (~> 0.1) - uglifier (3.1.12) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.2) - unicorn (5.2.0) + unf_ext (0.0.7.7) + unicorn (5.5.4) kgio (~> 2.6) raindrops (~> 0.7) - warden (1.2.7) - rack (>= 1.0) + warden (1.2.8) + rack (>= 2.0.6) web-console (2.3.0) activemodel (>= 4.0) binding_of_caller (>= 0.7.2) @@ -621,13 +657,14 @@ GEM sprockets-rails (>= 2.0, < 4.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) - will_paginate (3.1.5) - will_paginate-bootstrap (1.0.1) + websocket-extensions (0.1.4) + will_paginate (3.3.0) + will_paginate-bootstrap (1.0.2) will_paginate (>= 3.0.3) xml-simple (1.1.5) - xpath (2.0.0) - nokogiri (~> 1.3) + xmlrpc (0.3.0) + xpath (3.2.0) + nokogiri (~> 1.8) PLATFORMS ruby @@ -644,7 +681,7 @@ DEPENDENCIES capistrano (~> 3.8) capistrano-rails capybara - coffee-rails (~> 4.1.0) + coffee-rails (~> 4.1) colorize database_cleaner delayed_paperclip @@ -656,14 +693,14 @@ DEPENDENCIES faker fog fog-aws - font-awesome-rails (~> 4.3.0.0) + font-awesome-rails (~> 4.7.0) font-kit-rails foreman guard-brakeman - haml (~> 4.0) + haml (~> 5.0) httparty i18n-js (= 3.0.0.rc10) - jbuilder (~> 2.2.4) + jbuilder (~> 2.10) jquery-minicolors-rails jquery-rails jquery-turbolinks @@ -680,21 +717,21 @@ DEPENDENCIES poltergeist puma questiongenerator! - rails (~> 4.2.11, >= 4.2.11.1) + rails (~> 5.0.7, >= 5.0.7.2) rails-assets-growl rails-assets-jquery (~> 2.2.0) - rails-i18n + rails-i18n (~> 5.0) rails_admin rake redcarpet redis rollbar - rspec-rails (~> 3.5) + rspec-rails (~> 3.9) ruby-progressbar sanitize - sass-rails (~> 4.0.3) + sass-rails (~> 5.0) sdoc (~> 0.4.1) - sidekiq + sidekiq (< 6) simplecov simplecov-json simplecov-rcov diff --git a/app/helpers/theme_helper.rb b/app/helpers/theme_helper.rb index ea9ba8c5..06a1ff39 100644 --- a/app/helpers/theme_helper.rb +++ b/app/helpers/theme_helper.rb @@ -2,7 +2,7 @@ module ThemeHelper def render_theme_with_context(context = {}) klass = Class.new do def initialize(hash = {}) - if hash.is_a? ActiveRecord::Base + if hash.is_a? ApplicationRecord x = [ :primary_color, :primary_text, :danger_color, :danger_text, diff --git a/app/models/answer.rb b/app/models/answer.rb index 25ffc23a..652e24d8 100644 --- a/app/models/answer.rb +++ b/app/models/answer.rb @@ -1,4 +1,4 @@ -class Answer < ActiveRecord::Base +class Answer < ApplicationRecord belongs_to :user belongs_to :question has_many :comments, dependent: :destroy diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 00000000..71fbba5b --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/comment.rb b/app/models/comment.rb index 94059387..1392067c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,4 +1,4 @@ -class Comment < ActiveRecord::Base +class Comment < ApplicationRecord belongs_to :user belongs_to :answer validates :user_id, presence: true diff --git a/app/models/comment_smile.rb b/app/models/comment_smile.rb index 8c116723..915089b1 100644 --- a/app/models/comment_smile.rb +++ b/app/models/comment_smile.rb @@ -1,4 +1,4 @@ -class CommentSmile < ActiveRecord::Base +class CommentSmile < ApplicationRecord belongs_to :user belongs_to :comment validates :user_id, presence: true, uniqueness: { scope: :comment_id, message: "already smiled comment" } diff --git a/app/models/group.rb b/app/models/group.rb index 68ad2e29..c7fbb9ad 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,4 +1,4 @@ -class Group < ActiveRecord::Base +class Group < ApplicationRecord belongs_to :user has_many :group_members, dependent: :destroy diff --git a/app/models/group_member.rb b/app/models/group_member.rb index 0163e2c0..5bdf6dc0 100644 --- a/app/models/group_member.rb +++ b/app/models/group_member.rb @@ -1,4 +1,4 @@ -class GroupMember < ActiveRecord::Base +class GroupMember < ApplicationRecord belongs_to :user belongs_to :group end diff --git a/app/models/inbox.rb b/app/models/inbox.rb index 0cea150b..458e9d63 100644 --- a/app/models/inbox.rb +++ b/app/models/inbox.rb @@ -1,4 +1,4 @@ -class Inbox < ActiveRecord::Base +class Inbox < ApplicationRecord belongs_to :user belongs_to :question diff --git a/app/models/moderation_comment.rb b/app/models/moderation_comment.rb index da534d5c..d0baa654 100644 --- a/app/models/moderation_comment.rb +++ b/app/models/moderation_comment.rb @@ -1,4 +1,4 @@ -class ModerationComment < ActiveRecord::Base +class ModerationComment < ApplicationRecord belongs_to :user belongs_to :report validates :user_id, presence: true diff --git a/app/models/moderation_vote.rb b/app/models/moderation_vote.rb index 6e12c832..14f70bf0 100644 --- a/app/models/moderation_vote.rb +++ b/app/models/moderation_vote.rb @@ -1,4 +1,4 @@ -class ModerationVote < ActiveRecord::Base +class ModerationVote < ApplicationRecord belongs_to :user belongs_to :report validates :user_id, presence: true diff --git a/app/models/notification.rb b/app/models/notification.rb index d93e6821..18d29bd2 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,4 +1,4 @@ -class Notification < ActiveRecord::Base +class Notification < ApplicationRecord belongs_to :recipient, class_name: 'User' belongs_to :target, polymorphic: true diff --git a/app/models/question.rb b/app/models/question.rb index adc95c59..29146367 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -1,4 +1,4 @@ -class Question < ActiveRecord::Base +class Question < ApplicationRecord belongs_to :user has_many :answers, dependent: :destroy has_many :inboxes, dependent: :destroy diff --git a/app/models/relationship.rb b/app/models/relationship.rb index 2142276f..5ce6ac98 100644 --- a/app/models/relationship.rb +++ b/app/models/relationship.rb @@ -1,4 +1,4 @@ -class Relationship < ActiveRecord::Base +class Relationship < ApplicationRecord belongs_to :source, class_name: 'User' belongs_to :target, class_name: 'User' validates :source_id, presence: true diff --git a/app/models/report.rb b/app/models/report.rb index a185bb48..9ed86152 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -1,4 +1,4 @@ -class Report < ActiveRecord::Base +class Report < ApplicationRecord belongs_to :user has_many :moderation_votes, dependent: :destroy has_many :moderation_comments, dependent: :destroy diff --git a/app/models/service.rb b/app/models/service.rb index 5f924544..46bd234a 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -1,4 +1,4 @@ -class Service < ActiveRecord::Base +class Service < ApplicationRecord attr_accessor :provider, :info belongs_to :user diff --git a/app/models/smile.rb b/app/models/smile.rb index 566c3bcc..2090cac0 100644 --- a/app/models/smile.rb +++ b/app/models/smile.rb @@ -1,4 +1,4 @@ -class Smile < ActiveRecord::Base +class Smile < ApplicationRecord belongs_to :user belongs_to :answer validates :user_id, presence: true, uniqueness: { scope: :answer_id, message: "already smiled answer" } diff --git a/app/models/subscription.rb b/app/models/subscription.rb index c5065765..bab3bf39 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -1,4 +1,4 @@ -class Subscription < ActiveRecord::Base +class Subscription < ApplicationRecord belongs_to :user belongs_to :answer diff --git a/app/models/theme.rb b/app/models/theme.rb index 5e6ddbc4..74700a54 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -1,4 +1,4 @@ -class Theme < ActiveRecord::Base +class Theme < ApplicationRecord include ThemeHelper belongs_to :user diff --git a/app/models/user.rb b/app/models/user.rb index 18a508dd..43e88e4f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ -class User < ActiveRecord::Base +class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :async, :registerable, diff --git a/app/views/inbox/show.html.haml b/app/views/inbox/show.html.haml index a8b2648a..45c62ba0 100644 --- a/app/views/inbox/show.html.haml +++ b/app/views/inbox/show.html.haml @@ -22,4 +22,4 @@ = render 'inbox/sidebar' = render "shared/links" -- @inbox.update_all(new: false) +- Inbox.where(id: @inbox.ids).update_all(new: false) diff --git a/bin/rails b/bin/rails index 5191e692..07396602 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/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 'rails/commands' diff --git a/bin/setup b/bin/setup index acdb2c13..e620b4da 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,34 @@ #!/usr/bin/env ruby require 'pathname' +require 'fileutils' +include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) -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. - # Add necessary setup steps to this file: + # Add necessary setup steps to this file. - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system "bin/rake db:setup" + system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" + system! 'bin/rails restart' end diff --git a/bin/update b/bin/update new file mode 100755 index 00000000..a8e4462f --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +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') + + 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 diff --git a/config/application.rb b/config/application.rb index cd497243..68c8d943 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' @@ -14,13 +14,6 @@ module Justask # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - # 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. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de config.autoload_paths += %W["#{config.root}/app/validators"] # Use Sidekiq for background jobs @@ -30,14 +23,6 @@ module Justask config.i18n.fallbacks = true config.i18n.enforce_available_locales = false - - # DEPRECATION WARNING: Currently, Active Record suppresses errors raised - # within `after_rollback`/`after_commit` callbacks and only print them to the logs. - # In the next version, these errors will no longer be suppressed. - # Instead, the errors will propagate normally just like in other Active Record callbacks. - # fix for this warning: - config.active_record.raise_in_transactional_callbacks = true - config.after_initialize do Dir.glob Rails.root.join('config/late_initializers/*.rb') do |f| require f diff --git a/config/boot.rb b/config/boot.rb index 5e5f0c1f..30f5120d 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,3 @@ -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 00000000..0bbde6f7 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,9 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 diff --git a/config/environment.rb b/config/environment.rb index b90d71e9..80cc1632 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. start = Time.now diff --git a/config/environments/development.rb b/config/environments/development.rb index 30738511..cd66aa46 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -9,9 +9,22 @@ Rails.application.configure do # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + 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=172800' + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end # Action Mailer Setup # if you want to test sending mails locally, uncomment the line below and comment the :sendmail line @@ -25,10 +38,11 @@ Rails.application.configure do config.action_mailer.delivery_method = :sendmail end - config.action_mailer.perform_deliveries = true # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + config.action_mailer.perform_caching = false + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -40,11 +54,13 @@ Rails.application.configure do # number of complex assets. config.assets.debug = true - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true + # Suppress logger output for asset requests. + config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index 1c5656b5..cbacd711 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,13 +14,9 @@ Rails.application.configure do config.consider_all_requests_local = false config.action_controller.perform_caching = true - # 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. - # config.action_dispatch.rack_cache = true - - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_files = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -29,36 +25,41 @@ 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. - config.assets.digest = true + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # `config.assets.precompile` has 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. - # 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 + + # 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. # 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 ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [ :request_id ] # Use a different cache store in production. # 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" + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "justask_#{Rails.env}" + config.action_mailer.perform_caching = false - # 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 ) + # 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. + # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). @@ -67,19 +68,19 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - config.action_mailer.delivery_method = :sendmail - # config.action_mailer.default_url_options = { host: 'retrospring.net' } - config.action_mailer.perform_deliveries = true - # 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. - config.action_mailer.raise_delivery_errors = true - - # 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 + # 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. config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 0d6459df..30587ef6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,9 +12,11 @@ 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_files = true - config.static_cache_control = 'public, max-age=3600' + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=3600' + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -25,6 +27,7 @@ Rails.application.configure do # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 00000000..89d2efab --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -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 diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 0c0205fe..e321065f 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,6 +3,9 @@ # 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( moderation.js ) diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7a06a89f..5a6a32d3 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.action_dispatch.cookies_serializer = :json \ No newline at end of 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 diff --git a/config/initializers/haml.rb b/config/initializers/haml.rb deleted file mode 100644 index 7e8ddb37..00000000 --- a/config/initializers/haml.rb +++ /dev/null @@ -1 +0,0 @@ -Haml::Template.options[:ugly] = true diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb new file mode 100644 index 00000000..f9fa1b88 --- /dev/null +++ b/config/initializers/new_framework_defaults.rb @@ -0,0 +1,25 @@ +# 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. + +Rails.application.config.action_controller.raise_on_unfiltered_parameters = true + +# 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 = true# false + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = true diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95..bbfc3961 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,10 +5,10 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 00000000..c7f311f8 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,47 @@ +# 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 }.to_i +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. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/secrets.yml b/config/secrets.yml index 2e5654bd..064543d6 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -5,7 +5,7 @@ # Make sure the secret is at least 30 characters and all random, # 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 # if you're sharing your code publicly. diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 00000000..c9119b40 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } From a53015f36e6873c69cf3d19657be9715cfd5a0d1 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 19 Apr 2020 01:17:37 +0200 Subject: [PATCH 02/10] add Docker development setup --- .docker/ruby/Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .docker/ruby/Dockerfile create mode 100644 docker-compose.yml diff --git a/.docker/ruby/Dockerfile b/.docker/ruby/Dockerfile new file mode 100644 index 00000000..226b4994 --- /dev/null +++ b/.docker/ruby/Dockerfile @@ -0,0 +1,30 @@ +FROM ruby:2.6 + +RUN apt-get update -qq && apt-get install -y build-essential + +# for postgres +RUN apt-get install -y libpq-dev + +# for nokogiri +RUN apt-get install -y libxml2-dev libxslt1-dev + +# for images +RUN apt-get install -y libmagickwand-dev imagemagick + +# for a JS runtime +RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - +RUN apt-get install -y nodejs + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + postgresql-client \ + && rm -rf /var/lib/apt/lists/* + +ENV APP_HOME /app +RUN mkdir $APP_HOME +WORKDIR $APP_HOME + +ADD Gemfile* $APP_HOME/ +RUN bundle install + +EXPOSE 3000 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..90553f7d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: "3.7" + +services: + web: + build: + context: . + dockerfile: .docker/ruby/Dockerfile + command: + ruby bin/rails server --port 3000 --binding 0.0.0.0 + links: + - postgres + - redis + volumes: + - ./:/app + ports: + - 3000:3000 + + redis: + image: redis:3.2.11-alpine + ports: + - 6379:6379 + + postgres: + image: postgres:10.12 + ports: + - 5432:5432 + environment: + POSTGRES_PASSWORD: justask + POSTGRES_DB: justask_development \ No newline at end of file From 323f9d91ac78896b82be73c63ebd5815232eb9cf Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 01:19:25 +0200 Subject: [PATCH 03/10] Fix NoMethodError on the data page --- app/views/user/data.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/user/data.html.haml b/app/views/user/data.html.haml index 4db3efbe..9cff91a2 100644 --- a/app/views/user/data.html.haml +++ b/app/views/user/data.html.haml @@ -17,7 +17,7 @@ %p.data-heading Display name %p.text-muted - - if current_user.display_name.empty? + - if current_user.display_name.blank? None set! - else = current_user.display_name From e3d5750c32e947ac7da67aa4663a7bef141808ba Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 01:36:49 +0200 Subject: [PATCH 04/10] update devise-async to 1.0 --- Gemfile | 2 +- Gemfile.lock | 22 ++++------------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Gemfile b/Gemfile index c300130a..1e9adae2 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ gem 'will_paginate' gem 'will_paginate-bootstrap' gem 'devise', '~> 4.0' gem 'devise-i18n' -gem 'devise-async', git: "https://github.com/mhfs/devise-async.git", ref: "devise-4.x" # TODO: bring this to 1.0 after rails5 upgrade +gem 'devise-async' gem 'bootstrap_form' gem 'font-kit-rails' gem 'nprogress-rails' diff --git a/Gemfile.lock b/Gemfile.lock index c0d7faeb..612e4bb5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,3 @@ -GIT - remote: https://github.com/mhfs/devise-async.git - revision: 177f6363a002f7ff28f1d289c8cab7ad8d9cb8c5 - ref: devise-4.x - specs: - devise-async (0.10.2) - devise (>= 4.0) - GIT remote: https://github.com/retrospring/questiongenerator.git revision: c5f8362ff769425d42a94b3a611731eadaa5e0ca @@ -131,6 +123,9 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) + devise-async (1.0.0) + activejob (>= 5.0) + devise (>= 4.0) devise-i18n (1.9.1) devise (>= 4.7.1) diff-lcs (1.3) @@ -411,8 +406,6 @@ GEM multi_json (1.14.1) multi_xml (0.6.0) multipart-post (2.1.1) - mustermann (1.1.1) - ruby2_keywords (~> 0.0.1) naught (1.1.0) nenv (0.3.0) nested_form (0.3.2) @@ -549,7 +542,6 @@ GEM rspec-support (~> 3.9.0) rspec-support (3.9.2) ruby-progressbar (1.10.1) - ruby2_keywords (0.0.2) sanitize (5.1.0) crass (~> 1.0.2) nokogiri (>= 1.8.0) @@ -592,11 +584,6 @@ GEM simplecov simplecov-rcov (0.2.3) simplecov (>= 0.4.1) - sinatra (2.0.8.1) - mustermann (~> 1.0) - rack (~> 2.0) - rack-protection (= 2.0.8.1) - tilt (~> 2.0) spring (1.3.6) sprockets (3.7.2) concurrent-ruby (~> 1.0) @@ -686,7 +673,7 @@ DEPENDENCIES database_cleaner delayed_paperclip devise (~> 4.0) - devise-async! + devise-async devise-i18n factory_girl_rails fake_email_validator @@ -735,7 +722,6 @@ DEPENDENCIES simplecov simplecov-json simplecov-rcov - sinatra spring (~> 1.3.5) sweetalert-rails tiny-color-rails From 012d29cc20f2639322a292c055c147e2a46e4b3a Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 01:39:36 +0200 Subject: [PATCH 05/10] update devise-async to 1.0 --- config/initializers/devise_async.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/devise_async.rb b/config/initializers/devise_async.rb index 05a1852c..8f24c4a8 100644 --- a/config/initializers/devise_async.rb +++ b/config/initializers/devise_async.rb @@ -1 +1 @@ -Devise::Async.backend = :sidekiq +Devise::Async.enabled = true From a19402af413387aeac832d63a7980093b3eb7b04 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sun, 19 Apr 2020 00:45:50 +0100 Subject: [PATCH 06/10] Upgrade to Rails 5.2 --- Gemfile | 2 +- Gemfile.lock | 105 +++++++++--------- .../ajax/subscription_controller.rb | 2 +- app/controllers/application_controller.rb | 6 +- app/controllers/discover_controller.rb | 2 +- app/controllers/group_controller.rb | 2 +- app/controllers/inbox_controller.rb | 2 +- app/controllers/moderation_controller.rb | 2 +- app/controllers/notifications_controller.rb | 2 +- app/controllers/public_controller.rb | 2 +- app/controllers/user_controller.rb | 2 +- config/initializers/new_framework_defaults.rb | 5 - 12 files changed, 67 insertions(+), 67 deletions(-) diff --git a/Gemfile b/Gemfile index 1e9adae2..3e9c5879 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' source 'https://rails-assets.org' -gem 'rails', '~> 5.0.7', '>= 5.0.7.2' +gem 'rails', '~> 5.2' gem 'rails-i18n', '~> 5.0' gem 'i18n-js', '= 3.0.0.rc10' diff --git a/Gemfile.lock b/Gemfile.lock index 612e4bb5..ca0370a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,43 +9,47 @@ GEM remote: https://rails-assets.org/ specs: CFPropertyList (2.3.6) - actioncable (5.0.7.2) - actionpack (= 5.0.7.2) - nio4r (>= 1.2, < 3.0) - websocket-driver (~> 0.6.1) - actionmailer (5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) + actioncable (5.2.4.2) + actionpack (= 5.2.4.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.2) + actionpack (= 5.2.4.2) + actionview (= 5.2.4.2) + activejob (= 5.2.4.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.7.2) - actionview (= 5.0.7.2) - activesupport (= 5.0.7.2) - rack (~> 2.0) - rack-test (~> 0.6.3) + actionpack (5.2.4.2) + actionview (= 5.2.4.2) + activesupport (= 5.2.4.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.7.2) - activesupport (= 5.0.7.2) + actionview (5.2.4.2) + activesupport (= 5.2.4.2) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.7.2) - activesupport (= 5.0.7.2) + activejob (5.2.4.2) + activesupport (= 5.2.4.2) globalid (>= 0.3.6) - activemodel (5.0.7.2) - activesupport (= 5.0.7.2) + activemodel (5.2.4.2) + activesupport (= 5.2.4.2) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (5.0.7.2) - activemodel (= 5.0.7.2) - activesupport (= 5.0.7.2) - arel (~> 7.0) - activesupport (5.0.7.2) + activerecord (5.2.4.2) + activemodel (= 5.2.4.2) + activesupport (= 5.2.4.2) + arel (>= 9.0) + activestorage (5.2.4.2) + actionpack (= 5.2.4.2) + activerecord (= 5.2.4.2) + marcel (~> 0.3.1) + activesupport (5.2.4.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -54,7 +58,7 @@ GEM public_suffix (>= 2.0.2, < 5.0) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - arel (7.1.4) + arel (9.0.0) autoprefixer-rails (9.7.6) execjs bcrypt (3.1.13) @@ -135,7 +139,6 @@ GEM dry-inflector (0.2.0) equalizer (0.0.11) erubi (1.9.0) - erubis (2.7.0) excon (0.73.0) execjs (2.7.0) factory_girl (4.9.0) @@ -391,13 +394,15 @@ GEM lumberjack (1.2.4) mail (2.7.1) mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2019.1009) - mimemagic (0.3.0) + mimemagic (0.3.4) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0) @@ -437,12 +442,11 @@ GEM rack optimist (3.0.0) orm_adapter (0.5.0) - paperclip (4.3.7) + paperclip (4.2.4) activemodel (>= 3.2.0) activesupport (>= 3.2.0) cocaine (~> 0.5.5) mime-types - mimemagic (= 0.3.0) pg (1.2.3) pghero (2.4.2) activerecord (>= 5) @@ -462,19 +466,20 @@ GEM rack (>= 1.1) rack-protection (2.0.8.1) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.7.2) - actioncable (= 5.0.7.2) - actionmailer (= 5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) - activemodel (= 5.0.7.2) - activerecord (= 5.0.7.2) - activesupport (= 5.0.7.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.2) + actioncable (= 5.2.4.2) + actionmailer (= 5.2.4.2) + actionpack (= 5.2.4.2) + actionview (= 5.2.4.2) + activejob (= 5.2.4.2) + activemodel (= 5.2.4.2) + activerecord (= 5.2.4.2) + activestorage (= 5.2.4.2) + activesupport (= 5.2.4.2) bundler (>= 1.3.0) - railties (= 5.0.7.2) + railties (= 5.2.4.2) sprockets-rails (>= 2.0.0) rails-assets-growl (1.3.5) rails-assets-jquery @@ -499,12 +504,12 @@ GEM rails (>= 5.0, < 7) remotipart (~> 1.3) sassc-rails (>= 1.3, < 3) - railties (5.0.7.2) - actionpack (= 5.0.7.2) - activesupport (= 5.0.7.2) + railties (5.2.4.2) + actionpack (= 5.2.4.2) + activesupport (= 5.2.4.2) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) raindrops (0.19.1) rake (13.0.1) rb-fsevent (0.10.3) @@ -551,8 +556,8 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) + sass-rails (5.1.0) + railties (>= 5.2.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) @@ -642,7 +647,7 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) - websocket-driver (0.6.5) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) will_paginate (3.3.0) @@ -704,7 +709,7 @@ DEPENDENCIES poltergeist puma questiongenerator! - rails (~> 5.0.7, >= 5.0.7.2) + rails (~> 5.2) rails-assets-growl rails-assets-jquery (~> 2.2.0) rails-i18n (~> 5.0) diff --git a/app/controllers/ajax/subscription_controller.rb b/app/controllers/ajax/subscription_controller.rb index aaca19bb..746bcf48 100644 --- a/app/controllers/ajax/subscription_controller.rb +++ b/app/controllers/ajax/subscription_controller.rb @@ -1,5 +1,5 @@ class Ajax::SubscriptionController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! rescue_from(ActionController::ParameterMissing) do |param_miss_ex| @status = :parameter_error @message = I18n.t('messages.parameter_error', parameter: param_miss_ex.param.capitalize) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ef5ee974..ccc1e3f9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,9 +3,9 @@ class ApplicationController < ActionController::Base # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - before_filter :configure_permitted_parameters, if: :devise_controller? - before_filter :check_locale - before_filter :banned? + before_action :configure_permitted_parameters, if: :devise_controller? + before_action :check_locale + before_action :banned? # check if user wants to read def check_locale diff --git a/app/controllers/discover_controller.rb b/app/controllers/discover_controller.rb index 5d1490a5..dc553544 100644 --- a/app/controllers/discover_controller.rb +++ b/app/controllers/discover_controller.rb @@ -1,5 +1,5 @@ class DiscoverController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! def index top_x = 10 # only display the top X items diff --git a/app/controllers/group_controller.rb b/app/controllers/group_controller.rb index 7c3eb2c1..7fc45a42 100644 --- a/app/controllers/group_controller.rb +++ b/app/controllers/group_controller.rb @@ -1,5 +1,5 @@ class GroupController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! def index @group = current_user.groups.find_by_name!(params[:group_name]) diff --git a/app/controllers/inbox_controller.rb b/app/controllers/inbox_controller.rb index 63ffa80f..5b40b455 100644 --- a/app/controllers/inbox_controller.rb +++ b/app/controllers/inbox_controller.rb @@ -1,5 +1,5 @@ class InboxController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! def show @inbox = Inbox.where(user: current_user) diff --git a/app/controllers/moderation_controller.rb b/app/controllers/moderation_controller.rb index 98b62c5f..dd23ec67 100644 --- a/app/controllers/moderation_controller.rb +++ b/app/controllers/moderation_controller.rb @@ -1,5 +1,5 @@ class ModerationController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! def index @type = params[:type] diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 32861e64..8e824ebc 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -1,5 +1,5 @@ class NotificationsController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! def index @type = params[:type] diff --git a/app/controllers/public_controller.rb b/app/controllers/public_controller.rb index 9ea76e76..d5b8af94 100644 --- a/app/controllers/public_controller.rb +++ b/app/controllers/public_controller.rb @@ -1,5 +1,5 @@ class PublicController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! def index @timeline = Answer.joins(:user).where(users: { privacy_allow_public_timeline: true }).all.reverse_order.paginate(page: params[:page]) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 104062c6..acebb416 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,7 +1,7 @@ class UserController < ApplicationController include ThemeHelper - before_filter :authenticate_user!, only: %w(edit update edit_privacy update_privacy edit_theme update_theme preview_theme delete_theme data export begin_export) + before_action :authenticate_user!, only: %w(edit update edit_privacy update_privacy edit_theme update_theme preview_theme delete_theme data export begin_export) def show @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first! diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index f9fa1b88..9bbfaab6 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -6,8 +6,6 @@ # # Read the Guide for Upgrading Ruby on Rails for more info on each option. -Rails.application.config.action_controller.raise_on_unfiltered_parameters = true - # Enable per-form CSRF tokens. Previous versions had false. Rails.application.config.action_controller.per_form_csrf_tokens = false @@ -20,6 +18,3 @@ 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 = true# false - -# Do not halt callback chains when a callback returns false. Previous versions had true. -ActiveSupport.halt_callback_chains_on_return_false = true From b756c353451869cd64f0258138ef90cd0072a0d4 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 14:32:42 +0200 Subject: [PATCH 07/10] make capistrano work with ed25519 keys --- Gemfile | 5 +++++ Gemfile.lock | 10 ++++++++++ config/deploy.rb | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 3e9c5879..90b9c97f 100644 --- a/Gemfile +++ b/Gemfile @@ -87,6 +87,11 @@ end group :development do gem 'capistrano', '~> 3.8', require: false gem 'capistrano-rails', require: false + + gem 'rbnacl', '>= 3.2', '< 5.0', require: false + gem 'rbnacl-libsodium', require: false + gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0', require: false + gem 'ed25519', require: false end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index ca0370a9..aa98433f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -62,6 +62,7 @@ GEM autoprefixer-rails (9.7.6) execjs bcrypt (3.1.13) + bcrypt_pbkdf (1.0.1) better_errors (2.6.0) coderay (>= 1.0.0) erubi (>= 1.0.0) @@ -137,6 +138,7 @@ GEM domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dry-inflector (0.2.0) + ed25519 (1.2.4) equalizer (0.0.11) erubi (1.9.0) excon (0.73.0) @@ -515,6 +517,10 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) + rbnacl (4.0.2) + ffi + rbnacl-libsodium (1.0.16) + rbnacl (>= 3.0.1) rbvmomi (2.4.1) builder (~> 3.0) json (>= 1.8) @@ -663,6 +669,7 @@ PLATFORMS DEPENDENCIES bcrypt (~> 3.1.7) + bcrypt_pbkdf (>= 1.0, < 2.0) better_errors bootstrap-sass (~> 3.4.0) bootstrap3-datetimepicker-rails (~> 4.7.14) @@ -680,6 +687,7 @@ DEPENDENCIES devise (~> 4.0) devise-async devise-i18n + ed25519 factory_girl_rails fake_email_validator faker @@ -715,6 +723,8 @@ DEPENDENCIES rails-i18n (~> 5.0) rails_admin rake + rbnacl (>= 3.2, < 5.0) + rbnacl-libsodium redcarpet redis rollbar diff --git a/config/deploy.rb b/config/deploy.rb index f7c6ebd1..2cf3bb7b 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,5 +1,5 @@ # config valid only for current version of Capistrano -lock "3.8.0" +lock "3.13.0" set :application, "retrospring" set :repo_url, "git@git.rrerr.net:nilsding/retrospring.git" From 76f4ec35e2b2bb1456e3ed4dc7435dd3e519e34f Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 14:39:59 +0200 Subject: [PATCH 08/10] get rid of "Fixnum is deprecated" warning --- app/helpers/theme_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/theme_helper.rb b/app/helpers/theme_helper.rb index 06a1ff39..1202588c 100644 --- a/app/helpers/theme_helper.rb +++ b/app/helpers/theme_helper.rb @@ -23,7 +23,7 @@ module ThemeHelper end elsif hash.is_a? Hash hash.each do |k, v| - next unless v.is_a? Fixnum + next unless v.is_a? Integer self.instance_variable_set "@#{k}", ('#' + ('0000000' + hash[k].to_s(16))[-6, 6]) end From 958fa30f6b2052b467706a669f268ac366e470dc Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 14:59:50 +0200 Subject: [PATCH 09/10] Use Ruby 2.7.1 --- .docker/ruby/Dockerfile | 4 ++-- .ruby-version | 2 +- Gemfile.lock | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.docker/ruby/Dockerfile b/.docker/ruby/Dockerfile index 226b4994..0b7cdad3 100644 --- a/.docker/ruby/Dockerfile +++ b/.docker/ruby/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.6 +FROM ruby:2.7 RUN apt-get update -qq && apt-get install -y build-essential @@ -27,4 +27,4 @@ WORKDIR $APP_HOME ADD Gemfile* $APP_HOME/ RUN bundle install -EXPOSE 3000 \ No newline at end of file +EXPOSE 3000 diff --git a/.ruby-version b/.ruby-version index 338a5b5d..860487ca 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.6 +2.7.1 diff --git a/Gemfile.lock b/Gemfile.lock index aa98433f..5f212824 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -751,4 +751,4 @@ DEPENDENCIES will_paginate-bootstrap BUNDLED WITH - 1.17.3 + 2.1.4 From b7d1c80ff0f4757235106b4f9e81f56e7a3389cf Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 19 Apr 2020 15:00:50 +0200 Subject: [PATCH 10/10] remove rollbar queue, use mailers queue for mail stuff --- config/sidekiq.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/sidekiq.yml b/config/sidekiq.yml index f504264e..6da98de3 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -8,9 +8,8 @@ production: :queues: - share - paperclip - - mailer + - mailers - deletion - - rollbar - question - export