From f3e693760a78eb65b981c4f47e0b75d0826f3507 Mon Sep 17 00:00:00 2001 From: chevdor Date: Wed, 9 Jun 2021 17:50:03 +0200 Subject: [PATCH] ci: add Homebrew formula and template --- Formula/README.adoc | 9 +++++++++ Formula/data.yaml | 7 +++++++ Formula/template.tera | 14 ++++++++++++++ Formula/tera.rb | 11 +++++++++++ 4 files changed, 41 insertions(+) create mode 100644 Formula/README.adoc create mode 100644 Formula/data.yaml create mode 100644 Formula/template.tera create mode 100644 Formula/tera.rb diff --git a/Formula/README.adoc b/Formula/README.adoc new file mode 100644 index 0000000..026868c --- /dev/null +++ b/Formula/README.adoc @@ -0,0 +1,9 @@ +You may test your template/data with: + + c watch -i Formula/tera.rb -s "tera -t Formula/template.tera Formula/data.yaml -o Formula/tera.rb" + +and render with: + + tera -t Formula/template.tera Formula/data.yaml -o Formula/tera.rb + +NOTE: The template covers a few default values so you don't need to pass everything. diff --git a/Formula/data.yaml b/Formula/data.yaml new file mode 100644 index 0000000..f33d50d --- /dev/null +++ b/Formula/data.yaml @@ -0,0 +1,7 @@ +name: Tera +site: https://github.com +repo: chevdor/tera-cli +archive: "{{ name }}-mac-v1.2.3.tar.gz" +description: A command line utility written in Rust to render templates using the tera templating engine +version: 1.2.3 +sha256: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b diff --git a/Formula/template.tera b/Formula/template.tera new file mode 100644 index 0000000..ff02675 --- /dev/null +++ b/Formula/template.tera @@ -0,0 +1,14 @@ +{% set bin = bin | default(value=name | lower) %} +{%- set homepage = homepage | default(value=site ~ "/" ~ repo) -%} + +class {{ name }} < Formula + desc "{{ description }}" + homepage "{{ homepage}}" + url "{{ site }}/{{ repo }}/releases/download/v{{ version}}/{{ archive | default(value= bin ~"-mac-v" ~ version) }}.tar.gz " + sha256 "{{ sha256 }}" + version "{{ version }}" + + def install + bin.install "{{ bin }}" + end +end diff --git a/Formula/tera.rb b/Formula/tera.rb new file mode 100644 index 0000000..c806764 --- /dev/null +++ b/Formula/tera.rb @@ -0,0 +1,11 @@ +class Tera < Formula + desc "A command line utility written in Rust to render templates using the tera templating engine" + homepage "https://github.com/chevdor/tera-cli" + url "https://github.com/chevdor/tera-cli/releases/download/v1.2.3/{{ name }}-mac-v1.2.3.tar.gz.tar.gz " + sha256 "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" + version "1.2.3" + + def install + bin.install "tera" + end +end