For pleroma.emoji downloaded packs, generate pack.json instead

This commit is contained in:
Ekaterina Vaartis 2019-09-30 16:04:30 +03:00
parent 905bb11747
commit fbe5a00475

View file

@ -158,19 +158,21 @@ defmodule Mix.Tasks.Pleroma.Emoji do
file_list: files_to_unzip file_list: files_to_unzip
) )
IO.puts(IO.ANSI.format(["Writing emoji.txt for ", :bright, pack_name])) IO.puts(IO.ANSI.format(["Writing pack.json for ", :bright, pack_name]))
emoji_txt_str = pack_json = %{
Enum.map( pack: %{
files, "license" => pack["license"],
fn {shortcode, path} -> "homepage" => pack["homepage"],
emojo_path = Path.join("/emoji/#{pack_name}", path) "description" => pack["description"],
"#{shortcode}, #{emojo_path}" "fallback-src" => pack["src"],
end "fallback-src-sha256" => pack["src_sha256"],
) "share-files" => true
|> Enum.join("\n") },
files: files
}
File.write!(Path.join(pack_path, "emoji.txt"), emoji_txt_str) File.write!(Path.join(pack_path, "pack.json"), Jason.encode!(pack_json, pretty: true))
else else
IO.puts(IO.ANSI.format([:bright, :red, "No pack named \"#{pack_name}\" found"])) IO.puts(IO.ANSI.format([:bright, :red, "No pack named \"#{pack_name}\" found"]))
end end