Skip to content

Commit

Permalink
Merge pull request simplecov-ruby#1108 from amatsuda/ruby25
Browse files Browse the repository at this point in the history
Bring Ruby 2.5 and 2.6 support back
  • Loading branch information
amatsuda authored Aug 31, 2024
2 parents 8558b1e + 6d2cfd9 commit 0cfb880
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 52 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest

env:
BUNDLE_WITHOUT: "benchmark"
JRUBY_OPTS: "--debug"
Expand All @@ -13,6 +14,8 @@ jobs:

matrix:
ruby-version:
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
Expand All @@ -24,11 +27,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: rm Gemfile.lock
- run: rm Gemfile.lock && rm test_projects/rails/rspec_rails/Gemfile.lock

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
rubygems: ${{ (matrix.ruby_version < '2.6' && '3.3.26') || 'default' }}
bundler-cache: true

- name: Run Rubocop
Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ AllCops:
- "tmp/**/*"
- "vendor/bundle/**/*"
- "vendor/bundle/**/.*"
TargetRubyVersion: 2.7
TargetRubyVersion: 2.5
NewCops: enable
# we might wanna adopt rspec and rake but it's a bit annoying for now
SuggestExtensions: false
Expand Down Expand Up @@ -239,6 +239,9 @@ Style/DocumentDynamicEvalDefinition:
Style/EndlessMethod:
Enabled: true

Style/EnvHome:
Enabled: false

Style/ExplicitBlockArgument:
# capturing as a proc has a performance hit, so is a case by case choice
Enabled: false
Expand Down
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ group :development do
gem "activesupport", "~> 6.1"
gem "aruba"
gem "capybara"
gem "rackup"
if RUBY_VERSION < "2.7"
gem "rack", "< 3"
else
gem "rackup"
end
gem "cucumber"
gem "minitest"
gem "rake"
Expand Down
70 changes: 35 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.7.7)
activesupport (6.1.7.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
aruba (2.2.0)
bundler (>= 1.17, < 3.0)
contracts (>= 0.16.0, < 0.18.0)
Expand All @@ -33,9 +33,9 @@ GEM
thor (~> 1.0)
ast (2.4.2)
benchmark-ips (2.13.0)
bigdecimal (3.1.7)
bigdecimal (3.1.7-java)
builder (3.2.4)
bigdecimal (3.1.8)
bigdecimal (3.1.8-java)
builder (3.3.0)
capybara (3.40.0)
addressable
matrix
Expand All @@ -46,7 +46,7 @@ GEM
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
coderay (1.1.3)
concurrent-ruby (1.3.3)
concurrent-ruby (1.3.4)
contracts (0.17)
cucumber (9.2.0)
builder (~> 3.2)
Expand All @@ -61,40 +61,40 @@ GEM
multi_test (~> 1.1)
sys-uname (~> 1.2)
cucumber-ci-environment (10.0.1)
cucumber-core (13.0.2)
cucumber-core (13.0.3)
cucumber-gherkin (>= 27, < 28)
cucumber-messages (>= 20, < 23)
cucumber-tag-expressions (> 5, < 7)
cucumber-cucumber-expressions (17.1.0)
bigdecimal
cucumber-gherkin (27.0.0)
cucumber-messages (>= 19.1.4, < 23)
cucumber-html-formatter (21.3.1)
cucumber-messages (> 19, < 25)
cucumber-html-formatter (21.7.0)
cucumber-messages (> 19, < 27)
cucumber-messages (22.0.0)
cucumber-tag-expressions (6.1.0)
diff-lcs (1.5.1)
docile (1.4.0)
ffi (1.16.3)
ffi (1.16.3-java)
i18n (1.14.4)
docile (1.4.1)
ffi (1.17.0)
ffi (1.17.0-java)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.7.2)
json (2.7.2-java)
language_server-protocol (3.17.0.3)
matrix (0.4.2)
method_source (1.0.0)
method_source (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.24.0)
minitest (5.25.1)
multi_test (1.1.0)
nokogiri (1.16.6)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.6-java)
nokogiri (1.16.7-java)
racc (~> 1.4)
parallel (1.25.1)
parser (3.3.3.0)
parallel (1.26.3)
parser (3.3.4.2)
ast (~> 2.4.1)
racc
power_assert (2.0.3)
Expand All @@ -105,10 +105,10 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
public_suffix (5.0.5)
racc (1.8.0)
racc (1.8.0-java)
rack (3.0.10)
public_suffix (6.0.1)
racc (1.8.1)
racc (1.8.1-java)
rack (3.1.7)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
Expand All @@ -117,33 +117,33 @@ GEM
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.0)
rexml (3.3.6)
strscan
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.64.1)
rubocop (1.65.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
rubocop-ast (1.32.1)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
simplecov-html (0.12.3)
Expand All @@ -152,11 +152,11 @@ GEM
ffi
strscan (3.1.0)
strscan (3.1.0-java)
sys-uname (1.2.3)
sys-uname (1.3.0)
ffi (~> 1.1)
test-unit (3.6.1)
test-unit (3.6.2)
power_assert
thor (1.3.1)
thor (1.3.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand All @@ -168,7 +168,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.13)
zeitwerk (2.6.17)

PLATFORMS
java
Expand All @@ -195,4 +195,4 @@ DEPENDENCIES
webrick

BUNDLED WITH
2.4.20
2.3.12
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter

## Ruby version compatibility

SimpleCov is built in [Continuous Integration] on Ruby 2.7+ as well as JRuby 9.3+.
SimpleCov is built in [Continuous Integration] on Ruby 2.5+ as well as JRuby 9.2+.

Note for JRuby => You need to pass JRUBY_OPTS="--debug" or create .jrubyrc and add debug.fullTrace=true

Expand Down
4 changes: 2 additions & 2 deletions lib/simplecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ def start_coverage_measurement
end

def start_coverage_with_criteria
start_arguments = coverage_criteria.to_h do |criterion|
start_arguments = coverage_criteria.map do |criterion|
[lookup_corresponding_ruby_coverage_name(criterion), true]
end
end.to_h

start_arguments[:eval] = true if coverage_for_eval_enabled?

Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def minimum_coverage_by_file(coverage = nil)
def refuse_coverage_drop(*criteria)
criteria = coverage_criteria if criteria.empty?

maximum_coverage_drop(criteria.to_h { |c| [c, 0] })
maximum_coverage_drop(criteria.map { |c| [c, 0] }.to_h)
end

#
Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov/load_global_config.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "etc"
home_dir = Dir.home || File.expand_path("~") || Etc.getpwuid.dir || (ENV.fetch("USER", nil) && File.expand_path("~#{ENV.fetch('USER', nil)}"))
home_dir = (ENV.fetch("HOME", nil) && File.expand_path("~")) || Etc.getpwuid.dir || (ENV.fetch("USER", nil) && File.expand_path("~#{ENV.fetch('USER', nil)}"))
if home_dir
global_config_path = File.join(home_dir, ".simplecov")
load global_config_path if File.exist?(global_config_path)
Expand Down
2 changes: 1 addition & 1 deletion simplecov.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gem::Specification.new do |gem|
"rubygems_mfa_required" => "true"
}

gem.required_ruby_version = ">= 2.7.0"
gem.required_ruby_version = ">= 2.5.0"

gem.add_dependency "docile", "~> 1.1"
gem.add_dependency "simplecov-html", "~> 0.11"
Expand Down
6 changes: 2 additions & 4 deletions test_projects/rails/rspec_rails/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ else
gem "sqlite3", "~> 1.4"
end

gem "nokogiri", "~> 1.13.10"

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 6.1.4"
gem "rails", "~> 6.1.0"
# Use Puma as the app server
gem "puma", "~> 5.0"
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
Expand All @@ -41,7 +39,7 @@ end

group :test do
# Adds support for Capybara system testing and selenium driver
gem "capybara", ">= 3.36.0"
gem "capybara", ">= 3.26"
# 'selenium-webdriver' and 'webdrivers' did not work with Ruby 3.0 at the
# moment this file was updated. Since they are not needed to run
# SimpleCov's specs, they have been commented out
Expand Down
7 changes: 3 additions & 4 deletions test_projects/rails/rspec_rails/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ GEM
msgpack (1.3.3-java)
nio4r (2.5.4)
nio4r (2.5.4-java)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
nokogiri (1.15.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.13.10-java)
nokogiri (1.15.2-java)
racc (~> 1.4)
public_suffix (4.0.7)
puma (5.1.1)
Expand Down Expand Up @@ -212,7 +212,6 @@ DEPENDENCIES
byebug
capybara (>= 3.36.0)
jbuilder (~> 2.7)
nokogiri (~> 1.13.10)
puma (~> 5.0)
rails (~> 6.1.4)
rspec-rails
Expand Down

0 comments on commit 0cfb880

Please sign in to comment.