Skip to content

Instantly share code, notes, and snippets.

@BenMorganIO
Last active March 17, 2017 01:56
Show Gist options
  • Save BenMorganIO/bfd5907e7341d1884e3173ca460414ce to your computer and use it in GitHub Desktop.
Save BenMorganIO/bfd5907e7341d1884e3173ca460414ce to your computer and use it in GitHub Desktop.
$ mix ryal.install
==> ryal_core
Compiling 1 file (.ex)
** (UndefinedFunctionError) function App.Repo.config/0 is undefined (module App.Repo is not available)
App.Repo.config()
lib/mix/ecto.ex:162: Mix.Ecto.build_repo_priv/1
lib/mix/ecto.ex:148: Mix.Ecto.migrations_path/1
lib/mix/tasks/ryal.core.install.ex:46: Mix.Tasks.Ryal.Core.Install.project_migration_dir/0
lib/mix/tasks/ryal.core.install.ex:9: Mix.Tasks.Ryal.Core.Install.run/1
(mix) lib/mix/task.ex:294: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
(elixir) lib/code.ex:370: Code.require_file/2
# Location on Github:
#
# https://github.com/ryal/ryal/blob/master/apps/ryal_core/lib/mix/tasks/ryal.core.install.ex
#
defmodule Mix.Tasks.Ryal.Core.Install do
@moduledoc "Installs all Ryal Core migrations."
use Mix.Task
alias Mix.Ecto
def run(_) do
File.mkdir_p project_migration_dir()
stamp = String.to_integer timestamp()
ryal_core_migrations()
|> Stream.with_index
|> Enum.each(fn({ryal_core_migration, index}) ->
migration = "#{stamp + index}_#{migration_name(ryal_core_migration)}"
copy_migration(ryal_core_migration, migration)
end)
end
# ...
defp project_migration_dir do
dir = Ecto.migrations_path Ryal.repo() # <-- the offending line of code
marketplace? = Application.get_env(:ryal_core, :marketplace)
if marketplace?, do: marketplace_migrations_folder(dir), else: dir
end
# ...
end
# Location on Github:
#
# https://github.com/ryal/ryal/blob/master/apps/ryal_core/lib/ryal.ex
#
defmodule Ryal do
@repo Application.get_env(:ryal_core, :repo)
def repo, do: @repo
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment