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