pulsar/script/copy-files-to-bundle
2013-01-17 16:50:25 -08:00

46 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# This can only be run by xcode or xcodebuild!
# Because of the way xcodebuild invokes external scripts we need to load
# The Setup's environment ourselves. If this isn't done, things like the
# node shim won't be able to find the stuff they need.
if [ -f /opt/github/env.sh ]; then
source /opt/github/env.sh
fi
RESOUCES_PATH="$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
mkdir -p "$RESOUCES_PATH/v8_extensions"
cp "$PROJECT_DIR/native/v8_extensions/"*.js "$RESOUCES_PATH/v8_extensions/"
DIRS="src static vendor"
# Compile .coffee files into bundle
COFFEE_FILES=$(find $DIRS -type file -name '*.coffee')
for COFFEE_FILE in $COFFEE_FILES; do
echo $COFFEE_FILE
JS_FILE=$(echo "$RESOUCES_PATH/$COFFEE_FILE" | sed 's/.coffee/.js/' )
OUTPUT_PATH="$RESOUCES_PATH/$(dirname "$COFFEE_FILE")"
if [ $COFFEE_FILE -nt "$JS_FILE" ]; then
mkdir -p "$OUTPUT_PATH"
node_modules/.bin/coffee -c -o "$OUTPUT_PATH" "$COFFEE_FILE" || exit 1
fi
done;
# Compile .cson files into bundle
CSON_FILES=$(find $DIRS -type file -name '*.cson')
for CSON_FILE in $CSON_FILES; do
echo $CSON_FILE
JSON_FILE=$(echo "$RESOUCES_PATH/$CSON_FILE" | sed 's/.cson/.json/' )
OUTPUT_PATH="$RESOUCES_PATH/$(dirname "$CSON_FILE")"
if [ $CSON_FILE -nt "$JSON_FILE" ]; then
mkdir -p "$OUTPUT_PATH"
node_modules/.bin/cson2json "$CSON_FILE" > "$JSON_FILE"
fi
done;
# Copy non-coffee files into bundle
rsync --archive --recursive --exclude="src/**/*.coffee" --exclude="src/**/*.cson" src static vendor spec benchmark themes "$RESOUCES_PATH"