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