Closed jrochkind closed 4 years ago
I think I found a hacky way to do it, with this in my gemspec:
# Should never release a gemspec with this set, but needed so we can test
# against other rails versions (like edge) in Appraisal
unless ENV['APPRAISAL_INITIALIZED']
s.add_dependency "rails", "~> 5.2.1"
end
I tried again without things in gemspec dependencies, just literally a dependency specified in the Gemfile, and then again (with different requirements) in an appraisal.
Now I got eg:
[!] There was an error parsing
rails_5_0.gemfile
: You cannot specify the same gem twice with different version requirements. You specified: rails (~> 5.0.0) and rails (>= 0). Bundler cannot continue.
Is the statement in the docs simply no longer true? "If something is specified in both the Gemfile and an appraisal, the version from the appraisal takes precedence." Is this supposed to be true? How do I get it to work?
Oh huh, that's interesting.
Have you been able to come up with a better solution since then?
Part of me is wondering if this is a specific library@HEAD
sort of problem, but one which would be good to solve.
I'm not totally sure how I resolved that in the 16 months since reported; I don't recall that coming up again, I'm not sure if it's because the problem doesn't always happen (depending on bundler/rubygems versions?) or I've avoided ever double-specifying.
I can think of situations where it would be hard to avoid double-specifying... I do think its' a use case that would ideally be supported. I'm not sure what's going on for me, I had forgotten about this.
Perhaps I am still working around with the workaround mentioned above, guarding a Gemfile with unless ENV['APPRAISAL_INITIALIZED']
to avoid double-specifying. That is a little bit error-prone of a situation, need to make sure you are keeping your Gemfile in sync with whatever's going on in your appraisal gemfiles.
Yeah, totally. I'm going to close this for now, but if you're struggling with it again, please reopen.
I have a Rails engine gem, whose gemspec says
"~> 5.2.0"
-- since that's what it actually works with.But I'd like to run tests against rails master too, so I can get early warning if something in master (for eventual Rails 5) breaks it. Probably as an "allowed failure" in travis.
This statement from the docs let me think maybe it would work:
But it in fact, it doesn't:
(Or, if I don't explicitly put
">= 6.0.0.alpha"
in my Appraisals file, then:Any ideas/advice for how to accomplish this?