From 4b02e9340317de60ecfd360c791f07ef78d7faab Mon Sep 17 00:00:00 2001 From: Evgeny Aleksandrov Date: Mon, 18 Sep 2017 11:14:08 +0300 Subject: [PATCH] configen 1.0.0 (new formula) Closes #18206. Signed-off-by: Alex Dunn --- Formula/configen.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Formula/configen.rb diff --git a/Formula/configen.rb b/Formula/configen.rb new file mode 100644 index 0000000000..5cd1087236 --- /dev/null +++ b/Formula/configen.rb @@ -0,0 +1,38 @@ +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.0.tar.gz" + sha256 "b44b18df31a6a0bb2e5e44db48f26c7bba504a9b78d56fdf6a3bc543d79c2850" + + head "https://github.com/theappbusiness/ConfigGenerator.git" + + depends_on :xcode => :build + + def install + xcodebuild "SYMROOT=build" + bin.install "build/Release/configen" + end + + test do + (testpath/"test.plist").write <<-EOS.undent + + + + + testURL + http://example.com/api + retryCount + 2 + + + EOS + (testpath/"test.map").write <<-EOS.undent + 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: \"http://example.com/api\")", File.read("AppConfig.swift") + assert_match "static let retryCount: Int = 2", File.read("AppConfig.swift") + end +end