Skip to content
Merged
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
124 changes: 0 additions & 124 deletions assets/vendor/daisyui-theme.js

This file was deleted.

38 changes: 38 additions & 0 deletions priv/gettext/default.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## This file is a PO Template file.
##
## "msgid"s here are often extracted from source code.
## Add new messages manually only if they're dynamic
## messages that can't be statically extracted.
##
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#
msgid ""
msgstr ""

#: lib/textbin_web/components/core_components.ex:342
#, elixir-autogen, elixir-format
msgid "Actions"
msgstr ""

#: lib/textbin_web/components/layouts.ex:824
#: lib/textbin_web/components/layouts.ex:836
#, elixir-autogen, elixir-format
msgid "Attempting to reconnect"
msgstr ""

#: lib/textbin_web/components/layouts.ex:831
#, elixir-autogen, elixir-format
msgid "Something went wrong!"
msgstr ""

#: lib/textbin_web/components/layouts.ex:819
#, elixir-autogen, elixir-format
msgid "We can't find the internet"
msgstr ""

#: lib/textbin_web/components/core_components.ex:74
#, elixir-autogen, elixir-format
msgid "close"
msgstr ""
41 changes: 41 additions & 0 deletions test/support/migration_repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,45 @@ defmodule Textbin.MigrationRepo do
use Ecto.Repo,
otp_app: :textbin,
adapter: Ecto.Adapters.Postgres

@migrations_path Path.expand("../../priv/repo/migrations", __DIR__)

@doc """
Every migration as a `{version, module}` pair, for `Ecto.Migrator.run/4`.

Passing the migrations path instead makes the migrator compile every file
again on each run, and the `test` alias has already loaded them through
`ecto.migrate`, so each run would print a "redefining module" warning per
migration. The files are compiled once per test run instead.
"""
def migrations do
case :persistent_term.get({__MODULE__, :migrations}, nil) do
nil ->
migrations = load_migrations()
:persistent_term.put({__MODULE__, :migrations}, migrations)
migrations

migrations ->
migrations
end
end

defp load_migrations do
# `ecto.migrate` may have compiled some of these already; this one load
# replaces them with identical code.
ignore_conflicts = Code.get_compiler_option(:ignore_module_conflict)
Code.put_compiler_option(:ignore_module_conflict, true)

try do
for file <- Enum.sort(Path.wildcard(Path.join(@migrations_path, "*.exs"))) do
[version | _name] = file |> Path.basename() |> String.split("_", parts: 2)
modules = for {module, _bytecode} <- Code.compile_file(file), do: module

{String.to_integer(version),
Enum.find(modules, &function_exported?(&1, :__migration__, 0))}
end
after
Code.put_compiler_option(:ignore_module_conflict, ignore_conflicts)
end
end
end
4 changes: 2 additions & 2 deletions test/textbin/accounts/guest_retirement_migration_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule Textbin.Accounts.GuestRetirementMigrationTest do

test "hides guest content, schedules it for purging and leaves accounts alone" do
start_migration_repo!("textbin_guest_migration_#{Ecto.UUID.generate()}")
migrations = Path.expand("../../../priv/repo/migrations", __DIR__)
migrations = MigrationRepo.migrations()
Ecto.Migrator.run(MigrationRepo, migrations, :up, to: @before_retirement, log: false)

guest = insert_account("guest")
Expand All @@ -30,7 +30,7 @@ defmodule Textbin.Accounts.GuestRetirementMigrationTest do

test "deletes guests and their inline pastes, leaving stored content to the cleaner" do
start_migration_repo!("textbin_guest_deletion_#{Ecto.UUID.generate()}")
migrations = Path.expand("../../../priv/repo/migrations", __DIR__)
migrations = MigrationRepo.migrations()
Ecto.Migrator.run(MigrationRepo, migrations, :up, to: @before_retirement, log: false)

inline_guest = insert_account("guest")
Expand Down
2 changes: 1 addition & 1 deletion test/textbin/administration/migration_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defmodule Textbin.Administration.MigrationTest do
Process.unlink(repo)
on_exit(fn -> if Process.alive?(repo), do: GenServer.stop(repo) end)

migrations = Path.expand("../../../priv/repo/migrations", __DIR__)
migrations = MigrationRepo.migrations()
Ecto.Migrator.run(MigrationRepo, migrations, :up, to: @foundation_version)

paste_id = insert_legacy_inline_paste()
Expand Down
2 changes: 1 addition & 1 deletion test/textbin/pastes/workspace_ownership_migration_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule Textbin.Pastes.WorkspaceOwnershipMigrationTest do
Process.unlink(repo)
on_exit(fn -> if Process.alive?(repo), do: GenServer.stop(repo) end)

migrations = Path.expand("../../../priv/repo/migrations", __DIR__)
migrations = MigrationRepo.migrations()
Ecto.Migrator.run(MigrationRepo, migrations, :up, to: @before_organizations_version)

user_id = Ecto.UUID.generate()
Expand Down
Loading