aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkballou <kballou@devnulllabs.io>2017-02-07 19:03:23 -0700
committerkballou <kballou@devnulllabs.io>2017-02-07 19:03:23 -0700
commit7d94ed703525c008af23f5284322b79e4a32aa3e (patch)
tree82e888f920cefd8cc009144fb71a9fe38728f4d6
parent9ed32d5917a7a3af500d215b9d266efc97b971ba (diff)
downloadexgit-7d94ed703525c008af23f5284322b79e4a32aa3e.tar.gz
exgit-7d94ed703525c008af23f5284322b79e4a32aa3e.tar.xz
WIP: initial packfile and escript files
-rw-r--r--lib/exgit/escript.ex42
-rw-r--r--lib/exgit/packfile.ex5
-rw-r--r--test/exgit/escript_test.exs11
-rw-r--r--test/exgit/packfile_test.exs4
4 files changed, 62 insertions, 0 deletions
diff --git a/lib/exgit/escript.ex b/lib/exgit/escript.ex
new file mode 100644
index 0000000..b569d64
--- /dev/null
+++ b/lib/exgit/escript.ex
@@ -0,0 +1,42 @@
+defmodule Exgit.Escript do
+ @moduledoc """
+ Escript entry point for Exgit
+ """
+
+ @doc """
+ Main entry for Exgit
+
+ iex> main([])
+ :error
+ """
+ @spec main(List.t) :: binary | :error | {:error, binary}
+ def main([]) do
+ {:error, "Missing Argument"}
+ end
+
+ @doc """
+ Main entry for Exgit
+
+ iex> main(["test.pack"])
+ {:error, "test.pack"}
+ """
+ def main(args) when is_list(args) do
+ args
+ |> hd()
+ |> parse_packfile()
+ |> inspect()
+ |> IO.puts
+ end
+
+ @doc """
+ Parse the provided packfile and display its contents
+
+ iex> parse_packfile("0011223344.pack")
+ {:error, "0011223344.pack"}
+ """
+ @spec parse_packfile(binary) :: {:ok, binary} | {:error, binary}
+ def parse_packfile(packfile) do
+ {:error, packfile}
+ end
+
+end
diff --git a/lib/exgit/packfile.ex b/lib/exgit/packfile.ex
new file mode 100644
index 0000000..4fda345
--- /dev/null
+++ b/lib/exgit/packfile.ex
@@ -0,0 +1,5 @@
+defmodule Exgit.Packfile do
+ @moduledoc """
+ Module for parsing Git Packfiles
+ """
+end
diff --git a/test/exgit/escript_test.exs b/test/exgit/escript_test.exs
new file mode 100644
index 0000000..9f6f984
--- /dev/null
+++ b/test/exgit/escript_test.exs
@@ -0,0 +1,11 @@
+defmodule Exgit.Escript.Test do
+ use ExUnit.Case
+ import Exgit.Escript
+
+ doctest Exgit.Escript
+
+ test "main with arguments returns error" do
+ assert {:error, "test.pack"} == main(["test.pack"])
+ end
+
+end
diff --git a/test/exgit/packfile_test.exs b/test/exgit/packfile_test.exs
new file mode 100644
index 0000000..fd49787
--- /dev/null
+++ b/test/exgit/packfile_test.exs
@@ -0,0 +1,4 @@
+defmodule Exgit.Packfile.Test do
+ use ExUnit.Case
+ doctest Exgit.Packfile
+end