ash-project / ash_postgres

The PostgreSQL data layer for Ash Framework
https://hexdocs.pm/ash_postgres
MIT License
134 stars 73 forks source link

improvement: add DataCase creation for igniter installer #344

Closed ibarakaiev closed 2 months ago

ibarakaiev commented 2 months ago

Contributor checklist

This PR sets up DataCase for testing purposes, unless it already exists, and adds test to elixirc_paths in mix.exs unless elixirc_paths are already defined. For fresh Mix projects, this will do both; for existing Phoenix projects, nothing will happen. This makes it possible to use AshPostgres out of the box even in tests.

Note: this PR is pending https://github.com/ash-project/igniter/pull/38 and https://github.com/ash-project/igniter/pull/37, so it is marked as a draft.

ibarakaiev commented 2 months ago

One side effect of this change is that, when running apply_and_fetch_dependencies/2, the changes to elixirc_paths and the new functions show up, which appear a bit confusing when only dependencies need to be installed.

zachdaniel commented 2 months ago

Got a few things here:

  1. I think that the test/support setup should be code that lives in something like Igniter.Project.Test, and it should potentially happen automatically if you add a file to test/support.
  2. We probably need to make the code for applying dependency changes only apply diffs from the deps/0 function? Is the place that you are calling it manually in ash_money? Maybe we can make adjustments to that process instead.
zachdaniel commented 2 months ago

Will come back to this once the main installer is merged.

zachdaniel commented 2 months ago

Closing in favor of #346

zachdaniel commented 2 months ago

🚀 Thank you for your contribution! 🚀