Skip to content

Commit afe87e7

Browse files
committed
Reduce nesting
1 parent cb9da0d commit afe87e7

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

lib/phoenix_container_example/release.ex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ defmodule PhoenixContainerExample.Release do
7272
load_app()
7373

7474
for repo <- repos() do
75-
path = Path.join(repo_path(repo), file)
75+
run_seed(repo, file)
76+
end
77+
end
7678

77-
if File.exists?(path) do
78-
Logger.info("Running #{inspect(repo)} seed #{path}")
79-
{:ok, _, _} = Ecto.Migrator.with_repo(repo, fn _ -> Code.require_file(path) end)
80-
end
79+
defp run_seed(repo, file) do
80+
path = Path.join(repo_path(repo), file)
81+
82+
if File.exists?(path) do
83+
Logger.info("Running #{inspect(repo)} seed #{path}")
84+
{:ok, _, _} = Ecto.Migrator.with_repo(repo, fn _ -> Code.require_file(path) end)
8185
end
8286
end
8387

0 commit comments

Comments
 (0)