From 077647aa40e42922fe816291a746455e70f7be6d Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sat, 3 Jul 2021 13:14:57 +0100 Subject: [PATCH] feat(meta): initial setup for generating meta json files --- .gitignore | 1 + Brewfile | 3 ++ Makefile | 39 +++++++++++++++++++ .../Casks/emacs-app-good/shield.json.tpl | 9 +++++ .../Casks/emacs-app-nightly/shield.json.tpl | 9 +++++ templates/Casks/emacs-app/shield.json.tpl | 9 +++++ 6 files changed, 70 insertions(+) create mode 100644 .gitignore create mode 100644 Brewfile create mode 100644 Makefile create mode 100644 templates/Casks/emacs-app-good/shield.json.tpl create mode 100644 templates/Casks/emacs-app-nightly/shield.json.tpl create mode 100644 templates/Casks/emacs-app/shield.json.tpl diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..55acb542 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Brewfile.lock.json diff --git a/Brewfile b/Brewfile new file mode 100644 index 00000000..84f8cc75 --- /dev/null +++ b/Brewfile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +brew 'jq' diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..6049c8db --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +TAP = jimeh/emacs-builds + +.DEFAULT: update + +update: casks cask-shields + +# +# Cask Meta +# + +CASKS = $(notdir $(shell \ + brew tap-info --json "$(TAP)" | jq -r '.[0].cask_tokens[]' | sort \ +)) + +CASK_META_FILES = $(foreach c,$(CASKS),Casks/$(c)/meta.json) + +casks: $(CASK_META_FILES) + +.PHONY: $(CASK_META_FILES) +$(CASK_META_FILES): Casks/%/meta.json: + mkdir -p "$(dir $@)" + brew info --cask --json=v2 "$(TAP)/$*" | jq '.casks[0]' > "$@" + +# +# Shields Meta (for shields.io) +# + +CASK_SHIELDS = $(foreach c,$(CASKS),$(if \ + $(shell test -f "templates/Casks/$(c)/shield.json.tpl" && echo ok),$(c),\ +)) +CASK_SHIELD_FILES = $(foreach c,$(CASK_SHIELDS),Casks/$(c)/shield.json) + +cask-shields: $(CASK_SHIELD_FILES) + +.PHONY: $(CASK_SHIELD_FILES) +$(CASK_SHIELD_FILES): Casks/%/shield.json: + mkdir -p "$(dir $@)" + brew info --cask --json=v2 "$(TAP)/$*" | \ + jq ".casks[0] | $$(cat "templates/Casks/$*/shield.json.tpl")" > "$@" diff --git a/templates/Casks/emacs-app-good/shield.json.tpl b/templates/Casks/emacs-app-good/shield.json.tpl new file mode 100644 index 00000000..ce792129 --- /dev/null +++ b/templates/Casks/emacs-app-good/shield.json.tpl @@ -0,0 +1,9 @@ +{ + schemaVersion: 1, + style: "flat", + color: "#7F5AB6", + namedLogo: "GNU Emacs", + logoColor: "white", + label: "known good nightly", + message: .version +} diff --git a/templates/Casks/emacs-app-nightly/shield.json.tpl b/templates/Casks/emacs-app-nightly/shield.json.tpl new file mode 100644 index 00000000..6c6ef6d7 --- /dev/null +++ b/templates/Casks/emacs-app-nightly/shield.json.tpl @@ -0,0 +1,9 @@ +{ + schemaVersion: 1, + style: "flat", + color: "#7F5AB6", + namedLogo: "GNU Emacs", + logoColor: "white", + label: "nightly", + message: .version +} diff --git a/templates/Casks/emacs-app/shield.json.tpl b/templates/Casks/emacs-app/shield.json.tpl new file mode 100644 index 00000000..27263a04 --- /dev/null +++ b/templates/Casks/emacs-app/shield.json.tpl @@ -0,0 +1,9 @@ +{ + schemaVersion: 1, + style: "flat", + color: "#7F5AB6", + namedLogo: "GNU Emacs", + logoColor: "white", + label: "stable", + message: ("v" + .version) +}