homebrew-core/Formula/bartycrouch.rb
2018-03-08 16:48:27 +10:00

45 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.10.1.tar.gz"
sha256 "ab3571bc40ce3c3b22e5278b827bfc4cda400408fba01dfb6a50ab89f2437363"
bottle do
cellar :any_skip_relocation
sha256 "57e7789894220625d140b3dca83375589ccd5d3dfead54c75ef149bcb60447ed" => :high_sierra
sha256 "18d4973f30d4da730355c54eecd0e25499238b46ea3b325bbcfdfffb41e31e25" => :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