Skip to content

Commit

Permalink
chore: fix deprecation warnings from igniter
Browse files Browse the repository at this point in the history
zachdaniel committed Oct 7, 2024
1 parent 77e3dfb commit 21b923e
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/data_layer.ex
Original file line number Diff line number Diff line change
@@ -3014,7 +3014,7 @@ defmodule AshPostgres.DataLayer do
repo =
case options[:repo] do
nil ->
Igniter.Code.Module.module_name(igniter, "Repo")
Igniter.Project.Module.module_name(igniter, "Repo")

repo ->
Igniter.Code.Module.parse(repo)
8 changes: 4 additions & 4 deletions lib/igniter.ex
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ defmodule AshPostgres.Igniter do
end

def add_postgres_extension(igniter, repo_name, extension) do
Igniter.Code.Module.find_and_update_module!(igniter, repo_name, fn zipper ->
Igniter.Project.Module.find_and_update_module!(igniter, repo_name, fn zipper ->
case Igniter.Code.Function.move_to_def(zipper, :installed_extensions, 0) do
{:ok, zipper} ->
case Igniter.Code.List.append_new_to_list(zipper, extension) do
@@ -77,11 +77,11 @@ defmodule AshPostgres.Igniter do
case list_repos(igniter) do
{igniter, []} ->
if generate do
repo = Igniter.Code.Module.module_name(igniter, "Repo")
repo = Igniter.Project.Module.module_name(igniter, "Repo")
otp_app = Igniter.Project.Application.app_name(igniter)

igniter =
Igniter.Code.Module.create_module(
Igniter.Project.Module.create_module(
igniter,
repo,
default_repo_contents(otp_app, repo, opts),
@@ -102,7 +102,7 @@ defmodule AshPostgres.Igniter do
end

def list_repos(igniter) do
Igniter.Code.Module.find_all_matching_modules(igniter, fn _mod, zipper ->
Igniter.Project.Module.find_all_matching_modules(igniter, fn _mod, zipper ->
move_to_repo_use(zipper) != :error
end)
end
16 changes: 8 additions & 8 deletions lib/mix/tasks/ash_postgres.install.ex
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ defmodule Mix.Tasks.AshPostgres.Install do
repo =
case opts[:repo] do
nil ->
Igniter.Code.Module.module_name(igniter, "Repo")
Igniter.Project.Module.module_name(igniter, "Repo")

repo ->
Igniter.Code.Module.parse(repo)
@@ -275,7 +275,7 @@ defmodule Mix.Tasks.AshPostgres.Install do
end

defp setup_data_case(igniter) do
module_name = Igniter.Code.Module.module_name(igniter, "DataCase")
module_name = Igniter.Project.Module.module_name(igniter, "DataCase")

default_data_case_contents = ~s|
@moduledoc """
@@ -297,24 +297,24 @@ defmodule Mix.Tasks.AshPostgres.Install do
using do
quote do
alias #{inspect(Igniter.Code.Module.module_name(igniter, "Repo"))}
alias #{inspect(Igniter.Project.Module.module_name(igniter, "Repo"))}
import Ecto
import Ecto.Changeset
import Ecto.Query
import #{inspect(Igniter.Code.Module.module_name(igniter, "DataCase"))}
import #{inspect(Igniter.Project.Module.module_name(igniter, "DataCase"))}
end
end
setup tags do
pid = Ecto.Adapters.SQL.Sandbox.start_owner!(#{inspect(Igniter.Code.Module.module_name(igniter, "Repo"))}, shared: not tags[:async])
pid = Ecto.Adapters.SQL.Sandbox.start_owner!(#{inspect(Igniter.Project.Module.module_name(igniter, "Repo"))}, shared: not tags[:async])
on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
:ok
end
|

igniter
|> Igniter.Code.Module.find_and_update_or_create_module(
|> Igniter.Project.Module.find_and_update_or_create_module(
module_name,
default_data_case_contents,
# do nothing if already exists
@@ -324,7 +324,7 @@ defmodule Mix.Tasks.AshPostgres.Install do
end

defp setup_repo_module(igniter, otp_app, repo, opts) do
{exists?, igniter} = Igniter.Project.Module.module_exists?(igniter, repo)
{exists?, igniter} = Igniter.Project.Module.module_exists(igniter, repo)

if exists? do
Igniter.Project.Module.find_and_update_module!(
@@ -368,7 +368,7 @@ defmodule Mix.Tasks.AshPostgres.Install do
repo,
&configure_installed_extensions_function/1
)
|> Igniter.Code.Module.find_and_update_module!(
|> Igniter.Project.Module.find_and_update_module!(
repo,
&configure_min_pg_version_function(&1, repo, opts)
)
2 changes: 1 addition & 1 deletion lib/resource_generator/resource_generator.ex
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ defmodule AshPostgres.ResourceGenerator do

igniter
|> Ash.Domain.Igniter.add_resource_reference(domain, table_spec.resource)
|> Igniter.Code.Module.create_module(table_spec.resource, resource)
|> Igniter.Project.Module.create_module(table_spec.resource, resource)
|> then(fn igniter ->
if opts[:extend] do
Igniter.compose_task(igniter, "ash.patch.extend", [

0 comments on commit 21b923e

Please sign in to comment.