Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps, fix test fails and silence warnings #420

Open
wants to merge 2 commits 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .tool-versions
@@ -0,0 +1 @@
elixir 1.13.0-otp-24
2 changes: 1 addition & 1 deletion config/config.exs
@@ -1,6 +1,6 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config

config :coherence, Coherence.Mailer,
adapter: Swoosh.Adapters.Sendgrid,
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
@@ -1 +1 @@
use Mix.Config
import Config
2 changes: 1 addition & 1 deletion config/prod.exs
@@ -1 +1 @@
use Mix.Config
import Config
3 changes: 2 additions & 1 deletion config/test.exs
@@ -1,4 +1,4 @@
use Mix.Config
import Config

# config :coherence, ecto_repos: [TestCoherence.Repo]

Expand All @@ -25,6 +25,7 @@ config :coherence,
repo: TestCoherence.Repo,
router: TestCoherenceWeb.Router,
module: TestCoherence,
# base: TestCoherence,
web_module: TestCoherenceWeb,
layout: {Coherence.LayoutView, :app},
messages_backend: TestCoherenceWeb.Coherence.Messages,
Expand Down
4 changes: 3 additions & 1 deletion lib/mix/tasks/coh.install.ex
Expand Up @@ -1193,7 +1193,7 @@ defmodule Mix.Tasks.Coh.Install do
|> Mix.Phoenix.inflect()

base = opts[:module] || binding[:base]
web_base = opts[:web_module] || base <> "Web"
web_base = opts[:web_module] || (base <> "Web")
opts = Keyword.put(opts, :base, base)
repo = opts[:repo] || "#{base}.Repo"
router = opts[:router] || "#{web_base}.Router"
Expand Down Expand Up @@ -1377,6 +1377,8 @@ defmodule Mix.Tasks.Coh.Install do
"""
def copy_from(apps, source_dir, target_dir, binding, mapping, config) when is_list(mapping) do
roots = Enum.map(apps, &to_app_source(&1, source_dir))
# skirts around this bug: https://github.com/elixir-lang/elixir/issues/11378
binding = Keyword.new(binding)

create_opts = if config[:confirm], do: [], else: [force: true]

Expand Down
5 changes: 3 additions & 2 deletions mix.exs
Expand Up @@ -19,7 +19,8 @@ defmodule Coherence.Mixfile do
name: "Coherence",
description: """
A full featured, configurable authentication and user management system for Phoenix.
"""
""",
xref: [exclude: [:crypto]],
]
end

Expand Down Expand Up @@ -55,7 +56,7 @@ defmodule Coherence.Mixfile do
{:comeonin, "~> 4.0"},
{:bcrypt_elixir, "~> 1.1"},
{:phoenix, "~> 1.3"},
{:phoenix_html, "~> 2.10"},
# {:phoenix_html, "~> 2.10"},
{:gettext, "~> 0.14"},
{:elixir_uuid, "~> 1.2"},
{:phoenix_swoosh, "~> 0.2"},
Expand Down
45 changes: 23 additions & 22 deletions mix.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/mix/tasks/coh.install_test.exs
Expand Up @@ -36,9 +36,9 @@ defmodule Mix.Tasks.Coh.InstallTest do
"config :coherence,",
"user_schema: TestCoherence.Coherence.User,",
"repo: TestCoherence.Repo,",
"module: TestCoherence",
"router: TestCoherenceWeb.Router",
"web_module: TestCoherenceWeb",
"module: TestCoherence,",
"router: TestCoherenceWeb.Router,",
"web_module: TestCoherenceWeb,",
"messages_backend: TestCoherenceWeb.Coherence.Messages,",
"opts: [:authenticatable]"
]
Expand Down Expand Up @@ -383,7 +383,7 @@ defmodule Mix.Tasks.Coh.InstallTest do
in_tmp("coh_for_rememberable", fn ->
mk_web_path()

~w(--repo=TestCoherence.Repo --authenticatable --rememberable --log-only --no-views --no-templates --migration-path=migrations)
~w(--repo=TestCoherence.Repo --module=TestCoherence --authenticatable --rememberable --log-only --no-views --no-templates --migration-path=migrations)
|> Mix.Tasks.Coh.Install.run()

assert [migration] = Path.wildcard("migrations/*_create_coherence_rememberable.exs")
Expand Down
2 changes: 1 addition & 1 deletion test/support/email.ex
Expand Up @@ -22,7 +22,7 @@ defmodule TestCoherenceWeb.Coherence.UserEmail do

def confirmation(user, url) do
email =
if Config.get(:confirm_email_updates) && user.unconfirmed_email do
if Coherence.Config.get(:confirm_email_updates) && user.unconfirmed_email do
unconfirmed_email(user)
else
user_email(user)
Expand Down
6 changes: 4 additions & 2 deletions test/support/schemas.ex
Expand Up @@ -3,6 +3,8 @@ defmodule TestCoherence.Coherence.Schemas do

import Ecto.Query

alias TestCoherence.Coherence.{Rememberable, Invitation, Trackable}

@user_schema Config.user_schema()
@repo Config.repo()

Expand Down Expand Up @@ -125,14 +127,14 @@ defmodule TestCoherence.Coherence.Schemas do
def last_trackable(user_id) do
schema =
@repo.one(
TestCoherence.Coherence.Trackable
Trackable
|> where([t], t.user_id == ^user_id)
|> order_by(desc: :id)
|> limit(1)
)

case schema do
nil -> TestCoherence.Coherence.Trackable.__struct__()
nil -> Trackable.__struct__()
trackable -> trackable
end
end
Expand Down