Skip to content

Commit

Permalink
Force homebrew installation to download binary rather than building f…
Browse files Browse the repository at this point in the history
…rom source. Removes Golang dependency
  • Loading branch information
Nathan Dines committed Nov 30, 2018
1 parent 382f612 commit ade4f19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
9 changes: 5 additions & 4 deletions Makefile
Expand Up @@ -48,11 +48,12 @@ godiff:
BREW_FORMULA := homebrew/forge.rb
brew-release:
$(eval FORGE_VERSION ?= $(shell '$(BINARY)' --version | awk '{ print $$NF }'))
$(eval ARCHIVE_URL := https://github.com/nathandines/forge/archive/$(FORGE_VERSION).tar.gz)
$(eval ARCHIVE_SHA256 := $(shell curl -o - -Ls '$(ARCHIVE_URL)' | shasum -a 256 | awk '{ print $$1 }'))
$(eval BIN_URL := https://github.com/nathandines/forge/releases/download/$(FORGE_VERSION)/forge_$(FORGE_VERSION)_darwin_amd64)
$(eval BIN_SHA256 := $(shell curl -o - -Ls '$(BIN_URL)' | shasum -a 256 | awk '{ print $$1 }'))
[ -d homebrew ] || git clone 'git@github.com:nathandines/homebrew-tap.git' 'homebrew'
sed -e 's;{{ archive_url }};$(ARCHIVE_URL);g' \
-e 's;{{ archive_sha256 }};$(ARCHIVE_SHA256);g' \
sed -e 's;{{ bin_url }};$(BIN_URL);g' \
-e 's;{{ bin_sha256 }};$(BIN_SHA256);g' \
-e 's;{{ version }};$(FORGE_VERSION:v%=%);g' \
homebrew_formula.rb.template > '$(BREW_FORMULA)'
brew audit --strict '$(BREW_FORMULA)'
cd 'homebrew' && \
Expand Down
16 changes: 7 additions & 9 deletions homebrew_formula.rb.template
@@ -1,21 +1,19 @@
class Forge < Formula
desc "Continuous Delivery friendly CloudFormation deployment tool"
homepage "https://github.com/nathandines/forge"
url "{{ archive_url }}"
sha256 "{{ archive_sha256 }}"
url "{{ bin_url }}"
version "{{ version }}"
sha256 "{{ bin_sha256 }}"

bottle :unneeded

depends_on "go" => :build

def install
system "make", "build"

bin.mkpath
bin.install "bin/forge"
bin.install "forge_v{{ version }}_darwin_amd64"
mv bin/"forge_v{{ version }}_darwin_amd64", bin/"forge"

(bash_completion/"forge").write(`#{bin}/forge gen-bash-completion`)
(zsh_completion/"forge").write(`#{bin}/forge gen-zsh-completion`)
(bash_completion/"forge").write(bin/"forge gen-bash-completion")
(zsh_completion/"forge").write(bin/"forge gen-zsh-completion")

prefix.install_metafiles
end
Expand Down

0 comments on commit ade4f19

Please sign in to comment.