From 557a328336b7a0bd68a50fcfb16902aeab61b41c Mon Sep 17 00:00:00 2001 From: cn Date: Sun, 8 May 2022 16:30:19 +0200 Subject: [PATCH] gem: drop support for Rubies < 2.7 --- .github/workflows/ci.yml | 2 -- .rubocop.yml | 2 +- lib/openvpn-status-web/parser/modern_stateless.rb | 8 ++++---- lib/openvpn-status-web/parser/v1.rb | 4 ++-- openvpn-status-web.gemspec | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4ca584..1ec61f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,6 @@ jobs: strategy: matrix: ruby-version: - - '2.5' - - '2.6' - '2.7' - '3.0' - '3.1' diff --git a/.rubocop.yml b/.rubocop.yml index b239c83..c33a31e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,7 @@ require: - rubocop-rspec AllCops: - TargetRubyVersion: '2.5' + TargetRubyVersion: '2.7' NewCops: enable Gemspec/RequireMFA: diff --git a/lib/openvpn-status-web/parser/modern_stateless.rb b/lib/openvpn-status-web/parser/modern_stateless.rb index 6861474..44b7617 100644 --- a/lib/openvpn-status-web/parser/modern_stateless.rb +++ b/lib/openvpn-status-web/parser/modern_stateless.rb @@ -13,10 +13,10 @@ module OpenVPNStatusWeb text.lines.each do |line| parts = line.strip.split(sep) - status.client_list_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'CLIENT_LIST' - status.client_list << parse_client(parts[1..-1], status.client_list_headers) if parts[0] == 'CLIENT_LIST' - status.routing_table_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'ROUTING_TABLE' - status.routing_table << parse_route(parts[1..-1], status.routing_table_headers) if parts[0] == 'ROUTING_TABLE' + status.client_list_headers = parts[2..] if parts[0] == 'HEADER' && parts[1] == 'CLIENT_LIST' + status.client_list << parse_client(parts[1..], status.client_list_headers) if parts[0] == 'CLIENT_LIST' + status.routing_table_headers = parts[2..] if parts[0] == 'HEADER' && parts[1] == 'ROUTING_TABLE' + status.routing_table << parse_route(parts[1..], status.routing_table_headers) if parts[0] == 'ROUTING_TABLE' status.global_stats << parse_global(parts[1..2]) if parts[0] == 'GLOBAL_STATS' end diff --git a/lib/openvpn-status-web/parser/v1.rb b/lib/openvpn-status-web/parser/v1.rb index f46ed9d..64580a4 100644 --- a/lib/openvpn-status-web/parser/v1.rb +++ b/lib/openvpn-status-web/parser/v1.rb @@ -27,9 +27,9 @@ module OpenVPNStatusWeb status = Status.new status.client_list_headers = ['Common Name', 'Real Address', 'Data Received', 'Data Sent', 'Connected Since'] - status.client_list = client_list[2..-1].map { |client| parse_client(client) } + status.client_list = client_list[2..].map { |client| parse_client(client) } status.routing_table_headers = ['Virtual Address', 'Common Name', 'Real Address', 'Last Ref'] - status.routing_table = routing_table[1..-1].map { |route| parse_route(route) } + status.routing_table = routing_table[1..].map { |route| parse_route(route) } status.global_stats = global_stats.map { |global| parse_global(global) } status end diff --git a/openvpn-status-web.gemspec b/openvpn-status-web.gemspec index cd77a49..f95ca1a 100644 --- a/openvpn-status-web.gemspec +++ b/openvpn-status-web.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.executables = ['openvpn-status-web'] s.extra_rdoc_files = Dir['README.md', 'LICENSE'] - s.required_ruby_version = '>= 2.5' + s.required_ruby_version = '>= 2.7' s.add_runtime_dependency 'metriks' s.add_runtime_dependency 'rack', '~> 2.0'