thoughtbot / appraisal

A Ruby library for testing your library against different versions of dependencies.
https://thoughtbot.com
MIT License
1.25k stars 107 forks source link

Ability to drop a gem in an appraisal #170

Closed jebentier closed 3 years ago

jebentier commented 3 years ago

I've been using the appraisal gem quite a bit with my company to help migrate one of the main services from Rails 4 to Rails 5. A common pattern that I've noticed during the migration, is that there are certain gems that need to be installed in the current production version, that are no longer necessary for the the appraisals. It would be nice if there was a way to designate a gem in an appraise block with :drop or :remove so that the generated Gemfile will not include that gem.

An example Gemfile and Appraisals file would look like the following:

Gemfile

gem 'rails', '~> 4.2'

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

Appraisals

appraise 'rails-5' do
  gem 'rails', '~> 5.2'

  group :test do
    gem 'test_after_commit', :remove
  end
end

To produce: gemfiles/rails_5.gemfile

gem 'rails', '~> 5.2'

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

If this feature is of interest, I can make a PR to add it.

nickcharlton commented 3 years ago

Ah yeah, that'd be great to see a PR for!

jebentier commented 3 years ago

@nickcharlton I've gone ahead and opened #171 to address this