Files
atom/script/copy-files-to-bundle
2012-09-20 13:28:33 -07:00

29 lines
1.1 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/"
for DIR in src static vendor spec benchmark bundles themes; do
for COFFEE_PATH in $(find "$DIR" -type f -name '*.coffee'); do
JAVASCRIPT_PATH=$(echo "$RESOUCES_PATH/$COFFEE_PATH" | sed 's/\.coffee$/.js/')
# Compiling coffeescript is slow, so only compile the .coffee files if
# they are newer than the .js files
if [ "$COFFEE_PATH" -nt "$JAVASCRIPT_PATH" ]; then
# Remove spaces from DESTINATION_DIR beause `coffee` doesn't handle them
DESTINATION_DIR=$(dirname "$JAVASCRIPT_PATH" | sed 's/ /\\ /g')
node_modules/.bin/coffee -c -o "$DESTINATION_DIR" "$COFFEE_PATH"
fi
done
done;