DEV: pull static check out of loop

* followup to 08b28680
* as per https://review.discourse.org/t/4713/2
This commit is contained in:
Michael Brown 2019-07-23 12:41:57 -04:00 committed by Michael Brown
parent 8b5f44a9a7
commit 31f583855a
1 changed files with 5 additions and 2 deletions

View File

@ -11,6 +11,11 @@ module BackupRestore
attr_reader :success attr_reader :success
def self.pg_produces_portable_dump?(version) def self.pg_produces_portable_dump?(version)
# anything pg 11 or above will produce a non-portable dump
return false if version.to_i >= 11
# below 11, the behaviour was changed in multiple different minor
# versions depending on major release line - we list those versions below
gem_version = Gem::Version.new(version) gem_version = Gem::Version.new(version)
%w{ %w{
@ -20,8 +25,6 @@ module BackupRestore
9.4.17 9.4.17
9.3.22 9.3.22
}.each do |unportable_version| }.each do |unportable_version|
# anything pg 11 or above will produce a non-portable dump
return false if version.to_i >= 11
return false if Gem::Dependency.new("", "~> #{unportable_version}").match?("", gem_version) return false if Gem::Dependency.new("", "~> #{unportable_version}").match?("", gem_version)
end end