Signal drop!
Relay (operand.online) is unreachable.
Usually, a dropped signal means an upgrade is happening. Hold on!
Sorry, no connección.
Hang in there while we get back on track
gram:op
> ./lib/gram.ex
Lenses
(coming soon!)
defmodule Gram do
def address(scheme), do: scheme.address()
def index(scheme) do
scheme |> address |> Path.absname |> File.ls!
|> Enum.filter(& File.exists?(address(scheme) <> &1 <> "/.git"))
end
def nodes(scheme, base, address) do
index = Git.new(address(scheme) <> base) |> Git.ls_files() |> elem(1) |> String.trim |> String.split("\n")
case address do
"~" <> a -> index |> Enum.filter(fn n -> String.contains?(n, a) end)
"" <> a -> index |> Enum.find(fn n -> n == a end)
_ -> index
end
end
# https://mermaid.js.org/syntax/gitgraph.html
# "--graph",
# colors:
# "--format=format:%C(red)%h %G?%C(reset) %C(cyan)(%ai)%C(reset) %C(yellow)%aN:%C(reset) %s %C(blue)%d%C(reset)",
# "--all",
# def graph(scheme, base) do
# end
def changes(scheme, base) do
log = Git.new(address(scheme) <> base) |> Git.log([
# "--all",
"--format=format:%h %G? (%ai) %aN: %s %d",
"--abbrev-commit",
"--date=relative",
]) |> elem(1) |> String.trim |> String.split("\n")
# parse!
log |> Enum.map(fn ln ->
[hash, _signed, "("<>day, clock, zone | message ] = ln |> String.split(" ")
[ _composer | message ] = message |> Enum.join(" ") |> String.split(":")
message = (message |> Enum.join(":"))
labels = []
[message, labels] = if (message |> String.ends_with?(")")) do
[ message | [labels] ] = message |> String.split("(")
[message, labels |> String.trim_trailing(")") |> String.split(",") |> Enum.map(&String.trim/1) ]
else [message, labels] end
[ hash, day, clock, zone, labels, message ]
end)
end
end