Closed amuino closed 1 year ago
This PR is mostly a convenience for those of us using couchbeam from source (instead of hex) on Elixir projects.
Use cases: 1.- Workaround for the broken 1.4.2 release (does not list its dependencies in Hex) 2.- Using pre-release versions (forks, triaging PRs…) from github or local sources
What is needed is a new hex release which properly lists the dependencies (including updated hackney) so we can stop depending on versions from github (case 1 above)
rebar3 is always here now. Let just use this change
Problem
There are a couple of issues related to using couchbeam with Elixir/Mix (#167 and #169, at least). They can be related to different tool behaviour.
I was pointed today to the fact that
erlang:function_exported(rebar3, main, 1)
will always be false undermix
, so the rebar2 dependencies are picked.I believe all other problems derive from there.
Solution
I added detection for mix as another way to use rebar3 dependencies.
Additionally, I bumped the dependency on hackney since it is pointing to a retired version.
To validate successful installation, I published a package in hex with this PR and #170: https://hex.pm/packages/couchbeam_amuino
Caveat
The fix assumes that if mix is detected, rebar3 is available. This is not always true, although mix has had rebar3 support for 2 years, older versions did not.
There is some internal mix API that can be used to explicitly check for rebar3 support, but being internal can be changed anytime. I think 2 years is enough, but if you would prefer to use the explicit checks let me know and I'll update the PR.