From 0cd28f373a245eca4e717bff1415b97bbc2356d2 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 14 Jun 2019 14:00:54 -0500 Subject: [PATCH] Revert "[close #1811] Minimum Ruby version >= 2.5" --- .rubocop.yml | 2 +- .travis.yml | 9 ++++++++- History.md | 1 - lib/puma/binder.rb | 4 ++-- lib/puma/configuration.rb | 2 +- lib/puma/server.rb | 2 +- puma.gemspec | 5 +---- test/shell/t1.rb | 2 +- test/test_integration.rb | 2 +- test/test_persistent.rb | 2 +- win_gem_test/puma.ps1 | 2 +- 11 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index cfa17fa7..ca4bdf59 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ AllCops: DisabledByDefault: true - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.2 DisplayCopNames: true StyleGuideCopsOnly: false Exclude: diff --git a/.travis.yml b/.travis.yml index db493449..53302eab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ before_install: r_eng="$(ruby -e 'STDOUT.write RUBY_ENGINE')"; rv="$(ruby -e 'STDOUT.write RUBY_VERSION')"; if [ "$r_eng" == "ruby" ]; then - if [ "$rv" \< "2.6" ]; then gem update --system --no-document --conservative + if [ "$rv" \< "2.3" ]; then gem update --system 2.7.9 --no-document + elif [ "$rv" \< "2.6" ]; then gem update --system --no-document --conservative fi fi if [ "$TRAVIS_OS_NAME" == "osx" ]; then @@ -24,6 +25,9 @@ script: - bundle exec rake rvm: + - 2.2.10 + - 2.3.8 + - 2.4.6 - 2.5.5 - 2.6.3 - ruby-head @@ -33,6 +37,9 @@ matrix: include: - rvm: ruby-head env: RUBYOPT="--jit" + - rvm: 2.4.6 + os: osx + osx_image: xcode10.2 - rvm: 2.5.5 os: osx osx_image: xcode10.2 diff --git a/History.md b/History.md index 0914868a..b71b4cd0 100644 --- a/History.md +++ b/History.md @@ -9,7 +9,6 @@ * Add option to suppress SignalException on SIGTERM (#1690) * Allow mutual TLS CA to be set using `ssl_bind` DSL (#1689) * Reactor now uses nio4r instead of `select` (#1728) - * Minimum Ruby version now >= 2.5 (#1813) * x bugfixes * Do not accept new requests on shutdown (#1685, #1808) * Fix 3 corner cases when request body is chunked (#1508) diff --git a/lib/puma/binder.rb b/lib/puma/binder.rb index 34278cb2..42843b91 100644 --- a/lib/puma/binder.rb +++ b/lib/puma/binder.rb @@ -63,7 +63,7 @@ module Puma remove = [] ENV.each do |k,v| - if /PUMA_INHERIT_\d+/.match?(k) + if k =~ /PUMA_INHERIT_\d+/ fd, url = v.split(":", 2) @inherited_fds[url] = fd.to_i remove << k @@ -75,7 +75,7 @@ module Puma key = [ :unix, Socket.unpack_sockaddr_un(sock.getsockname) ] rescue ArgumentError port, addr = Socket.unpack_sockaddr_in(sock.getsockname) - if /\:/.match?(addr) + if addr =~ /\:/ addr = "[#{addr}]" end key = [ :tcp, addr, port ] diff --git a/lib/puma/configuration.rb b/lib/puma/configuration.rb index 877e3e0e..900a0105 100644 --- a/lib/puma/configuration.rb +++ b/lib/puma/configuration.rb @@ -348,7 +348,7 @@ module Puma end if bytes - token = +"" + token = "".dup bytes.each_byte { |b| token << b.to_s(16) } else token = (0..count).to_a.map { rand(255).to_s(16) }.join diff --git a/lib/puma/server.rb b/lib/puma/server.rb index 150458ec..ac1e2867 100644 --- a/lib/puma/server.rb +++ b/lib/puma/server.rb @@ -105,7 +105,7 @@ module Puma # On Linux, use TCP_CORK to better control how the TCP stack # packetizes our stream. This improves both latency and throughput. # - if RUBY_PLATFORM.match?(/linux/) + if RUBY_PLATFORM =~ /linux/ UNPACK_TCP_STATE_FROM_TCP_INFO = "C".freeze # 6 == Socket::IPPROTO_TCP diff --git a/puma.gemspec b/puma.gemspec index 49b1ae3c..b11ffec0 100644 --- a/puma.gemspec +++ b/puma.gemspec @@ -17,8 +17,5 @@ Gem::Specification.new do |s| %w[History.md LICENSE README.md] s.homepage = "http://puma.io" s.license = "BSD-3-Clause" - - # We will guarantee to support the last 2 major releases, - # and may choose to support further back as we see fit. - s.required_ruby_version = Gem::Requirement.new(">= 2.5") + s.required_ruby_version = Gem::Requirement.new(">= 2.2") end diff --git a/test/shell/t1.rb b/test/shell/t1.rb index 907a238e..25c523e4 100644 --- a/test/shell/t1.rb +++ b/test/shell/t1.rb @@ -11,7 +11,7 @@ log = File.read("t1-stdout") File.unlink "t1-stdout" if File.file? "t1-stdout" File.unlink "t1-pid" if File.file? "t1-pid" -if %r!GET / HTTP/1\.1!.match?(log) +if log =~ %r!GET / HTTP/1\.1! exit 0 else exit 1 diff --git a/test/test_integration.rb b/test/test_integration.rb index 147d8c63..98522240 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -186,7 +186,7 @@ class TestIntegration < Minitest::Test until done @events.stdout.rewind log = @events.stdout.readlines.join("") - if /- Worker \d \(pid: \d+\) booted, phase: 1/.match?(log) + if log =~ /- Worker \d \(pid: \d+\) booted, phase: 1/ assert_match(/TERM sent/, log) assert_match(/- Worker \d \(pid: \d+\) booted, phase: 1/, log) done = true diff --git a/test/test_persistent.rb b/test/test_persistent.rb index 53539075..06ec90aa 100644 --- a/test/test_persistent.rb +++ b/test/test_persistent.rb @@ -37,7 +37,7 @@ class TestPersistent < Minitest::Test end def lines(count, s=@client) - str = +"" + str = "".dup Timeout.timeout(5) do count.times { str << s.gets } end diff --git a/win_gem_test/puma.ps1 b/win_gem_test/puma.ps1 index 71ad0480..60a62753 100644 --- a/win_gem_test/puma.ps1 +++ b/win_gem_test/puma.ps1 @@ -13,7 +13,7 @@ Make-Const repo_name 'puma' Make-Const url_repo 'https://github.com/puma/puma.git' #———————————————————————————————————————————————————————————————— lowest ruby version -Make-Const ruby_vers_low 25 +Make-Const ruby_vers_low 22 # null = don't compile; false = compile, ignore test (allow failure); # true = compile & test Make-Const trunk $false ; Make-Const trunk_x64 $false