Merge branch 'feat/bump-tlds' into 'master'

Add alias to bump TLDs list easily

See merge request pleroma/elixir-libraries/linkify!39
This commit is contained in:
feld 2021-01-28 15:45:30 +00:00
commit c878e0da93

15
mix.exs
View file

@ -10,6 +10,7 @@ defmodule Linkify.Mixfile do
elixir: "~> 1.8", elixir: "~> 1.8",
build_embedded: Mix.env() == :prod, build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod, start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(), deps: deps(),
docs: [extras: ["README.md"]], docs: [extras: ["README.md"]],
package: package(), package: package(),
@ -41,4 +42,18 @@ defmodule Linkify.Mixfile do
files: ~w(lib priv README.md mix.exs LICENSE) files: ~w(lib priv README.md mix.exs LICENSE)
] ]
end end
defp aliases do
[
"update.tlds": &update_tlds/1
]
end
defp update_tlds(_) do
:os.cmd(
String.to_charlist(
"curl https://data.iana.org/TLD/tlds-alpha-by-domain.txt | tr '[:upper:]' '[:lower:]' | tail -n +2 > priv/tlds.txt"
)
)
end
end end