Upgrade to rails 6.1

This commit is contained in:
Benjamin Neff 2022-07-17 02:09:38 +02:00
parent 1ef3c83a0a
commit fe84d3e101
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
15 changed files with 144 additions and 99 deletions

View file

@ -2,7 +2,7 @@
source "https://rubygems.org"
gem "rails", "6.0.5.1"
gem "rails", "6.1.6.1"
# Legacy Rails features, remove me!
# responders (class level)

View file

@ -2,38 +2,40 @@ GEM
remote: https://rubygems.org/
remote: https://gems.diasporafoundation.org/
specs:
actioncable (6.0.5.1)
actionpack (= 6.0.5.1)
actioncable (6.1.6.1)
actionpack (= 6.1.6.1)
activesupport (= 6.1.6.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.5.1)
actionpack (= 6.0.5.1)
activejob (= 6.0.5.1)
activerecord (= 6.0.5.1)
activestorage (= 6.0.5.1)
activesupport (= 6.0.5.1)
actionmailbox (6.1.6.1)
actionpack (= 6.1.6.1)
activejob (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
mail (>= 2.7.1)
actionmailer (6.0.5.1)
actionpack (= 6.0.5.1)
actionview (= 6.0.5.1)
activejob (= 6.0.5.1)
actionmailer (6.1.6.1)
actionpack (= 6.1.6.1)
actionview (= 6.1.6.1)
activejob (= 6.1.6.1)
activesupport (= 6.1.6.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.5.1)
actionview (= 6.0.5.1)
activesupport (= 6.0.5.1)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.6.1)
actionview (= 6.1.6.1)
activesupport (= 6.1.6.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.5.1)
actionpack (= 6.0.5.1)
activerecord (= 6.0.5.1)
activestorage (= 6.0.5.1)
activesupport (= 6.0.5.1)
actiontext (6.1.6.1)
actionpack (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
nokogiri (>= 1.8.5)
actionview (6.0.5.1)
activesupport (= 6.0.5.1)
actionview (6.1.6.1)
activesupport (= 6.1.6.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@ -41,27 +43,29 @@ GEM
active_model_serializers (0.9.8)
activemodel (>= 3.2)
concurrent-ruby (~> 1.0)
activejob (6.0.5.1)
activesupport (= 6.0.5.1)
activejob (6.1.6.1)
activesupport (= 6.1.6.1)
globalid (>= 0.3.6)
activemodel (6.0.5.1)
activesupport (= 6.0.5.1)
activerecord (6.0.5.1)
activemodel (= 6.0.5.1)
activesupport (= 6.0.5.1)
activemodel (6.1.6.1)
activesupport (= 6.1.6.1)
activerecord (6.1.6.1)
activemodel (= 6.1.6.1)
activesupport (= 6.1.6.1)
activerecord-import (1.4.0)
activerecord (>= 4.2)
activestorage (6.0.5.1)
actionpack (= 6.0.5.1)
activejob (= 6.0.5.1)
activerecord (= 6.0.5.1)
activestorage (6.1.6.1)
actionpack (= 6.1.6.1)
activejob (= 6.1.6.1)
activerecord (= 6.1.6.1)
activesupport (= 6.1.6.1)
marcel (~> 1.0)
activesupport (6.0.5.1)
mini_mime (>= 1.1.0)
activesupport (6.1.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
acts-as-taggable-on (8.1.0)
activerecord (>= 5.0, < 6.2)
acts_as_api (1.0.1)
@ -515,20 +519,20 @@ GEM
rack
rack-test (2.0.2)
rack (>= 1.3)
rails (6.0.5.1)
actioncable (= 6.0.5.1)
actionmailbox (= 6.0.5.1)
actionmailer (= 6.0.5.1)
actionpack (= 6.0.5.1)
actiontext (= 6.0.5.1)
actionview (= 6.0.5.1)
activejob (= 6.0.5.1)
activemodel (= 6.0.5.1)
activerecord (= 6.0.5.1)
activestorage (= 6.0.5.1)
activesupport (= 6.0.5.1)
bundler (>= 1.3.0)
railties (= 6.0.5.1)
rails (6.1.6.1)
actioncable (= 6.1.6.1)
actionmailbox (= 6.1.6.1)
actionmailer (= 6.1.6.1)
actionpack (= 6.1.6.1)
actiontext (= 6.1.6.1)
actionview (= 6.1.6.1)
activejob (= 6.1.6.1)
activemodel (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
bundler (>= 1.15.0)
railties (= 6.1.6.1)
sprockets-rails (>= 2.0.0)
rails-assets-autosize (4.0.2)
rails-assets-backbone (1.3.3)
@ -592,12 +596,12 @@ GEM
rails-timeago (2.20.0)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (6.0.5.1)
actionpack (= 6.0.5.1)
activesupport (= 6.0.5.1)
railties (6.1.6.1)
actionpack (= 6.1.6.1)
activesupport (= 6.1.6.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.1.1)
raindrops (0.20.0)
rake (12.3.3)
@ -741,8 +745,8 @@ GEM
unf (~> 0.1.0)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.9)
thread_safe (~> 0.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
@ -865,7 +869,7 @@ DEPENDENCIES
rack-piwik (= 0.3.0)
rack-rewrite (= 1.5.1)
rack-ssl (= 1.4.1)
rails (= 6.0.5.1)
rails (= 6.1.6.1)
rails-assets-autosize (= 4.0.2)!
rails-assets-backbone (= 1.3.3)!
rails-assets-blueimp-gallery (= 2.33.0)!

View file

@ -1,4 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
require_relative "../config/boot"
require "rails/commands"

View file

@ -1,4 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
require_relative "../config/boot"
require "rake"
Rake.application.run

View file

@ -1,5 +1,5 @@
#!/usr/bin/env ruby
require 'fileutils'
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
@ -9,8 +9,8 @@ def system!(*args)
end
FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='

View file

@ -6,7 +6,7 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path("../config/environment", __FILE__)
require_relative "config/environment"
# Kill unicorn workers really aggressively (at 300mb)
if defined?(Unicorn)
@ -18,4 +18,5 @@ if defined?(Unicorn)
end
use Rack::Deflater
run Diaspora::Application
run Rails.application
Rails.application.load_server

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true
require_relative 'boot'
require_relative "boot"
require 'rails/all'
require "rails/all"
require_relative "bundler_helper"
@ -16,16 +16,19 @@ require_relative 'asset_sync'
module Diaspora
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.load_defaults 6.1
# Use classic autoloader for now
config.autoloader = :classic
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W[#{config.root}/app]
config.autoload_once_paths += %W[#{config.root}/lib]
@ -58,8 +61,6 @@ module Diaspora
}
config.action_mailer.asset_host = AppConfig.pod_uri.to_s
config.action_view.raise_on_missing_translations = true
config.middleware.use Rack::OAuth2::Server::Resource::Bearer, "OpenID Connect" do |req|
Api::OpenidConnect::OAuthAccessToken
.valid(Time.zone.now.utc).find_by(token: req.access_token) || req.invalid_token!

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# Load the Rails application.
require_relative 'application'
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!

View file

@ -1,10 +1,12 @@
# frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
@ -41,6 +43,12 @@ Rails.application.configure do
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
@ -62,12 +70,18 @@ Rails.application.configure do
config.show_log_configuration = true
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = 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
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
# Allow the host configured in the diaspora.toml to access the development server
config.hosts << AppConfig.pod_uri.host

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@ -32,12 +34,9 @@ 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
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
if AppConfig.environment.assets.host.present?
config.action_controller.asset_host = AppConfig.environment.assets.host.get
config.asset_host = AppConfig.environment.assets.host.get
end
# Specifies the header that your server uses for sending files.
@ -55,7 +54,8 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Log level
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Prepend all log lines with the following tags.
@ -87,11 +87,17 @@ Rails.application.configure do
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# 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'
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
# if ENV["RAILS_LOG_TO_STDOUT"].present?

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/integer/time"
# 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
@ -60,11 +62,20 @@ Rails.application.configure do
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Set the logging destination(s)
config.log_to = %w[file]
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# for fixture_builder
ENV["FIXTURES_PATH"] = "spec/fixtures"

View file

@ -25,4 +25,9 @@ Rails.application.config.assets.version = "1.0"
# Add Yarn node_modules folder to the asset load path.
# Rails.application.config.assets.paths << Rails.root.join("node_modules")
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
Rails.application.config.public_file_server.enabled = AppConfig.environment.assets.serve?

View file

@ -2,7 +2,8 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]

View file

@ -3,4 +3,6 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += %i[password otp_attempt message text bio]
Rails.application.config.filter_parameters += %i[
password passw secret token _key crypt salt certificate otp otp_attempt ssn message text bio
]

View file

@ -48,9 +48,9 @@ describe ApplicationHelper, :type => :helper do
end
it "returns false if the service is already connected" do
@current_user.services << FactoryGirl.build(:service, provider: "service")
expect(AppConfig).to receive(:show_service?).with("service", alice).and_return(true)
expect(service_unconnected?("service")).to be false
@current_user.services << FactoryGirl.build(:service)
expect(AppConfig).to receive(:show_service?).with("twitter", alice).and_return(true)
expect(service_unconnected?("twitter")).to be false
end
it "returns false if the the service shouldn't be shown" do