Commit b1fe054263a4c268e411244701daaf55cdc01102

Thomas de Grivel 2022-11-04T06:37:18

remove header

diff --git a/lib/header/c.ex b/lib/header/c.ex
deleted file mode 100644
index a9160c6..0000000
--- a/lib/header/c.ex
+++ /dev/null
@@ -1,57 +0,0 @@
-## kmxgit
-## Copyright 2022 kmx.io <contact@kmx.io>
-##
-## Permission is hereby granted to use this software granted
-## the above copyright notice and this permission paragraph
-## are included in all copies and substantial portions of this
-## software.
-##
-## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
-## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
-## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
-## THIS SOFTWARE.
-
-defmodule Header.C do
-  def split(src) do
-    split(src, "")
-  end
-
-  def split("/*" <> rest, "") do
-    split(rest, "/*")
-  end
-  def split("/*" <> rest, acc) do
-    {"", acc <> "/*" <> rest}
-  end
-  def split("*/\n\n" <> rest, acc) do
-    split("*/\n" <> rest, acc)
-  end
-  def split("*/\n" <> rest, acc) do
-    header = acc <> "*/"
-    {header, rest}
-  end
-  def split(<<c, rest::binary>>, acc) when is_binary(acc) do
-    split(rest, acc <> <<c>>)
-  end
-  def split("", acc) do
-    {"", acc}
-  end
-
-  def main([src_path | dest_paths]) do
-    case File.read(src_path) do
-      {:ok, src} ->
-        {header, _} = split(src)
-        Enum.each dest_paths, fn dest_path ->
-          case File.read(dest_path) do
-            {:ok, dest} ->
-              {_, rest} = split(dest)
-              result = header <> "\n" <> rest
-              File.write(dest_path, result)
-            {:error, e} ->
-              IO.inspect("Error: #{dest_path}: #{e}")
-          end
-        end
-      {:error, e} ->
-        IO.inspect "Error: #{src_path}: #{e}"
-    end
-  end
-end
diff --git a/lib/header/make.ex b/lib/header/make.ex
deleted file mode 100644
index 673c058..0000000
--- a/lib/header/make.ex
+++ /dev/null
@@ -1,44 +0,0 @@
-## kmxgit
-## Copyright 2022 kmx.io <contact@kmx.io>
-##
-## Permission is hereby granted to use this software granted
-## the above copyright notice and this permission paragraph
-## are included in all copies and substantial portions of this
-## software.
-##
-## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
-## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
-## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
-## THIS SOFTWARE.
-
-defmodule Header.Make do
-  def split(src) do
-    split(src, [])
-  end
-
-  def split([line = ("#" <> _) | rest], acc) do
-    split(rest, [line | acc])
-  end
-  def split([line | rest], acc) do
-    case Regex.run(~r/^\s*$/, line) do
-      [_] -> split(rest, acc)
-      _ ->
-        acc = Enum.reverse(acc) |> Enum.join("\n")
-        rest = [line | rest] |> Enum.join("\n")
-        {acc, rest}
-    end
-  end
-
-  def main([src_path | dest_paths]) do
-    {:ok, src} = File.read(src_path)
-    src_lines = String.split(src, "\n")
-    {header, _} = split(src_lines)
-    Enum.each dest_paths, fn dest_path ->
-      {:ok, dest} = File.read(dest_path)
-      dest_lines = String.split(dest, "\n")
-      {_, rest} = split(dest_lines)
-      result = header <> "\n\n" <> rest
-      File.write(dest_path, result)
-    end
-  end
-end
diff --git a/lib/mix/tasks/licence.ex b/lib/mix/tasks/licence.ex
deleted file mode 100644
index 7341ee8..0000000
--- a/lib/mix/tasks/licence.ex
+++ /dev/null
@@ -1,45 +0,0 @@
-## kmxgit
-## Copyright 2022 kmx.io <contact@kmx.io>
-##
-## Permission is hereby granted to use this software granted
-## the above copyright notice and this permission paragraph
-## are included in all copies and substantial portions of this
-## software.
-##
-## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
-## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
-## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
-## THIS SOFTWARE.
-
-defmodule Mix.Tasks.Licence do
-  use Mix.Task
-
-  def update(src_path, dest) do
-    module = case src_path do
-               "Makefile" -> Header.Make
-               "configure" -> Header.Make
-               "config.subr" -> Header.Make
-               _ ->
-                 case Regex.run(~r/[.][ch]$/, src_path) do
-                   [_] -> Header.C
-                   _ ->
-                     case Regex.run(~r/[.]exs?$/, src_path) do
-                       [_] -> Header.Make
-                       _ -> raise "error"
-                     end
-                 end
-             end
-    module.main([src_path | dest])
-  end
-
-  def run(_) do
-    {c_files, 0} = System.cmd("find", ["c_src", "-name", "[a-z]*.c",
-                                       "-or", "-name", "[a-z]*.h"])
-    {ex_files, 0} = System.cmd("find", ["lib", "-name", "[a-z]*.ex",
-                                        "-or", "-name", "[a-z]*.exs"])
-    c_files = c_files |> String.split("\n") |> Enum.filter(& &1 != "")
-    ex_files = ex_files |> String.split("\n") |> Enum.filter(& &1 != "")
-    update("c_src/git_nif.c", c_files)
-    update("lib/kmxgit.ex", ex_files)
-  end
-end