Closed n-rodriguez closed 2 years ago
With real world example :
The nice thing : it even merges gems with duplicated conditions :
install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do
gem "activerecord-oracle_enhanced-adapter", "~> 5.2.0"
gem "ruby-oci8"
end
Here the yaml structure that generate gemfiles : https://github.com/jbox-web/ajax-datatables-rails/compare/wip/appraisal#diff-a7e1dc0d2145599ae30f5d8cdfa163e79e7708040d2f7cf36b36fab4559974a8R30
@nickcharlton wdyt?
Hi there! any news?
Ping @nickcharlton
Hi there! Any news?
It would be nice to have some news...
I hope I've not worked for nothing....
Ping @nickcharlton
Ping @nickcharlton
Ping @nickcharlton
@nickcharlton ping
Thanks for the ping! I'm going to merge this now.
It'll go out in our next release, which will be once we fix #173.
For some reason, the install_if
method doesn't work for me.
install_if -> { ENV["CI"] } do
gem "pluggy", path: "./gems/pluggy"
end
Can you open a new issue? Ideally with something we can try and replicate with!
From your screenshot I see appraisal-2.4.1
. This feature doesn't exist in this version, you need to use the main
/master
branch of appraisal
.
By the way be sure to use quotes in your Appraisal
file.
See: https://github.com/thoughtbot/appraisal/pull/176#issue-777324564
@nickcharlton maybe it's time to cut a new release? https://github.com/thoughtbot/appraisal/compare/v2.4.1...master :)
Thanks @n-rodriguez. I only checked to see if I'm on the latest version. The main
/master
instruction missed me.
Will try now.
There will be a new issue soon. I'm tracking a few issues/catching up with lots of bundler changes so I think it's important to test these well.
This an attempt to fix: https://github.com/thoughtbot/appraisal/issues/131
The trick here is to store the conditional as plain string. As explained here https://github.com/thoughtbot/appraisal/pull/132#discussion_r154461946 :
IMHO the easiest way is to write/store it as a string and render it directly in the generated file (verbatim).
So in
Appraisal
file :becomes
After generation it becomes (in
gemfiles/*.gemfile
) :It should help to solve most use cases since you can put any valid Ruby code here :).
At first I tried https://github.com/banister/method_source but it immediately failed.
Because :
So I ended up with this easy solution that does the job.