43 lines
1.6 KiB
Ruby
43 lines
1.6 KiB
Ruby
class Configen < Formula
|
|
desc "Configuration file code generator for use in Xcode projects"
|
|
homepage "https://github.com/theappbusiness/ConfigGenerator"
|
|
url "https://github.com/theappbusiness/ConfigGenerator/archive/v1.0.1.tar.gz"
|
|
sha256 "ade2c4296643cbc0c21d989d4506eef9d797a0349300ff46590a6b47979cdf64"
|
|
head "https://github.com/theappbusiness/ConfigGenerator.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "46e883171ac5cf880ae7a8f58ece9d7d0e33d3d1d5ca3414626a4c067df5da6b" => :high_sierra
|
|
sha256 "3b445fd66dc371d20cd561f2ceb13b61c9814d02f759e458708cf5355077fb25" => :sierra
|
|
end
|
|
|
|
depends_on :xcode => ["9.0", :build]
|
|
|
|
def install
|
|
xcodebuild "SYMROOT=build"
|
|
bin.install "build/Release/configen"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.plist").write <<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>testURL</key>
|
|
<string>https://example.com/api</string>
|
|
<key>retryCount</key>
|
|
<integer>2</integer>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
(testpath/"test.map").write <<~EOS
|
|
testURL : URL
|
|
retryCount : Int
|
|
EOS
|
|
system bin/"configen", "-p", "test.plist", "-h", "test.map", "-n", "AppConfig", "-o", testpath
|
|
assert_predicate testpath/"AppConfig.swift", :exist?, "Failed to create config class!"
|
|
assert_match "static let testURL: URL = URL(string: \"https://example.com/api\")", File.read("AppConfig.swift")
|
|
assert_match "static let retryCount: Int = 2", File.read("AppConfig.swift")
|
|
end
|
|
end
|