Skip to content
This repository was archived by the owner on Dec 22, 2020. It is now read-only.

added phoenix as library to application + warning cleanups #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions lib/mix/tasks/passport.setup.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule Mix.Tasks.Passport.Setup do
use Mix.Task

alias Mix.Phoenix.Context
@shortdoc "Generates controller, model and views for authentication resource"

@moduledoc """
Expand All @@ -13,8 +12,8 @@ defmodule Mix.Tasks.Passport.Setup do
with :ok <- generate_account(paths),
:ok <- generate_auth(paths),
:ok <- generate_web(paths),
:ok <- generate_config do
print_shell_instructions
:ok <- generate_config() do
print_shell_instructions()
end
end

Expand Down Expand Up @@ -83,27 +82,6 @@ defmodule Mix.Tasks.Passport.Setup do
:ok = File.close(file)
end

defp copy_new_files(_context, paths, binding) do
web_prefix = Mix.Phoenix.web_prefix()
[context: context, user_schema: user_schema, password_schema: password_schema] = binding

Mix.Phoenix.copy_from paths, "priv/templates/passport.install", "", binding, [
{:eex, "session_controller.ex", Path.join(web_prefix, "controllers/session_controller.ex")},
{:eex, "registration_controller.ex", Path.join(web_prefix, "controllers/registration_controller.ex")},
{:eex, "login.html.eex", Path.join(web_prefix, "templates/session/new.html.eex")},
{:eex, "register.html.eex", Path.join(web_prefix, "templates/registration/new.html.eex")},
{:eex, "session_view.ex", Path.join(web_prefix, "views/session_view.ex")},
{:eex, "registration_view.ex", Path.join(web_prefix, "views/registration_view.ex")},
{:eex, "user_schema.ex", user_schema.file},
{:eex, "password_schema.ex", password_schema.file},
{:eex, "registration_password_schema.ex", Path.join(context.dir, "registration_password.ex")},
{:eex, "user_migration.exs", "priv/repo/migrations/#{timestamp()}_create_passport_user_table.exs"},
{:eex, "password_migration.exs", "priv/repo/migrations/#{timestamp()}_create_passport_password_table.exs"},
{:eex, "context.ex", context.file},
]
context
end

defp print_shell_instructions() do
base = Mix.Phoenix.base()
Mix.shell.info """
Expand Down
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ defmodule Passport.Mixfile do
# Type "mix help compile.app" for more information
def application do
# Specify extra applications you'll use from Erlang/Elixir
[extra_applications: [:logger]]
[
applications: [:phoenix],
extra_applications: [:logger]
]
end

# Dependencies can be Hex packages:
Expand Down