Skip to content

Commit

Permalink
Revert "Drop MRI 1.8.7-2.2 support (#158)"
Browse files Browse the repository at this point in the history
This reverts commit 92d5134.
  • Loading branch information
pboling committed Feb 20, 2025
1 parent 05d6d9c commit 7fe7c2c
Show file tree
Hide file tree
Showing 48 changed files with 742 additions and 428 deletions.
14 changes: 14 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
inherit_gem:
rubocop-lts: config/rubygem_rspec.yml

RSpec/ExampleLength:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

# TODO: We would need to implement Mutexes in order to make violations thread safe.
# But even then they would still trigger the violation.
# See: https://coderscat.com/ruby-change-current-working-directory/
ThreadSafety/DirChdir:
Enabled: false
132 changes: 132 additions & 0 deletions .rubocop_gradual.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"Gemfile:3311641552": [
[19, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787],
[21, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787],
[23, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787]
],
"bin/bundle:3123891436": [
[66, 5, 20, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2485198147]
],
"lib/appraisal/appraisal_file.rb:3486777149": [
[13, 5, 52, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 946226050]
],
"lib/appraisal/cli.rb:435288507": [
[116, 5, 410, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 1969529734]
],
"lib/appraisal/customize.rb:190316824": [
[10, 5, 138, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2682968747],
[17, 5, 62, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4082816720],
[21, 5, 516, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2780620929]
],
"lib/appraisal/utils.rb:2308689703": [
[6, 5, 129, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 733338411],
[13, 5, 354, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 119295155],
[35, 5, 152, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1306460482],
[42, 5, 151, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1120325158],
[48, 5, 97, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2744794681],
[52, 5, 244, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1461524090],
[61, 5, 111, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1909626476]
],
"spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb:2353843955": [
[5, 16, 43, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 911757094]
],
"spec/acceptance/bundle_with_custom_path_spec.rb:3433031704": [
[5, 16, 25, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 4182422797]
],
"spec/acceptance/bundle_without_spec.rb:4272966736": [
[5, 16, 22, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 2294013635]
],
"spec/acceptance/cli/clean_spec.rb:1398207731": [
[5, 23, 17, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 1606893221]
],
"spec/acceptance/cli/generate_spec.rb:1599585127": [
[5, 23, 20, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3905826443]
],
"spec/acceptance/cli/help_spec.rb:3832542771": [
[5, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2148351217]
],
"spec/acceptance/cli/install_spec.rb:2827187127": [
[5, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3284642881]
],
"spec/acceptance/cli/list_spec.rb:1943273700": [
[5, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2152687586]
],
"spec/acceptance/cli/run_spec.rb:439366539": [
[5, 16, 32, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 3238989605]
],
"spec/acceptance/cli/update_spec.rb:2524405540": [
[5, 23, 18, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3752509585]
],
"spec/acceptance/cli/version_spec.rb:4076882072": [
[5, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 316256858]
],
"spec/acceptance/cli/with_no_arguments_spec.rb:378638472": [
[5, 16, 35, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 1965211524]
],
"spec/acceptance/eval_gemfile_spec.rb:2596300425": [
[5, 16, 14, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 987272877]
],
"spec/acceptance/gemfile_dsl_compatibility_spec.rb:4168565060": [
[5, 16, 27, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 2610159673]
],
"spec/appraisal/appraisal_file_spec.rb:1896479557": [
[28, 18, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441],
[33, 7, 57, "RSpec/NestedGroups: Maximum example group nesting exceeded [4/3].", 511689843],
[41, 20, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441],
[41, 33, 39, "RSpec/ExpectChange: Prefer `change(Appraisal::Customize, :heading)`.", 513325635],
[45, 7, 63, "RSpec/NestedGroups: Maximum example group nesting exceeded [4/3].", 1527582647],
[53, 20, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441],
[53, 33, 45, "RSpec/ExpectChange: Prefer `change(Appraisal::Customize, :single_quotes)`.", 627072007],
[57, 7, 77, "RSpec/NestedGroups: Maximum example group nesting exceeded [4/3].", 1960750461],
[65, 11, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441]
],
"spec/appraisal/appraisal_spec.rb:1242607413": [
[33, 11, 23, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 2511581329],
[90, 11, 23, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1120511218],
[95, 7, 83, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [96].", 1453890366],
[95, 13, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192],
[96, 7, 82, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [95].", 1614459968],
[96, 13, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192],
[97, 61, 20, "RSpec/VerifiedDoubles: Prefer using verifying doubles over normal doubles.", 2281802167],
[104, 9, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192],
[114, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192],
[120, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192],
[126, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192]
],
"spec/appraisal/customize_spec.rb:1577209079": [
[7, 1, 4439, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 3030165271],
[17, 3, 13, "RSpec/SubjectDeclaration: Use subject explicitly rather than using let", 3282510975],
[25, 3, 564, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 3336288078],
[27, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441],
[43, 3, 286, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 4222920637],
[45, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441],
[55, 3, 2985, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [13/5]", 1576524985],
[65, 7, 62, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [66, 67, 68].", 123979604],
[66, 7, 72, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 67, 68].", 3240119264],
[67, 7, 74, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 66, 68].", 3701550880],
[68, 7, 85, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 66, 67].", 3874694796],
[72, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441]
],
"spec/appraisal/gemfile_spec.rb:3323881535": [
[227, 11, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3608128140],
[228, 13, 13, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 420381022],
[235, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3511037132],
[245, 13, 12, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3100155342],
[255, 11, 24, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3242693747],
[258, 13, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 105800534],
[281, 13, 16, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 179066369],
[312, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3912615366],
[356, 13, 14, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 2832187185],
[414, 13, 22, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 772581599],
[424, 11, 20, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1076107314]
],
"spec/appraisal/utils_spec.rb:2286225770": [
[62, 17, 58, "RSpec/VerifiedDoubles: Prefer using verifying doubles over normal doubles.", 1573223692]
],
"spec/support/acceptance_test_helpers.rb:4269934475": [
[133, 5, 32, "Style/InvertibleUnlessCondition: Prefer `if $?.exitstatus == 0` over `unless $?.exitstatus != 0`.", 4187517264]
],
"spec/support/stream_helpers.rb:3273310040": [
[9, 17, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787]
]
}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.4.2
26 changes: 23 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@ source "https://rubygems.org"

gemspec

platform :mri do
# Debugging
gem "byebug", ">= 11"

# Dev Console - Binding.pry - Irb replacement
gem "pry", "~> 0.14" # ruby >= 2.0
end

# This here to make sure appraisal works with Rails 3.0.0.
gem "thor", "~> 0.14.0"

group :development, :test do
gem "activesupport", ">= 3.2.21"
gem "rspec", "~> 3.0"
# Ruby version specific dependencies
ruby_version = Gem::Version.new(RUBY_VERSION)
if ruby_version < Gem::Version.new("1.9")
eval File.read("Gemfile-1.8")
elsif ruby_version < Gem::Version.new("2.1")
eval File.read("Gemfile-2.0")
elsif ruby_version < Gem::Version.new("2.2")
eval File.read("Gemfile-2.1")
elsif ruby_version < Gem::Version.new("2.7")
# Std Lib extractions
gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5
else
# Ruby >= 2.7 we can run style / lint checks via rubocop-gradual with rubocop-lts rules for Ruby 1.8+.
# This means we can develop on modern Ruby but remain compatible with ancient Ruby.
eval_gemfile "gemfiles/modular/style.gemfile"
end
6 changes: 6 additions & 0 deletions Gemfile-1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# These gems are locked for Ruby 1.8.7 compatibility
gem "i18n", "~> 0.6.0"
gem "activesupport", "~> 3.2.21"
gem "rake", "~> 10.5"
gem "rack", "~> 1.6.5"
gem "benchmark", "~> 0.3" # Removed from Std Lib in Ruby 3.5
4 changes: 4 additions & 0 deletions Gemfile-2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These gems are locked for Ruby 1.9 & 2.0 compatibility
gem "activesupport", "~> 4.2.7"
gem "rack", "~> 1.6.5"
gem "benchmark", "~> 0.3" # Removed from Std Lib in Ruby 3.5
4 changes: 4 additions & 0 deletions Gemfile-2.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These gems are locked for Ruby 2.1 compatibility
gem "activesupport", "~> 4.2.7"
gem "rack", "~> 1.6.5"
gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Sharing Modular Gemfiles between Appraisals
_New for version 3.0_

It is common for Appraisals to duplicate sets of gems, and sometimes it
makes sense to DRY this up into a shared, modular, gemfile.
makes sense to DRY this up into a shared, modular, gemfile.
In a scenario where you do not load your main Gemfile in your Appraisals,
but you want to declare your various gem sets for e.g.
`%w(coverage test documentation audit)` once each, you can re-use the same
Expand Down Expand Up @@ -147,30 +147,30 @@ gem "bundler-audit", "~> 0.9.2"

**Appraisals**
```ruby
appraise 'ruby-2-7' do
appraise "ruby-2-7" do
gem "dummy"
end

appraise 'ruby-3-0' do
appraise "ruby-3-0" do
gem "dummy"
end

appraise 'ruby-3-1' do
appraise "ruby-3-1" do
gem "dummy"
eval_gemfile "modular/audit.gemfile"
end

appraise 'ruby-3-2' do
appraise "ruby-3-2" do
gem "dummy"
eval_gemfile "modular/audit.gemfile"
end

appraise 'ruby-3-3' do
appraise "ruby-3-3" do
gem "dummy"
eval_gemfile "modular/audit.gemfile"
end

appraise 'ruby-3-4' do
appraise "ruby-3-4" do
gem "dummy"
eval_gemfile "modular/audit.gemfile"
end
Expand All @@ -188,31 +188,31 @@ To do this, use the `remove_gem` declaration within the necessary `appraise` blo

**Gemfile**
```ruby
gem 'rails', '~> 4.2'
gem "rails", "~> 4.2"

group :test do
gem 'rspec', '~> 4.0'
gem 'test_after_commit'
gem "rspec", "~> 4.0"
gem "test_after_commit"
end
```

**Appraisals**
```ruby
appraise 'rails-5' do
gem 'rails', '~> 5.2'
appraise "rails-5" do
gem "rails", "~> 5.2"

group :test do
remove_gem 'test_after_commit'
remove_gem "test_after_commit"
end
end
```

Using the `Appraisals` file defined above, this is what the resulting `Gemfile` will look like:
```ruby
gem 'rails', '~> 5.2'
gem "rails", "~> 5.2"

group :test do
gem 'rspec', '~> 4.0'
gem "rspec", "~> 4.0"
end
```

Expand Down Expand Up @@ -240,12 +240,12 @@ You can also provide variables for substitution in the heading, based on each ap
```ruby
customize_gemfiles do
{
single_quotes: true,
heading: <<~HEADING
frozen_string_literal: true
:single_quotes => true,
:heading => <<-HEADING,
frozen_string_literal: true
`%{gemfile}` has been generated by Appraisal, do NOT modify it or `%{lockfile}` directly!
Make the changes to the "%{appraisal}" block in `Appraisals` instead. See the conventions at https://example.com/
`%{gemfile}` has been generated by Appraisal, do NOT modify it or `%{lockfile}` directly!
Make the changes to the "%{appraisal}" block in `Appraisals` instead. See the conventions at https://example.com/
HEADING
}
end
Expand All @@ -262,7 +262,7 @@ Using the `Appraisals` file defined above, this is what the resulting `Gemfile`
# `rails-3.gemfile` has been generated by Appraisal, do NOT modify it or `rails-3.gemfile.lock` directly!
# Make the changes to the "rails-3" block in `Appraisals` instead. See the conventions at https://example.com/

gem 'rails', '3.2.14'
gem "rails", "3.2.14"
```

Version Control
Expand Down
13 changes: 11 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,14 @@ RSpec::Core::RakeTask.new do |t|
t.verbose = false
end

desc "Default: run the rspec examples"
task default: [:spec]
begin
require "rubocop/lts"
Rubocop::Lts.install_tasks
rescue LoadError
task(:rubocop_gradual) do
warn("RuboCop (Gradual) is disabled")
end
end

desc "Default: rubocop_gradual's autocorrect and run the rspec examples"
task :default => ["rubocop_gradual:autocorrect", :spec]
59 changes: 42 additions & 17 deletions appraisal.gemspec
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@
# frozen_string_literal: true

require_relative "lib/appraisal/version"
# TODO: Switch to require_relative once support for Ruby < 2 is dropped.
# require_relative "lib/appraisal/version"

$:.push(File.expand_path("lib", __dir__))
require "appraisal/version"

Gem::Specification.new do |s|
s.name = "appraisal"
s.version = Appraisal::VERSION.dup
s.platform = Gem::Platform::RUBY
s.authors = ["Joe Ferris", "Prem Sichanugrist"]
s.email = ["jferris@thoughtbot.com", "prem@thoughtbot.com"]
s.homepage = "http://github.com/thoughtbot/appraisal"
s.summary = "Find out what your Ruby gems are worth"
s.name = "appraisal"
s.version = Appraisal::VERSION.dup
s.platform = Gem::Platform::RUBY
s.authors = ["Joe Ferris", "Prem Sichanugrist"]
s.email = ["jferris@thoughtbot.com", "prem@thoughtbot.com"]
s.homepage = "http://github.com/thoughtbot/appraisal"
s.summary = "Find out what your Ruby gems are worth"
s.description = 'Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals."'
s.license = "MIT"
s.license = "MIT"

# specify which files should be added to the gem when it is released.
s.files = Dir[
# Splats (keep alphabetical)
"lib/**/*.rb",
]

# automatically included with gem package, no need to list twice (i.e. do not list in files above).
s.extra_rdoc_files = Dir[
# Files (keep alphabetical)
"CONTRIBUTING.md",
"MIT-LICENSE",
"README.md",
"SECURITY.md",
]

# bin/ is scripts, in any available language, for development of this specific gem
# exe/ is for ruby scripts that will ship with this gem to be used by other tools
s.bindir = "exe"
# files listed are relative paths from bindir above.
s.executables = [
"appraisal",
]

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) }
s.bindir = "exe"
s.required_ruby_version = ">= 1.8.7"

s.required_ruby_version = ">= 2.3.0"
s.add_runtime_dependency("bundler", ">= 1.17.3") # Last version supporting Ruby 1.8.7
s.add_runtime_dependency("rake", ">= 10") # Last version supporting Ruby 1.8.7
s.add_runtime_dependency("thor", ">= 0.14.0")

s.add_dependency("rake")
s.add_dependency("bundler")
s.add_dependency("thor", ">= 0.14.0")
s.add_development_dependency("activesupport", ">= 3.2.21")
s.add_development_dependency("rspec", "~> 3.0")
end
Loading

0 comments on commit 7fe7c2c

Please sign in to comment.