Skip to content

Commit

Permalink
Merge branch 'rails6/upgrade' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Sep 29, 2021
2 parents d7ec8b9 + 02ea505 commit 970f75f
Show file tree
Hide file tree
Showing 26 changed files with 149 additions and 231 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ source 'https://rubygems.org'

# See instructions in Gemfile.rails_next
def rails_upgrade?
%w[1 true].include?(ENV['RAILS_UPGRADE'])
true
end

gem 'rails', rails_upgrade? ? '~> 6.0.3' : '~> 5.2.4'
gem 'nio4r', rails_upgrade? ? nil : '< 2.5.3'

gem 'pg', '~> 1.2.3'

Expand Down
147 changes: 81 additions & 66 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,61 +40,74 @@ PATH
flipper (~> 0.10)
flipper-active_record (~> 0.10)
mime-types (< 3.0.0)
rails (~> 5.2.4)
rails (~> 6.0.3)

GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.6)
actionpack (= 5.2.6)
actioncable (6.0.4.1)
actionpack (= 6.0.4.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
actionmailbox (6.0.4.1)
actionpack (= 6.0.4.1)
activejob (= 6.0.4.1)
activerecord (= 6.0.4.1)
activestorage (= 6.0.4.1)
activesupport (= 6.0.4.1)
mail (>= 2.7.1)
actionmailer (6.0.4.1)
actionpack (= 6.0.4.1)
actionview (= 6.0.4.1)
activejob (= 6.0.4.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.6)
actionview (= 5.2.6)
activesupport (= 5.2.6)
actionpack (6.0.4.1)
actionview (= 6.0.4.1)
activesupport (= 6.0.4.1)
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.2.6)
activesupport (= 5.2.6)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.4.1)
actionpack (= 6.0.4.1)
activerecord (= 6.0.4.1)
activestorage (= 6.0.4.1)
activesupport (= 6.0.4.1)
nokogiri (>= 1.8.5)
actionview (6.0.4.1)
activesupport (= 6.0.4.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_otp (2.3.0)
activemodel
rotp (~> 6.2.0)
activejob (5.2.6)
activesupport (= 5.2.6)
activejob (6.0.4.1)
activesupport (= 6.0.4.1)
globalid (>= 0.3.6)
activemodel (5.2.6)
activesupport (= 5.2.6)
activerecord (5.2.6)
activemodel (= 5.2.6)
activesupport (= 5.2.6)
arel (>= 9.0)
activestorage (5.2.6)
actionpack (= 5.2.6)
activerecord (= 5.2.6)
activemodel (6.0.4.1)
activesupport (= 6.0.4.1)
activerecord (6.0.4.1)
activemodel (= 6.0.4.1)
activesupport (= 6.0.4.1)
activestorage (6.0.4.1)
actionpack (= 6.0.4.1)
activejob (= 6.0.4.1)
activerecord (= 6.0.4.1)
marcel (~> 1.0.0)
activesupport (5.2.6)
activesupport (6.0.4.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
annotate (3.1.0)
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 14.0)
arel (9.0.0)
ast (2.4.2)
bcrypt (3.1.16)
bindex (0.7.0)
Expand Down Expand Up @@ -148,21 +161,21 @@ GEM
fast_gettext (2.1.0)
ffi (1.15.3)
fivemat (1.3.7)
flipper (0.17.2)
flipper-active_record (0.17.2)
flipper (0.22.1)
flipper-active_record (0.22.1)
activerecord (>= 4.2, < 7)
flipper (~> 0.17.2)
flipper (~> 0.22.1)
gender_detector (2.0.0)
gettext (3.4.1)
locale (>= 2.0.5)
text (>= 1.3.0)
gettext_i18n_rails (1.8.1)
fast_gettext (>= 0.9.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
globalize (5.2.0)
activemodel (>= 4.2, < 5.3)
activerecord (>= 4.2, < 5.3)
globalid (0.5.2)
activesupport (>= 5.0)
globalize (5.3.1)
activemodel (>= 4.2, < 6.1)
activerecord (>= 4.2, < 6.1)
request_store (~> 1.0)
gnuplot (2.6.2)
hashdiff (1.0.1)
Expand Down Expand Up @@ -190,7 +203,7 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
locale (2.1.3)
loofah (2.11.0)
loofah (2.12.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mahoro (0.5)
Expand All @@ -201,7 +214,7 @@ GEM
method_source (1.0.0)
mime-types (2.99.3)
mini_magick (4.11.0)
mini_mime (1.1.0)
mini_mime (1.1.1)
mini_portile2 (2.6.1)
mini_racer (0.4.0)
libv8-node (~> 15.14.0.0)
Expand All @@ -216,7 +229,7 @@ GEM
net-ssh (6.1.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
nio4r (2.5.2)
nio4r (2.5.8)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
Expand All @@ -243,18 +256,20 @@ GEM
rack (>= 1.0, < 3)
rack-utf8_sanitizer (1.7.0)
rack (>= 1.0, < 3.0)
rails (5.2.6)
actioncable (= 5.2.6)
actionmailer (= 5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
activemodel (= 5.2.6)
activerecord (= 5.2.6)
activestorage (= 5.2.6)
activesupport (= 5.2.6)
rails (6.0.4.1)
actioncable (= 6.0.4.1)
actionmailbox (= 6.0.4.1)
actionmailer (= 6.0.4.1)
actionpack (= 6.0.4.1)
actiontext (= 6.0.4.1)
actionview (= 6.0.4.1)
activejob (= 6.0.4.1)
activemodel (= 6.0.4.1)
activerecord (= 6.0.4.1)
activestorage (= 6.0.4.1)
activesupport (= 6.0.4.1)
bundler (>= 1.3.0)
railties (= 5.2.6)
railties (= 6.0.4.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
Expand All @@ -263,17 +278,17 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
rails-i18n (5.1.3)
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (5.2.6)
actionpack (= 5.2.6)
activesupport (= 5.2.6)
railties (>= 6.0.0, < 7)
railties (6.0.4.1)
actionpack (= 6.0.4.1)
activesupport (= 6.0.4.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (13.0.6)
rb-fsevent (0.11.0)
Expand All @@ -282,7 +297,7 @@ GEM
recaptcha (5.8.1)
json
regexp_parser (2.1.1)
request_store (1.4.1)
request_store (1.5.0)
rack (>= 1.4)
rexml (3.2.5)
rolify (5.3.0)
Expand Down Expand Up @@ -333,8 +348,8 @@ GEM
ruby-progressbar (1.11.0)
rubyzip (2.3.2)
sass (3.4.25)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass-rails (5.0.8)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
Expand Down Expand Up @@ -363,7 +378,7 @@ GEM
rack (>= 1, < 3)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.8)
tilt (2.0.10)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
Expand All @@ -382,7 +397,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.3)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
will_paginate (3.3.1)
Expand All @@ -391,6 +406,7 @@ GEM
rexml
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
zip_tricks (5.6.0)

PLATFORMS
Expand Down Expand Up @@ -418,7 +434,7 @@ DEPENDENCIES
gender_detector (~> 2.0.0)
gettext (~> 3.4.1)
gettext_i18n_rails (~> 1.8.1)
globalize (~> 5.2.0)
globalize (~> 5.3.0)
gnuplot (~> 2.6.0)
holidays (~> 8.4.1)
htmlentities (~> 4.3.0)
Expand All @@ -440,7 +456,6 @@ DEPENDENCIES
money (~> 6.16.0)
net-ssh (~> 6.1.0)
net-ssh-gateway (>= 1.1.0, < 3.0.0)
nio4r (< 2.5.3)
nokogiri (~> 1.12.5)
oink (~> 0.10.1)
open4 (~> 1.3.0)
Expand All @@ -450,9 +465,9 @@ DEPENDENCIES
rack (~> 2.2.3)
rack-ssl (~> 1.4.0)
rack-utf8_sanitizer (~> 1.7.0)
rails (~> 5.2.4)
rails (~> 6.0.3)
rails-controller-testing
rails-i18n (~> 5.1.0)
rails-i18n (~> 6.0.0)
recaptcha (~> 5.8.1)
rolify (~> 5.3.0)
routing-filter (~> 0.6.2)
Expand All @@ -463,7 +478,7 @@ DEPENDENCIES
rubocop-rails
ruby-msg (~> 1.5.0)!
rubyzip (~> 2.3.2)
sass-rails (~> 5.0.7)
sass-rails (~> 5.0.8)
secure_headers (~> 6.3.3)
simplecov (~> 0.17.1)
simplecov-lcov (~> 0.7.0)
Expand Down
1 change: 0 additions & 1 deletion Gemfile.rails_next.lock
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ DEPENDENCIES
money (~> 6.16.0)
net-ssh (~> 6.1.0)
net-ssh-gateway (>= 1.1.0, < 3.0.0)
nio4r
nokogiri (~> 1.12.5)
oink (~> 0.10.1)
open4 (~> 1.3.0)
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ def show_as_html
}
)

html = if rails_upgrade?
@incoming_message.apply_masks(html, response.media_type)
else
@incoming_message.apply_masks(html, response.content_type)
end
html = @incoming_message.apply_masks(html, response.media_type)

render html: html.html_safe
end
Expand Down
10 changes: 2 additions & 8 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
# require 'rails/test_unit/railtie'

require File.dirname(__FILE__) + '/../lib/configuration'
require File.dirname(__FILE__) + '/../lib/alaveteli_localization'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

def rails_upgrade?
%w[1 true].include?(ENV['RAILS_UPGRADE'])
true
end

module Alaveteli
Expand Down Expand Up @@ -104,12 +105,5 @@ class Application < Rails::Application
if AlaveteliConfiguration::force_ssl
config.action_mailer.default_url_options[:protocol] = "https"
end

config.after_initialize do
AlaveteliLocalization.set_locales(
AlaveteliConfiguration.available_locales,
AlaveteliConfiguration.default_locale
)
end
end
end
4 changes: 1 addition & 3 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
if rails_upgrade?
config.action_controller.enable_fragment_cache_logging = true
end
config.action_controller.enable_fragment_cache_logging = true

config.cache_store = :memory_store
config.public_file_server.headers = {
Expand Down
4 changes: 0 additions & 4 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Compress JavaScripts and CSS.
unless rails_upgrade?
config.assets.js_compressor =
Uglifier.new(harmony: true, mangle: false, compress: false)
end
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store if rails_upgrade?
config.cache_store = :null_store

# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
Expand Down
Loading

0 comments on commit 970f75f

Please sign in to comment.