homebrew-core/Formula/xcodegen.rb
2018-08-23 00:56:55 +08:00

42 lines
1.5 KiB
Ruby

class Xcodegen < Formula
desc "Generate your Xcode project from a spec file and your folder structure"
homepage "https://github.com/yonaskolb/XcodeGen"
url "https://github.com/yonaskolb/XcodeGen/archive/1.11.1.tar.gz"
sha256 "c33d953968be78c3f3e054b323c81d3f057ceab7233f687a46a56b0f055a4bf5"
bottle do
cellar :any_skip_relocation
sha256 "f1f58515546e4b67f4fef683a4d9182c1088976e9fd80db0923e1770ff1356b5" => :high_sierra
end
depends_on :xcode => ["9.3", :build]
def install
# fixes an issue an issue in homebrew when both Xcode 9.3+ and command line tools are installed
# see more details here https://github.com/Homebrew/brew/pull/4147
# remove this once homebrew is patched
ENV["CC"] = Utils.popen_read("xcrun -find clang").chomp
system "make", "install", "PREFIX=#{prefix}"
end
test do
(testpath/"xcodegen.yml").write <<~EOS
name: GeneratedProject
options:
bundleIdPrefix: com.project
targets:
TestProject:
type: application
platform: iOS
sources: TestProject
EOS
(testpath/"TestProject").mkpath
system bin/"XcodeGen", "--spec", testpath/"xcodegen.yml"
assert_predicate testpath/"GeneratedProject.xcodeproj", :exist?
assert_predicate testpath/"GeneratedProject.xcodeproj/project.pbxproj", :exist?
output = (testpath/"GeneratedProject.xcodeproj/project.pbxproj").read
assert_match "name = TestProject", output
assert_match "isa = PBXNativeTarget", output
end
end