Remove support for Ruby 2.6 (#21477)
As pointed out by https://github.com/mastodon/mastodon/pull/21297#discussion_r1028372193 at least one of our dependencies already dropped support for Ruby 2.6, and we had removed Ruby 2.6 tests from the CI over a year ago (#16861). So stop advertising Ruby 2.6 support, bump targeted version, and drop some compatibility code.
This commit is contained in:
		@@ -2,7 +2,7 @@ require:
 | 
				
			|||||||
  - rubocop-rails
 | 
					  - rubocop-rails
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AllCops:
 | 
					AllCops:
 | 
				
			||||||
  TargetRubyVersion: 2.5
 | 
					  TargetRubyVersion: 2.7
 | 
				
			||||||
  NewCops: disable
 | 
					  NewCops: disable
 | 
				
			||||||
  Exclude:
 | 
					  Exclude:
 | 
				
			||||||
    - 'spec/**/*'
 | 
					    - 'spec/**/*'
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Gemfile
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
				
			|||||||
# frozen_string_literal: true
 | 
					# frozen_string_literal: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
source 'https://rubygems.org'
 | 
					source 'https://rubygems.org'
 | 
				
			||||||
ruby '>= 2.6.0', '< 3.1.0'
 | 
					ruby '>= 2.7.0', '< 3.1.0'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gem 'pkg-config', '~> 1.4'
 | 
					gem 'pkg-config', '~> 1.4'
 | 
				
			||||||
gem 'rexml', '~> 3.2'
 | 
					gem 'rexml', '~> 3.2'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ Mastodon acts as an OAuth2 provider, so 3rd party apps can use the REST and Stre
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
- **PostgreSQL** 9.5+
 | 
					- **PostgreSQL** 9.5+
 | 
				
			||||||
- **Redis** 4+
 | 
					- **Redis** 4+
 | 
				
			||||||
- **Ruby** 2.6+
 | 
					- **Ruby** 2.7+
 | 
				
			||||||
- **Node.js** 14+
 | 
					- **Node.js** 14+
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The repository includes deployment configurations for **Docker and docker-compose** as well as specific platforms like **Heroku**, **Scalingo**, and **Nanobox**. The [**standalone** installation guide](https://docs.joinmastodon.org/admin/install/) is available in the documentation.
 | 
					The repository includes deployment configurations for **Docker and docker-compose** as well as specific platforms like **Heroku**, **Scalingo**, and **Nanobox**. The [**standalone** installation guide](https://docs.joinmastodon.org/admin/install/) is available in the documentation.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,6 @@ require 'mail'
 | 
				
			|||||||
Bundler.require(*Rails.groups)
 | 
					Bundler.require(*Rails.groups)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require_relative '../lib/exceptions'
 | 
					require_relative '../lib/exceptions'
 | 
				
			||||||
require_relative '../lib/enumerable'
 | 
					 | 
				
			||||||
require_relative '../lib/sanitize_ext/sanitize_config'
 | 
					require_relative '../lib/sanitize_ext/sanitize_config'
 | 
				
			||||||
require_relative '../lib/redis/namespace_extensions'
 | 
					require_relative '../lib/redis/namespace_extensions'
 | 
				
			||||||
require_relative '../lib/paperclip/url_generator_extensions'
 | 
					require_relative '../lib/paperclip/url_generator_extensions'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,26 +0,0 @@
 | 
				
			|||||||
# frozen_string_literal: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module Enumerable
 | 
					 | 
				
			||||||
  # TODO: Remove this once stop to support Ruby 2.6
 | 
					 | 
				
			||||||
  if RUBY_VERSION < '2.7.0'
 | 
					 | 
				
			||||||
    def filter_map
 | 
					 | 
				
			||||||
      if block_given?
 | 
					 | 
				
			||||||
        result = []
 | 
					 | 
				
			||||||
        each do |element|
 | 
					 | 
				
			||||||
          res = yield element
 | 
					 | 
				
			||||||
          result << res if res
 | 
					 | 
				
			||||||
        end
 | 
					 | 
				
			||||||
        result
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        Enumerator.new do |yielder|
 | 
					 | 
				
			||||||
          result = []
 | 
					 | 
				
			||||||
          each do |element|
 | 
					 | 
				
			||||||
            res = yielder.yield element
 | 
					 | 
				
			||||||
            result << res if res
 | 
					 | 
				
			||||||
          end
 | 
					 | 
				
			||||||
          result
 | 
					 | 
				
			||||||
        end
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user