chrismccord / mailgun

Elixir Mailgun Client
MIT License
194 stars 95 forks source link

remove ensure_started, add included_applications #25

Closed phanimahesh closed 7 years ago

phanimahesh commented 8 years ago

The application will not be started by BEAM VM if its dependencies are not started. The best way to start an application that only provides modules and has no processes is to have mod:[] in its application resource and run ensure_all_started to start all its dependencies.

However, starting this application is not strictly required if its dependencies have been started. In our case the only dependencies are from erts and are hence automatically started.

A convinience method start/0 is still provided that retains existing functionality by delegating to Application.ensure_all_started/2.

The key :included_applications in mix.exs enables build tooks such as exrm to automatically add the listed apps to release and load them. :poison is added here to enable good release handling.


This change is Reviewable

phanimahesh commented 7 years ago

Closing since this received no attention for a long time. Also I don't recollect what I was thinking back then, but poison should have been in applications, not included_applications. Adding it to included_applications can cause issuess if any other application depends on poison. Technically the conflict will happen only if another app also adds poison to included_applications, but it should be avoided.

Failing to add poison to applications will result in broken releases by relx/reltool etc unless poison is included either directly or by another application in the release. It should be easy to test this. Create a dummy project with just mailgun as a dependency and a dummy module in it, and try building a release. Check under lib/ and poison will be absent. Any calls to Poison will fail with {'EXIT', {undef,... indicating called function is undefined. (Since module is unavailable).