Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Drop MRI 1.8.7-2.2 support (#158)" #250

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9860cb9
Revert "Drop MRI 1.8.7-2.2 support (#158)"
pboling Feb 20, 2025
14f36cd
💚 Fix bundler versions per Ruby version
pboling Feb 20, 2025
79a6de1
💚 Fix ruby declaration in Gemfile when on ruby-head
pboling Feb 20, 2025
2d022fc
🚨 Address code review from @n-rodriguez
pboling Feb 20, 2025
df41df2
👷 Add Rubies 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1, 2.0, 1.9, 1.8 to buil…
pboling Feb 20, 2025
1a5b85d
♻️ Use .rspec to dry spec file headers
pboling Feb 20, 2025
a19e707
🚨 Address code review from @n-rodriguez
pboling Feb 21, 2025
e1673bc
🐛 Fixes for Ruby 2.7 compat
pboling Feb 21, 2025
4ec2725
👷 add Ruby 3.4
pboling Feb 21, 2025
594690d
🐛 Fix inconsistent indentation
pboling Feb 21, 2025
386ddb6
📝 Documentation
pboling Feb 21, 2025
7a2ec8e
💚 Fix inconsistent indentation in spec fixtures
pboling Feb 21, 2025
f722561
🚨 Lint lock update
pboling Feb 21, 2025
12002da
👷 Add Ruby 2.6
pboling Feb 21, 2025
df71fbb
✏️ Lookahead != Lookbehind
pboling Feb 21, 2025
5fcfb43
✏️ Fix typo in documentation
pboling Feb 21, 2025
975ded0
👷 Remove Ruby 2.6 from CI (to be added back in another PR)
pboling Feb 21, 2025
46d71e6
📝 Documentation
pboling Feb 3, 2025
c07c0c9
🐛 Ruby 1.8 compat: Replace __dir__ with File.dirname(__FILE__)
pboling Feb 24, 2025
1ceb8ab
🚨 Lint lock update
pboling Feb 24, 2025
8bffc9d
🐛 Ruby < 3.0 compat: Bifurcate the Modern Double Splat
pboling Feb 24, 2025
f3595ab
🐛 Ruby < 3.0 compat: Bifurcate the Modern Double Splat (redux)
pboling Feb 24, 2025
f582740
🐛 Ruby < 3.0 compat: Bifurcate the Modern Double Splat (redux deux)
pboling Feb 24, 2025
1579ad0
🐛 Ruby < 3.0 compat: Bifurcate the Modern Double Splat (tiga)
pboling Feb 24, 2025
a524ead
🐛 Ruby < 3.0 compat: Bifurcate the Modern Double Splat (empat)
pboling Feb 24, 2025
df2a1e9
🚨 Style/SymbolArray: EnforcedStyle: brackets
pboling Feb 24, 2025
0a02c86
💚 Pend spec failure
pboling Feb 24, 2025
be18441
💚 skip tests that are known to fail on old bundler versions
pboling Feb 24, 2025
198a324
💚 turn off truffleruby-head for now
pboling Feb 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.4'
- '3.3'
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- 'head'
- jruby
- jruby-head
Expand All @@ -38,10 +40,23 @@ jobs:
- name: Update bundler
env:
RUBY_VERSION: ${{ matrix.ruby }}
# See: https://dev.to/galtzo/matrix-ruby-gem-bundler-etc-4kk7
run: |
case ${RUBY_VERSION} in
truffleruby|truffleruby-head)
gem install bundler -v 2.5.18
1.8|1.9|2.0|2.1|2.2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add EOL Rubies in matrix:ruby above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's my next task.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding them one by one now...

gem install bundler -v 1.17.3
;;

2.3|2.4|2.5)
gem install bundler -v 2.3.27
;;

2.6|2.7)
gem install bundler -v 2.4.22
;;

3.0)
gem install bundler -v 2.5.23
;;

*)
Expand Down
4 changes: 4 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--format progress
--color
--require spec_helper
--warnings
17 changes: 17 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
inherit_gem:
rubocop-lts: config/rubygem_rspec.yml

RSpec/ExampleLength:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

RSpec/DescribeClass:
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
477 changes: 477 additions & 0 deletions .rubocop_gradual.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
`ruby 3.4.2
ruby 3.3.7
43 changes: 40 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,47 @@ source "https://rubygems.org"

gemspec

# For Ruby version specific dependencies
ruby_version = Gem::Version.new(RUBY_VERSION)

platform :mri do
# Debugging
if ruby_version < Gem::Version.new("2.7")
# Use byebug in code
gem "byebug", ">= 11"
else
# Use binding.break, binding.b, or debugger in code
gem "debug", ">= 1.0.0"
end

# 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"
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.
# TODO: Replace individual style gems below with modular gemfile, once eval_gemfile support is added to appraisal.
# eval_gemfile "gemfiles/modular/style.gemfile"
# We run rubocop on the latest version of Ruby,
# but in support of the oldest supported version of Ruby
gem "rubocop-lts", "~> 0.1", ">= 0.1.1" # Style and Linting support for Ruby >= 1.8
gem "rubocop-packaging", "~> 0.5", ">= 0.5.2"
gem "rubocop-rspec", "~> 3.2"
gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0"

# Std Lib extractions
gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5
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
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,31 +122,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 @@ -174,12 +174,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 @@ -196,7 +196,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 = ["[email protected]", "[email protected]"]
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 = ["[email protected]", "[email protected]"]
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
30 changes: 17 additions & 13 deletions bin/bundle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to lint this file : it is generated and about to disappear rubygems/rubygems#8345

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 the complication is the linting is automated when running the default rake task now, and violations will clog up the new lint lockfile. This will encourage us to get rid of files we don't use!

Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ m = Module.new do
def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`

bundler_version = nil
update_index = nil
ARGV.each_with_index do |a, i|
if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
bundler_version = a
end
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
bundler_version = $1
bundler_version = a if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o

bundler_version = Regexp.last_match(1)
update_index = i
end
bundler_version
Expand All @@ -55,8 +55,10 @@ m = Module.new do

def lockfile_version
return unless File.file?(lockfile)

lockfile_contents = File.read(lockfile)
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o

Regexp.last_match(1)
end

Expand All @@ -83,15 +85,19 @@ m = Module.new do

def activate_bundler
gem_error = activation_error_handling do
gem "bundler", bundler_requirement
gem("bundler", bundler_requirement)
end
return if gem_error.nil?

require_error = activation_error_handling do
require "bundler/version"
end
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
exit 42
if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
return
end

warn("Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`")
exit(42)
end

def activation_error_handling
Expand All @@ -104,6 +110,4 @@ end

m.load_bundler!

if m.invoked_as_script?
load Gem.bin_path("bundler", "bundle")
end
load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
2 changes: 1 addition & 1 deletion exe/appraisal
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ begin
Appraisal::CLI.start
rescue Appraisal::AppraisalsNotFound => e
puts e.message
exit 127
exit(127)
end
12 changes: 12 additions & 0 deletions gemfiles/modular/style.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

# We run rubocop on the latest version of Ruby,
# but in support of the oldest supported version of Ruby

gem "rubocop-lts", "~> 0.1", ">= 0.1.1" # Style and Linting support for Ruby >= 1.8
gem "rubocop-packaging", "~> 0.5", ">= 0.5.2"
gem "rubocop-rspec", "~> 3.2"
gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0"

# Std Lib extractions
gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5
Loading
Loading