class Swiftformat < Formula desc "Formatting tool for reformatting Swift code" homepage "https://github.com/nicklockwood/SwiftFormat" url "https://github.com/nicklockwood/SwiftFormat/archive/0.28.5.tar.gz" sha256 "c1f42d4409e37861a95f0b3c6b82a66a297e16c5521f50d17fa45e037e32778a" head "https://github.com/nicklockwood/SwiftFormat.git", :shallow => false bottle do cellar :any_skip_relocation sha256 "e321607eb0b7f52b270417d4bea595dfcdd86d81fd90fb36c966c4da1fda4c02" => :sierra sha256 "8cca54c9aedd251aec4078e7cdd6f051f7d09d9e4ea4d4d371645549c486b6a6" => :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