Skip to content

Commit

Permalink
ci: add Homebrew formula and template
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Jun 9, 2021
1 parent 4ccdcdf commit f3e6937
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Formula/README.adoc
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 7 additions & 0 deletions Formula/data.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions Formula/template.tera
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions Formula/tera.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f3e6937

Please sign in to comment.