action-requests-demo.jamey..../lib/action_requests_demo/release.ex
James Greenwood 0f56a13bd8
All checks were successful
build / build (push) Successful in 28s
Add release script
2025-11-17 09:27:28 +00:00

29 lines
757 B
Elixir

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