Skip to content

Commit

Permalink
Removes support for Ruby 2.4 as EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanlr committed Apr 12, 2020
1 parent c362527 commit 57c6c2d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
ruby: [2.4, 2.5, 2.6, 2.7]
ruby: [2.5, 2.6, 2.7]

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require: rubocop-performance
AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5
Exclude:
- '*.gemspec'
- 'vendor/**/*'
Expand Down
8 changes: 3 additions & 5 deletions app/finders/plugin_version/readme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ def from_changelog_section(body)
extracted_versions = extracted_versions.select { |x| x =~ /[0-9]+/ }

sorted = extracted_versions.sort do |x, y|
begin
Gem::Version.new(x) <=> Gem::Version.new(y)
rescue StandardError
0
end
Gem::Version.new(x) <=> Gem::Version.new(y)
rescue StandardError
0
end

sorted.last
Expand Down
26 changes: 12 additions & 14 deletions lib/wpscan/db/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,22 @@ def update
updated = []

FILES.each do |filename|
begin
db_checksum = remote_file_checksum(filename)
db_checksum = remote_file_checksum(filename)

# Checking if the file needs to be updated
next if File.exist?(local_file_path(filename)) && db_checksum == local_file_checksum(filename)
# Checking if the file needs to be updated
next if File.exist?(local_file_path(filename)) && db_checksum == local_file_checksum(filename)

create_backup(filename)
dl_checksum = download(filename)
create_backup(filename)
dl_checksum = download(filename)

raise Error::ChecksumsMismatch, filename unless dl_checksum == db_checksum
raise Error::ChecksumsMismatch, filename unless dl_checksum == db_checksum

updated << filename
rescue StandardError => e
restore_backup(filename)
raise e
ensure
delete_backup(filename) if File.exist?(backup_file_path(filename))
end
updated << filename
rescue StandardError => e
restore_backup(filename)
raise e
ensure
delete_backup(filename) if File.exist?(backup_file_path(filename))
end

File.write(last_update_file, Time.now)
Expand Down
10 changes: 4 additions & 6 deletions lib/wpscan/finders/dynamic_finder/version/config_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ def parse(body)
parsers = ALLOWED_PARSERS.include?(self.class::PARSER) ? [self.class::PARSER] : ALLOWED_PARSERS

parsers.each do |parser|
begin
parsed = parser.respond_to?(:safe_load) ? parser.safe_load(body) : parser.load(body)
parsed = parser.respond_to?(:safe_load) ? parser.safe_load(body) : parser.load(body)

return parsed if parsed.is_a?(Hash) || parsed.is_a?(Array)
rescue StandardError
next
end
return parsed if parsed.is_a?(Hash) || parsed.is_a?(Array)
rescue StandardError
next
end

nil # Make sure nil is returned in case none of the parsers managed to parse the body correctly
Expand Down
4 changes: 2 additions & 2 deletions wpscan.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |s|
s.name = 'wpscan'
s.version = WPScan::VERSION
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 2.4'
s.required_ruby_version = '>= 2.5'
s.authors = ['WPScanTeam']
s.date = Time.now.utc.strftime('%Y-%m-%d')
s.email = ['[email protected]']
Expand All @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.executables = ['wpscan']
s.require_paths = ['lib']

s.add_dependency 'cms_scanner', '~> 0.8.6'
s.add_dependency 'cms_scanner', '~> 0.9.0'

s.add_development_dependency 'bundler', '>= 1.6'
s.add_development_dependency 'memory_profiler', '~> 0.9.13'
Expand Down

0 comments on commit 57c6c2d

Please sign in to comment.