Skip to content

Instantly share code, notes, and snippets.

@jerel
Created December 19, 2016 15:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jerel/17d9ec54cce65ce62f06b1d06d88c9d5 to your computer and use it in GitHub Desktop.
Save jerel/17d9ec54cce65ce62f06b1d06d88c9d5 to your computer and use it in GitHub Desktop.
Run seeds in an Elixir Distillery app
defmodule :release_tasks do
def seed do
:ok = Application.load(:myapp)
[:postgrex, :ecto, :logger]
|> Enum.each(&Application.ensure_all_started/1)
Myapp.Repo.start_link
path = Application.app_dir(:myapp, "priv/repo/seeds.exs")
if File.regular?(path) do
Code.require_file(path)
end
:init.stop()
end
end
# now at the command line run ./bin/myapp command release_tasks seed
@GildedHonour
Copy link

Thanks.

@GildedHonour
Copy link

@jerel How can I pass an argument to "seed" via "./bin/myapp command release_tasks seed"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment