Skip to content

Commit

Permalink
docs: changelog formatting - bodies as comments
Browse files Browse the repository at this point in the history
I'm hopeful this ends up being more readable.
  • Loading branch information
russmatney committed Mar 21, 2024
1 parent 7e210ae commit 30eb286
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 33 deletions.
34 changes: 21 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- feat: generating initial changelog ([7e210ae](https://github.com/russmatney/log/commit/7e210ae), 21 Mar 2024)

- wip: bb code gathering commits per tag ([f3be3be](https://github.com/russmatney/log/commit/f3be3be), 21 Mar 2024)

## v0.0.0
Expand All @@ -16,30 +18,34 @@

- docs: attempt to make org/github rendering work better ([77cebdc](https://github.com/russmatney/log/commit/77cebdc), 20 Mar 2024)

surprised the image name/captions don't work!
> surprised the image name/captions don't work!
- Create LICENSE ([fcf7aed](https://github.com/russmatney/log/commit/fcf7aed), 20 Mar 2024)

- docs: readme todos update ([59d76e8](https://github.com/russmatney/log/commit/59d76e8), 20 Mar 2024)

- feat: readme images and example.gd ([134072c](https://github.com/russmatney/log/commit/134072c), 20 Mar 2024)

also refactors to_pretty to use an opts dictionary instead of continuing
to add optional params. This should create some space for more options
and clean up the impl going forward.
> also refactors to_pretty to use an opts dictionary instead of continuing
> to add optional params. This should create some space for more options
> and clean up the impl going forward.
- feat: support Object.to_printable() via duck-typing ([1bce1eb](https://github.com/russmatney/log/commit/1bce1eb), 20 Mar 2024)

Any object can now opt-in to some other logged form by implementing an
arg-less to_printable() function.

I wanted something cute, but `log()` already does logarithms, and pr()
or pp() felt obscure for a public function.
> Any object can now opt-in to some other logged form by implementing an
> arg-less to_printable() function.
>
> I wanted something cute, but `log()` already does logarithms, and pr()
> or pp() felt obscure for a public function.
- chore: test coverage for strings ([537e43a](https://github.com/russmatney/log/commit/537e43a), 20 Mar 2024)

- fix: run ci on push ([b900292](https://github.com/russmatney/log/commit/b900292), 20 Mar 2024)

- ci: initial gdunit4 github action ([ab2553c](https://github.com/russmatney/log/commit/ab2553c), 20 Mar 2024)

Straight outta https://mikeschulze.github.io/gdUnit4/faq/ci/
> Straight outta https://mikeschulze.github.io/gdUnit4/faq/ci/
- dep: add gd-plug-ui ([737f4d5](https://github.com/russmatney/log/commit/737f4d5), 20 Mar 2024)

- feat: update gdUnit4 ([05213c0](https://github.com/russmatney/log/commit/05213c0), 20 Mar 2024)
Expand All @@ -50,11 +56,13 @@

- test: quick dictionary test ([c70815a](https://github.com/russmatney/log/commit/c70815a), 9 Mar 2024)

just copy-pasting the output back into the test. aka snapshot testing?
> just copy-pasting the output back into the test. aka snapshot testing?
- chore: clean up some bits ([ed7b0c3](https://github.com/russmatney/log/commit/ed7b0c3), 9 Mar 2024)

Experimented with more readable bbcode output, only to learn that you
can just 'print' it. heh.
> Experimented with more readable bbcode output, only to learn that you
> can just 'print' it. heh.
- test: impl some basic tests ([0ca946f](https://github.com/russmatney/log/commit/0ca946f), 9 Mar 2024)

- feat: first basic test running (and failing) ([64c0d23](https://github.com/russmatney/log/commit/64c0d23), 16 Feb 2024)
Expand Down
25 changes: 5 additions & 20 deletions bb/changelog.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
[clojure.string :as string]
[clojure.edn :as edn]
[babashka.process :as process]
[babashka.fs :as fs]
[clojure.java.shell :as clj-sh]
))

(def changelog-path "CHANGELOG.md")
(def repo-dir "~/russmatney/log")

(defn partition-by-newlines [lines]
(->> lines
(partition-by #{""})
(remove (comp #{""} first))))

(defn bash [command]
(clj-sh/sh "bash" "-c" command))

Expand Down Expand Up @@ -64,7 +58,6 @@
"}"))

(defn first-commit-hash [{:keys [dir]}]
;; NOTE crashes/throws when no tags exist
(->
^{:out :string :dir (str dir)}
(process/$ git rev-list --max-parents=0 HEAD)
Expand All @@ -74,7 +67,6 @@
(-> res :out string/trim-newline))))))

(defn last-tag [{:keys [dir]}]
;; NOTE crashes/throws when no tags exist
(->
^{:out :string :dir (str dir)}
(process/$ git describe --tags --abbrev=0)
Expand All @@ -84,7 +76,6 @@
(-> res :out string/trim-newline))))))

(defn all-tags [{:keys [dir]}]
;; NOTE crashes/throws when no tags exist
(->
^{:out :string :dir (str dir)}
(process/$ git describe --tags --abbrev=0)
Expand All @@ -99,14 +90,8 @@
(first-commit-hash {:dir (expand "~/russmatney/log")}))

(defn commits
"Retuns metadata for `n` commits at the specified `dir`.
;; TODO support before/after
;; TODO rename, probably just `commits`
"
[{:keys [dir n
after-tag
before-tag]
:as opts}]
"Retuns metadata for `n` commits at the specified `dir`."
[{:keys [dir n after-tag before-tag] :as opts}]
(let [n (or n 500)
cmd
(str "git log" (str " -n " n)
Expand Down Expand Up @@ -184,13 +169,13 @@


(defn commit->lines [commit]
;; TODO make hyperlink
[(str "- " (:commit/subject commit) " (" (commit-hash-link commit) ", " (commit-date commit) ")")
(when (seq (:commit/body commit))
(str "\n" (->> (:commit/body commit)
(string/split-lines)
(map #(str " " %))
(string/join "\n"))))])
(map #(str " > " %))
(string/join "\n"))
"\n"))])

(defn tag-section [[tag commits]]
(let [headline (str "## " (cond
Expand Down

0 comments on commit 30eb286

Please sign in to comment.