defmodule ActionRequestsDemo.Release do @moduledoc """ Helpers for running tasks in a release environment. This module is intended for commands invoked via: bin/action_requests_demo eval "ActionRequestsDemo.Release.seed()" """ @app :action_requests_demo @doc """ Run the database seeds script inside a release. Ensures the main application and Faker are started, then evaluates the standard `priv/repo/seeds.exs` file. """ def seed do # Make sure the application (and its supervision tree) is running {:ok, _} = Application.ensure_all_started(@app) {:ok, _} = Application.ensure_all_started(:faker) seeds_path = Application.app_dir(@app, "priv/repo/seeds.exs") Code.require_file(seeds_path) end end