Skip to content

Commit

Permalink
Allow usage of developer frameworks (like XCTest).
Browse files Browse the repository at this point in the history
  • Loading branch information
neonichu committed Apr 4, 2015
1 parent a792bda commit c0e4a4c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bin/cato
Expand Up @@ -8,8 +8,13 @@ function install_dependencies() {

PLATFORM="`xcrun --sdk macosx --show-sdk-platform-path`"
SDK="`ls -d "$PLATFORM"/Developer/SDKs/*|head -n 1`"
# ¯\_(ツ)_/¯ http://unix.stackexchange.com/questions/65212/why-doesnt-this-xargs-command-work
FRAMEWORKS="`ls -d "$SDK"//System/Library/Frameworks/*.framework|xargs -L1 sh -c 'basename $1 .framework' dummy`"

FRAMEWORKS=""
for frameworks_dir in "$SDK"//System/Library/Frameworks $FRAMEWORKS_PATH
do
# ¯\_(ツ)_/¯ http://unix.stackexchange.com/questions/65212/why-doesnt-this-xargs-command-work
FRAMEWORKS="$FRAMEWORKS `ls -d $frameworks_dir/*.framework|xargs -L1 sh -c 'basename $1 .framework' dummy`"
done

cat <<EOF >$PKG_DIR/Podfile
platform :osx, '10.10'
Expand Down Expand Up @@ -48,6 +53,9 @@ then
exit 1
fi

SDK_PATH="`xcrun --show-sdk-path`"
FRAMEWORKS_PATH="$SDK_PATH/../../Library/Frameworks"

PKG_DIR="$HOME/.📦/`basename $SCRIPT .swift`"
mkdir -p "$PKG_DIR"

Expand All @@ -56,4 +64,4 @@ then
install_dependencies "$SCRIPT"
fi

exec xcrun swift -F"$PKG_DIR/Rome" "$SCRIPT"
exec xcrun swift -F"$PKG_DIR/Rome" -F"$FRAMEWORKS_PATH" "$SCRIPT"
13 changes: 13 additions & 0 deletions test/2
@@ -0,0 +1,13 @@
#!/usr/bin/env cato 1.2

import XCTest
import xctester

class YOLO : XCTestCase {
func testAdd() {
let result = 3 + 5
XCTAssertEqual(8, result, "yolo")
}
}

XCTestRunAll()

0 comments on commit c0e4a4c

Please sign in to comment.