polyfy / polylith

A tool used to develop Polylith based architectures in Clojure.
Eclipse Public License 1.0
514 stars 47 forks source link

Rewrite create-*.sh bash scripts in babashka #385

Closed lread closed 10 months ago

lread commented 10 months ago

Convert create-example.sh, create-example-images.sh, help.sh, help-doc.sh, update-commands-doc.sh to bb tasks. (Also deleted stale local-dep-old-format.sh and local.sh which had been incorporated into create-example.sh)

Scripts now also run on Linux. The bash scripts used sed and mktemp in ways that only worked on macOS. Since we are now using babashka, we no longer need to make use of these cmds and are therefore now support both macOS and Linux.

New bb tasks:

Nitty Gritty fixes:

components-tree.txt now generating to output dir (was generating to temp dir)

no longer generating extra overview.png and info.png to scripts/output dir (still generating to images dir)

add missing txt output for (only image was being generated): poly info :no-changes brick:cli :all-bricks fake-sha:e7ebe68

add :no-changes to polyx overview.png to match Polyx docs.

clearly distinguish generated images from hand-crafted ones: add output dir before png filename.

Other changes:

For each spawned command now clearly logging cwd, command, and stdout redirection (if specified).

I felt automatically updating clojure to the latest version was beyond the scope of what this script should do. It also assumed brew usage and therefore macOS. We now instead fail fast if the installed version of clojure is not the latest.

Now explicitly checking for prerequisite tools: clojure, git, tree. We assert for a min version of tree, older versions counted dirs differently.

Now generating a single root tmp work dir for all tmp generated work. This makes review and cleanup easier.

Now building poly and polyx jars and invoking them via java -jar in the same way a stand-alone install would and avoids manual pre-setup required by old bash scripts.

Because the poly and polyx jars take a while to build, only rebuilding if there have been changes.

Dir tree output now includes distinguishing trailing forward slash for directories.

Change test output to match new formatting in docs:

Clone from GitHub via https protocol. This allows the script to be run by folks who have not setup their git ssh keys.

Modified gen-nav to print filename it is generating to stdout. This removes unnecessary mystery for those unfamiliar with what gen-nav does.

Added --no-pager option with using git log. I was finding pager was being invoked on during some macOS testing.

lread commented 10 months ago

@tengstrand here's what I've got so far. Please take time to read the commit message, it should answer many questions.