homebrew-core/Formula/sourcery.rb
2017-10-29 12:12:42 -07:00

56 lines
2 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.9.0.tar.gz"
sha256 "02f8c0fda5adfdc33938e00db0f90410079eb79cb9c7f2895742184911c8f338"
head "https://github.com/krzysztofzablocki/Sourcery.git"
bottle do
cellar :any_skip_relocation
sha256 "ebab65610598ac601484a76a378951d6d2081b5296691b617af728ab26dd55df" => :high_sierra
sha256 "65ef899d25716768b5be04bcaf2c0d0761f8d6a17225069c8521a1cfe6450d1a" => :sierra
end
depends_on :xcode => ["6.0", :run]
depends_on :xcode => ["8.3", :build]
def install
system "swift", "build", "--disable-sandbox", "-c", "release", "-Xswiftc",
"-static-stdlib"
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