2017-08-22 14:45:33 +03:00
|
|
|
class Xcodegen < Formula
|
|
|
|
desc "Tool that generates your Xcode project from a project spec"
|
|
|
|
homepage "https://github.com/yonaskolb/XcodeGen"
|
2017-08-30 18:40:38 +03:00
|
|
|
url "https://github.com/yonaskolb/XcodeGen/archive/0.6.1.tar.gz"
|
|
|
|
sha256 "e281ca4db0b7f00e79c612619b7450a1343c126cf503426ae9310afbfcff7982"
|
2017-08-22 14:45:33 +03:00
|
|
|
head "https://github.com/yonaskolb/XcodeGen.git"
|
|
|
|
|
|
|
|
depends_on :xcode
|
|
|
|
|
|
|
|
def install
|
|
|
|
yaml_lib_path = "#{buildpath}/.build/release/libCYaml.dylib"
|
|
|
|
xcodegen_path = "#{buildpath}/.build/release/XcodeGen"
|
|
|
|
ohai "Building XcodeGen"
|
|
|
|
system("swift build -c release -Xlinker -rpath -Xlinker @executable_path -Xswiftc -static-stdlib")
|
|
|
|
system("install_name_tool -change #{yaml_lib_path} #{frameworks}/libCYaml.dylib #{xcodegen_path}")
|
|
|
|
frameworks.install yaml_lib_path
|
|
|
|
bin.install xcodegen_path
|
2017-08-24 01:28:46 +03:00
|
|
|
pkgshare.install "SettingPresets"
|
2017-08-22 14:45:33 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"xcodegen.yml").write <<-EOS.undent
|
|
|
|
name: GeneratedProject
|
|
|
|
targets:
|
|
|
|
- name: TestProject
|
|
|
|
type: application
|
|
|
|
platform: iOS
|
|
|
|
sources: TestProject
|
|
|
|
settings:
|
|
|
|
PRODUCT_BUNDLE_IDENTIFIER: com.test
|
|
|
|
PRODUCT_NAME: TestProject
|
|
|
|
EOS
|
|
|
|
Dir.mkdir(File.join(testpath, "TestProject"))
|
|
|
|
system("#{bin}/XcodeGen --spec #{File.join(testpath, "xcodegen.yml")}")
|
|
|
|
system("xcodebuild --project #{File.join(testpath, "GeneratedProject.xcodeproj")}")
|
|
|
|
end
|
2017-08-24 01:28:46 +03:00
|
|
|
end
|