homebrew-core/Formula/xcodegen.rb
2018-07-16 02:41:12 -07: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.10.3.tar.gz"
sha256 "30944e90b9855ff893c6581e0d6dcdf7e8ab2c0c5edadacba7fb5ce27164975a"
bottle do
cellar :any_skip_relocation
sha256 "fa6e2a206f3316a3b86bdf40c05576d6f70981752857359249c265bd061102dc" => :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