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