Chart of projects

I used to keep a chart of all the software projects I worked on and how they connected to each other. I just automated it for my crystal projects and … it’s a thing!

Dotted lines means “planned”, ovals are forks of other people’s projects, round are the ones I started, flag-shaped ones are websites.

2 Likes

Oh that’s a cool idea. How did you automate it?

Maybe “automated” is a bit generous :-D

I did a checkout of all my repos:

gh repo list -L 100 --no-archived | cut -f1 | grep -v mediadores | while read REPO; do git clone git@github.com:$REPO.git; done

Kept the crystal ones, then moved the ones that are forks to a forks/ folder, and ran this script (which has a lot of things that will make no sense for anyone else)

The “forks” thing could be automated by using the gh API to tell those apart.

from glob import glob

print("graph LR")
sites = [ "faaso.ralsina.me",
         "nicolino.ralsina.me",
         "nombres.ralsina.me",
         "ralsina.me",
         "tapas.ralsina.me",
        ]

for site in sites:
    print(f"  {site}>{site}]")

nicolino_sites = ["faaso.ralsina.me", "nicolino.ralsina.me", ]
faaso_sites = ["nombres.ralsina.me", "tapas.ralsina.me",]
caddy_sites = [ "faaso.ralsina.me",
         "nicolino.ralsina.me",
         "ralsina.me",
        ]

planned = [
        ("nicolino", "markd"),
        ("nicolino", "cr-wren"),
        ("crycco", "libctags.cr"),
        ("crycco", "crystal-ctags"),
        ]

for repo in glob("*/"):
    repo = repo.strip("/")
    if repo == "forks":
        continue
    print(f"  {repo}(({repo}))")

for repo in glob("forks/*/"):
    repo = repo.split("/")[-2]
    print(f"  {repo}([{repo}])")

for s in nicolino_sites:
    print(f"  {s} ---> nicolino")
for s in faaso_sites:
    print(f"  {s} ---> faaso")
for s in caddy_sites:
    print(f"  {s} ---> caddy-static")

def ralsina_deps(shard):
    pass

for shard in glob("**/shard.yml"):
    repo = shard.split("/")[-2]
    for line in open(shard).readlines():
        if "ralsina/" in line or "markd" in line:
            dest = line.split(":")[-1].split("/")[-1]
            if not dest.strip(): continue
            print(f"  {repo} ---> {dest}")

for a,b in planned:
    print(f"{a} -.-> {b}")

Then mmdc -i rpu.mermaid -o rpu.png

1 Like

Have you tried to run mmdc from within a crystal program? I’m beating my head against Process.run and getting the right combination of command line options. Any lessons learned if yes?

No, but I have ran a number of programs :-D

Want to start a thread with your code? We can see what’s wrong.