Skip to content

Instantly share code, notes, and snippets.

@tapthaker
Last active June 9, 2016 09:05
Show Gist options
  • Save tapthaker/bfd01be68fb572a17ec8 to your computer and use it in GitHub Desktop.
Save tapthaker/bfd01be68fb572a17ec8 to your computer and use it in GitHub Desktop.
class Fbsimctl < Formula
desc 'A Command Line interface to FBSimulatorControl'
homepage 'https://github.com/facebook/FBSimulatorControl'
url 'https://github.com/facebook/FBSimulatorControl/archive/master.zip'
sha256 'b88b4dd1f24edc59a51023f80163b904a66554bfea636bdc4e830ba5b22c5942'
head 'https://github.com/facebook/FBSimulatorControl.git'
version '1.0'
depends_on :xcode => '7.3'
depends_on "carthage"
def install
system 'cd fbsimctl && /usr/local/bin/carthage update'
xcodebuild '-workspace', 'fbsimctl/fbsimctl.xcworkspace',
'-scheme', 'fbsimctl',
'-configuration', 'Release'
system 'install_name_tool', '-change',
'@rpath/FBControlCore.framework/Versions/A/FBControlCore',
"#{frameworks}/FBControlCore.framework/Versions/A/FBControlCore",
'./fbsimctl/Build/Products/Release/FBSimulatorControlKit.framework/Versions/A/FBSimulatorControlKit'
system 'install_name_tool', '-change',
'@rpath/XCTestBootstrap.framework/Versions/A/XCTestBootstrap',
"#{frameworks}/XCTestBootstrap.framework/Versions/A/XCTestBootstrap",
'./fbsimctl/Build/Products/Release/FBSimulatorControlKit.framework/Versions/A/Frameworks/FBSimulatorControl.framework/Versions/A/FBSimulatorControl'
frameworks.install './fbsimctl/Build/Products/Release/XCTestBootstrap.framework'
frameworks.install './fbsimctl/Build/Products/Release/FBSimulatorControlKit.framework'
frameworks.install './fbsimctl/Build/Products/Release/FBControlCore.framework'
system 'install_name_tool', '-change',
'@rpath/FBSimulatorControlKit.framework/Versions/A/FBSimulatorControlKit',
"#{frameworks}/FBSimulatorControlKit.framework/Versions/A/FBSimulatorControlKit",
'./fbsimctl/Build/Products/Release/fbsimctl'
bin.install './fbsimctl/Build/Products/Release/fbsimctl'
end
def caveats
<<-EOS.undent
`fbimctl` links with Private Frameworks that Xcode uses to manipulate Simulators.
In order to avoid linking with an Xcode directory that may move, when launched,
`fbsimctl` will link with the version of Xcode defined by `xcode-select`.
To confirm the version of Xcode that `fbsimctl` will link with at runtime, execute:
xcode-select --print-path
EOS
end
test do
system "(#{bin}/fbsimctl --help; true)"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment