class Swiftformat < Formula desc "Formatting tool for reformatting Swift code" homepage "https://github.com/nicklockwood/SwiftFormat" url "https://github.com/nicklockwood/SwiftFormat/archive/0.29.4.tar.gz" sha256 "f206c7f29ade97e4ef1e5133d6f19d16876faeba5c41604a45ff90f5edfef23b" head "https://github.com/nicklockwood/SwiftFormat.git", :shallow => false bottle do cellar :any_skip_relocation sha256 "f1149c0ab5c65c949630918139f788a1e022661c3f4b8d94a3d73661da99a621" => :sierra sha256 "d265ce1075ebf9e098654ad25f62482d5661ccd3278b3c104eb9ad0cff0ecbbf" => :el_capitan end depends_on :xcode => ["8.0", :build] def install xcodebuild "-project", "SwiftFormat.xcodeproj", "-scheme", "SwiftFormat (Command Line Tool)", "CODE_SIGN_IDENTITY=", "SYMROOT=build", "OBJROOT=build" bin.install "build/Release/swiftformat" end test do (testpath/"potato.swift").write <<-EOS.undent struct Potato { let baked: Bool } EOS system "#{bin}/swiftformat", "#{testpath}/potato.swift" end end