homebrew-core/Formula/bartycrouch.rb

46 lines
1.4 KiB
Ruby

class Bartycrouch < Formula
desc "Incrementally update your Strings files"
homepage "https://github.com/Flinesoft/BartyCrouch"
url "https://github.com/Flinesoft/BartyCrouch/archive/3.13.0.tar.gz"
sha256 "b6582060884e69ec3920c330dfbd002aa61fe14824ab407bb2ca68f2032c0dbd"
bottle do
cellar :any_skip_relocation
sha256 "ad218206aedf55c5f03e71c96213f3e76bc92388fcd22d1eddd4a089607dccc6" => :high_sierra
sha256 "50f12699a173f8c27a98c562d89c6ffae936d78b7cf8a97f5d33d2b409117a01" => :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