-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Appraisal doesn't support eval_gemfile
#154
Comments
Hacky workaround: # Put this in Gemfile:
require 'appraisal/bundler_dsl'
::Appraisal::BundlerDSL.class_eval do
def eval_gemfile(path, contents = nil)
(@eval_gemfile ||= []) << [path, contents]
end
private
def eval_gemfile_entry
@eval_gemfile.map { |(p, c)| "eval_gemfile(#{p.inspect}#{", #{c.inspect}" if c})" } * "\n\n"
end
alias_method :eval_gemfile_entry_for_dup, :eval_gemfile_entry
self::PARTS << 'eval_gemfile'
end unless ::Appraisal::BundlerDSL::PARTS[-1] == 'eval_gemfile' Proper support for Decided against using Appraisal in this case though, as there doesn't seem to be any option for configuring the |
Would you be able to open an issue for this bit specifically? |
Just FYI, this is still valid. I stumbled upon it with neovim and Shopify/ruby-lsp in a project that uses appraisal (I don't have control over that and cannot remove appraisal). ruby-lsp injects itself with a
In particular, thus there's The Ruby language server consequently crashes ("Client ruby_ls quit with exit code 127 and signal 0).
|
Hoping to see |
An updated hack, based on @glebm 's work above, which I got working by putting one copy in the root of the project, and another in the require "appraisal/bundler_dsl"
if ::Appraisal::BundlerDSL::PARTS.include?("eval_gemfile")
# When the hack is already active, this code path is run within appraisal,
# so we can't really tell the difference between already hacked,
# and new version of appraisal has added the feature
else
require "appraisal/appraisal"
Appraisal::Appraisal.class_eval do
def eval_gemfile(*args)
gemfile.eval_gemfile(*args)
end
end
Appraisal::BundlerDSL.class_eval do
def eval_gemfile(path, contents = nil)
(@eval_gemfile ||= []) << [path, contents]
end
private
def eval_gemfile_entry
@eval_gemfile.map { |(p, c)| "eval_gemfile(#{p.inspect}#{", #{c.inspect}" if c})" } * "\n\n"
end
alias_method :eval_gemfile_entry_for_dup, :eval_gemfile_entry
self::PARTS << "eval_gemfile"
end
end NOTES:
|
I implemented the pattern above, and it is working perfectly, see: |
Nice, thanks! Do you think you could open a PR to add this? We can pick it up from there then! |
I'd love to! I'll work on that this week. |
eval_gemfile
is not supported by appraisal.Error:
eval_gemfile
is useful for sharing dependencies between multiple Gemfiles.E.g. I have a
rubocop.gemfile
that's included into the mainGemfile
but also into a separate rubocop-only Gemfile for running as a separate task on CI.The text was updated successfully, but these errors were encountered: