Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions Formula/beak.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
class Beak < Formula
desc "A command line interface for your Swift scripts"
desc "Command-line interface for your Swift scripts"
homepage "https://github.com/yonaskolb/Beak"
url "https://github.com/yonaskolb/Beak/archive/0.4.0.tar.gz"
sha256 "c306292c94aadd648437a2334936231baaa9ba195738aeeb28379fcb34900d41"
head "https://github.com/yonaskolb/Beak.git"
url "https://github.com/yonaskolb/Beak.git", :tag => "0.4.0", :revision => "8508e02da82c279b3cf1719bd226dc8c94538a71"

depends_on :xcode
depends_on :xcode => ["10.0", :build]

def install

# fixes an issue an issue in homebrew when both Xcode 9.3+ and command line tools are installed
# see more details here https://github.com/Homebrew/brew/pull/4147
ENV["CC"] = Utils.popen_read("xcrun -find clang").chomp
system "make", "install", "prefix=#{prefix}"
end

build_path = "#{buildpath}/.build/release/beak"
ohai "Building Beak"
system("swift build --disable-sandbox -c release -Xswiftc -static-stdlib")
bin.install build_path
test do
system bin/"beak", "version"
end
end
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
SHELL = /bin/bash

prefix ?= /usr/local
bindir ?= $(prefix)/bin
libdir ?= $(prefix)/lib
srcdir = Sources

REPODIR = $(shell pwd)
BUILDDIR = $(REPODIR)/.build
SOURCES = $(wildcard $(srcdir)/**/*.swift)

.DEFAULT_GOAL = all

.PHONY: all
all: beak

beak: $(SOURCES)
@swift build \
-c release \
--disable-sandbox \
--build-path "$(BUILDDIR)"

.PHONY: install
install: beak
@install -d "$(bindir)" "$(libdir)"
@install "$(BUILDDIR)/release/beak" "$(bindir)"

.PHONY: uninstall
uninstall:
@rm -rf "$(bindir)/beak"

.PHONY: clean
distclean:
@rm -f $(BUILDDIR)/release

.PHONY: clean
clean: distclean
@rm -rf $(BUILDDIR)