+
+ defp add_copyright(_) do
+ year = NaiveDateTime.utc_now().year
+ line1 = "# Pleroma: A lightweight social networking server\\n"
+
+ line2 = "# Copyright © 2017-#{year} Pleroma Authors <https://pleroma.social/>\\n"
+
+ line3 = "# SPDX-License-Identifier: AGPL-3.0-only\\n\\n"
+ template = line1 <> line2 <> line3
+
+ find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) -exec "
+ grep = "grep -L '# Copyright' {} \\; |"
+ xargs = "xargs -n1 sed -i '' '1s;^;#{template};'"
+
+ :os.cmd(String.to_charlist("#{find}#{grep}#{xargs}"))
+ end
+
+ defp bump_copyright(_) do
+ year = NaiveDateTime.utc_now().year
+ find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) |"
+
+ xargs = "xargs sed -i '' 's/# Copyright © 2017-20[0-9][0-9]/# Copyright © 2017-#{year}/'"
+
+ :os.cmd(String.to_charlist("#{find}#{xargs}"))
+ end