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.9.2.tar.gz"
sha256 "5077fcdd377a561feb419a69c7ecdb24f707020d4eb0b629432b7a70bebf670b"
bottle do
cellar :any_skip_relocation
sha256 "17f2224159454508ab5eca6036060da2a35578732adef128dfa8a2c297c50821" => :high_sierra
sha256 "86c0be0e0e907f82454b1d812a0e40cde473c4ede36ab37f514626d1720280fc" => :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