class Bartycrouch < Formula desc "Incrementally update your Strings files" homepage "https://github.com/Flinesoft/BartyCrouch" url "https://github.com/Flinesoft/BartyCrouch/archive/3.9.3.tar.gz" sha256 "4700d848a9e117ac2490ba8aa0e6b5b230903f7e29827a1d06ab892d9d2768ad" bottle do cellar :any_skip_relocation sha256 "61496a1b58dbb1c843147fcbd703d544ff884eb0b71fef11fb160577120f1840" => :high_sierra sha256 "60d57a70647108d408a486fe4ebd0e79e8522613f65b367b93230a409882a274" => :sierra end depends_on :xcode => ["9.0", :build] def install xcodebuild "-project", "BartyCrouch.xcodeproj", "-scheme", "BartyCrouch CLI", "SYMROOT=build", "DSTROOT=#{prefix}", "INSTALL_PATH=/bin", "-verbose", "install" end test do (testpath/"Test.swift").write <<~EOS import Foundation class Test { func test() { NSLocalizedString("test", comment: "") } } EOS (testpath/"en.lproj/Localizable.strings").write <<~EOS /* No comment provided by engineer. */ "oldKey" = "Some translation"; EOS system bin/"bartycrouch", "code", "-p", testpath, "-l", testpath, "-a" assert_match /"oldKey" = "/, File.read("en.lproj/Localizable.strings") assert_match /"test" = "/, File.read("en.lproj/Localizable.strings") end end