This commit is contained in:
parent
e19286d0e6
commit
0f56a13bd8
28
lib/action_requests_demo/release.ex
Normal file
28
lib/action_requests_demo/release.ex
Normal file
@ -0,0 +1,28 @@
|
||||
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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user