Remove support for ruby 2.1, 2.2, 2.3 and 2.4, add 2.6 instead

all older than 2.3 are already EOL and 2.4 will be EOL soon and the next
diaspora major version will already depend on newer versions, so we can
already remove it now.
This commit is contained in:
Benjamin Neff 2019-10-19 01:38:49 +02:00
parent 4b4375cf78
commit 68df3cf555
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
10 changed files with 10 additions and 19 deletions

View file

@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.1
TargetRubyVersion: 2.5
Exclude:
- "bin/**/*"
- "test/dummy/bin/**/*"

View file

@ -1 +1 @@
2.4
2.6

View file

@ -1,20 +1,12 @@
language: ruby
rvm:
- 2.5.5
- 2.4.5
- 2.3.8
- 2.2.10
- 2.1
- 2.6.5
- 2.5.7
gemfile:
- Gemfile
- test/gemfiles/no-rails.Gemfile
matrix:
exclude:
- rvm: 2.1
gemfile: Gemfile
sudo: false
cache:
bundler: true

View file

@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.files = Dir["app/**/*", "config/routes.rb", "config/initializers/*",
"lib/diaspora_federation/{engine,rails}.rb", "LICENSE", "README.md", "Changelog.md"]
s.required_ruby_version = "~> 2.1"
s.required_ruby_version = "~> 2.5"
s.add_dependency "actionpack", ">= 5", "< 6"

View file

@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.files = Dir["lib/diaspora_federation/test.rb", "lib/diaspora_federation/test/*"]
s.required_ruby_version = "~> 2.1"
s.required_ruby_version = "~> 2.5"
s.add_dependency "diaspora_federation", DiasporaFederation::VERSION
s.add_dependency "fabrication", "~> 2.16"

View file

@ -22,7 +22,7 @@ Gem::Specification.new do |s|
"lib/diaspora_federation/test/*",
"lib/tasks/*.rake"]
s.required_ruby_version = "~> 2.1"
s.required_ruby_version = "~> 2.5"
s.add_dependency "faraday", ">= 0.9.0", "< 0.16.0"
s.add_dependency "faraday_middleware", ">= 0.10.0", "< 0.14.0"

View file

@ -43,7 +43,7 @@ module DiasporaFederation
# Returns diaspora* ID of the new person identity.
# @return [String] diaspora* ID of the new person identity
def new_identity
profile.author if profile
profile&.author
end
# @return [String] string representation of this object

View file

@ -35,7 +35,7 @@ module DiasporaFederation
# Validates that the parent exists and the parent author is local
def validate_parent
parent = DiasporaFederation.callbacks.trigger(:fetch_related_entity, parent_type, parent_guid)
raise ParentNotLocal, "obj=#{self}" unless parent && parent.local
raise ParentNotLocal, "obj=#{self}" unless parent&.local
end
# Validate that the parent is local.

View file

@ -20,7 +20,7 @@ module Validation
return true if value.nil? || (value.is_a?(String) && value.empty?)
return true if value.is_a? Date
if value =~ /[0-9]{4}\-[0-9]{2}\-[0-9]{2}/
if value.is_a?(String) && value.match?(/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/)
date_field = value.split("-").map(&:to_i)
return Date.valid_civil?(date_field[0], date_field[1], date_field[2])
end

View file

@ -8,7 +8,6 @@ namespace :gemfiles do
original_gemfile.sub!(/(gemspec name:.*)/) { "#{Regexp.last_match[1]}, path: \"../../\"" }
original_gemfile.sub!(/(gemspec\(name:.*)\)/) { "#{Regexp.last_match[1]}, path: \"../../\")" }
original_gemfile.sub!(/^group :development do$.*?^end$\n\n/m, "")
original_gemfile << "\n gem \"fabrication\", \"< 2.17.0\"\n" # new versions are not compatible with ruby 2.1
no_rails_gemfile = original_gemfile.dup
no_rails_gemfile.sub!(/(gemspec\(name:.*)/) { "#{Regexp.last_match[1]} unless plugin == \"rails\"" }