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