thoughtbot / appraisal

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

No support for multiple `gemspec` entries #124

Closed bradgessler closed 7 years ago

bradgessler commented 7 years ago

Gemfile's that have multiple gemspec directives don't work correctly with appraisal.

Given the Gemfile https://github.com/sitepress/sitepress/blob/appraisals/Gemfile and Appraisals file https://github.com/sitepress/sitepress/blob/appraisals/Appraisals, when I run the appraisal generate command, I end up with:

# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "4.2.8"

group :test do
  gem "simplecov"
  gem "codeclimate-test-reporter", "~> 1.0.0"
  gem "pry", :require => nil
  gem "rack-test", :require => nil
end

gemspec :path => "../sitepress-rails"

Expected result:

# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "4.2.8"

group :test do
  gem "simplecov"
  gem "codeclimate-test-reporter", "~> 1.0.0"
  gem "pry", :require => nil
  gem "rack-test", :require => nil
end

gemspec :path => "../sitepress"
gemspec :path => "../sitepress-core"
gemspec :path => "../sitepress-server"
gemspec :path => "../sitepress-cli"
gemspec :path => "../sitepress-rails"

Investigation of the bundler_dsl.rb source code at https://github.com/thoughtbot/appraisal/blob/master/lib/appraisal/bundler_dsl.rb#L15 indicates that Appraisal incorrectly assumes only one gemspec directive will be defined. According to the official bundler documentation at http://bundler.io/v1.14/man/gemfile.5.html#GEMSPEC multiple gemspec directives may be defined in a Gemfile.

bradgessler commented 7 years ago

I fixed this and opened a PR at https://github.com/thoughtbot/appraisal/pull/125.

Coincidentally I'm using this for https://github.com/sitepress/sitepress, which is a really souped up version of https://github.com/thoughtbot/high_voltage with frontmatter, page hierarchy traversal, and other useful features. Thanks both for this gem and high_voltage!

odlp commented 7 years ago

Closing this since 2.2.0 has been released, with #125 included.