55 lines
1.9 KiB
Ruby
55 lines
1.9 KiB
Ruby
class Sourcery < Formula
|
|
desc "Meta-programming for Swift, stop writing boilerplate code."
|
|
homepage "https://github.com/krzysztofzablocki/Sourcery"
|
|
url "https://github.com/krzysztofzablocki/Sourcery/archive/0.5.9.tar.gz"
|
|
sha256 "1f5dee5184a7271a70552c0e85dd1d730e711088e5fdcf3dd7aa1f96b993e414"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "965e3b2bf5ffadb428f83c9514efabc4a9a8eacbe6a92ea37dcaf98feefb48b8" => :sierra
|
|
sha256 "45b5e5a455da4fd652d6ad03504f1966eb5e5ebf0c93174ab231d8e057478510" => :el_capitan
|
|
end
|
|
|
|
depends_on :xcode => ["8.0", :build]
|
|
|
|
def install
|
|
ENV.delete("CC")
|
|
ENV["SDKROOT"] = MacOS.sdk_path
|
|
system "swift", "build", "-c", "release"
|
|
bin.install ".build/release/sourcery"
|
|
lib.install Dir[".build/release/*.dylib"]
|
|
end
|
|
|
|
test do
|
|
# Tests are temporarily disabled because of sandbox issues,
|
|
# as Sourcery tries to write to ~/Library/Caches/Sourcery
|
|
# See https://github.com/krzysztofzablocki/Sourcery/pull/133
|
|
#
|
|
# Remove this test once the PR has been merged and been tagged with a release
|
|
assert_match version.to_s, shell_output("#{bin}/sourcery --version").chomp
|
|
|
|
# Re-enable these tests when the issue has been closed
|
|
#
|
|
# (testpath/"Test.swift").write <<-TEST_SWIFT
|
|
# enum One { }
|
|
# enum Two { }
|
|
# TEST_SWIFT
|
|
#
|
|
# (testpath/"Test.stencil").write <<-TEST_STENCIL
|
|
# // Found {{ types.all.count }} Types
|
|
# // {% for type in types.all %}{{ type.name }}, {% endfor %}
|
|
# TEST_STENCIL
|
|
|
|
# system "#{bin}/sourcery", testpath/"Test.swift", testpath/"Test.stencil", testpath/"Generated.swift"
|
|
|
|
# expected = <<-GENERATED_SWIFT
|
|
# // Generated using Sourcery 0.5.3 - https://github.com/krzysztofzablocki/Sourcery
|
|
# // DO NOT EDIT
|
|
#
|
|
#
|
|
# // Found 2 Types
|
|
# // One, Two,
|
|
# GENERATED_SWIFT
|
|
# assert_match expected, (testpath/"Generated.swift").read, "sourcery generation failed"
|
|
end
|
|
end
|